Changeset - r24901:373764ef362c
[Not reviewed]
master
0 3 0
Michael Lutz - 3 years ago 2021-01-16 15:43:33
michi@icosahedron.de
Codechange: Allow video drivers to handle the cursor themselves.
3 files changed with 23 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/gfx.cpp
Show inline comments
 
@@ -1348,6 +1348,9 @@ void ScreenSizeChanged()
 

	
 
void UndrawMouseCursor()
 
{
 
	/* Don't undraw mouse cursor if it is handled by the video driver. */
 
	if (VideoDriver::GetInstance()->UseSystemCursor()) return;
 

	
 
	/* Don't undraw the mouse cursor if the screen is not ready */
 
	if (_screen.dst_ptr == nullptr) return;
 

	
 
@@ -1361,6 +1364,9 @@ void UndrawMouseCursor()
 

	
 
void DrawMouseCursor()
 
{
 
	/* Don't draw mouse cursor if it is handled by the video driver. */
 
	if (VideoDriver::GetInstance()->UseSystemCursor()) return;
 

	
 
	/* Don't draw the mouse cursor if the screen is not ready */
 
	if (_screen.dst_ptr == nullptr) return;
 

	
src/spritecache.cpp
Show inline comments
 
@@ -17,6 +17,7 @@
 
#include "blitter/factory.hpp"
 
#include "core/math_func.hpp"
 
#include "core/mem_func.hpp"
 
#include "video/video_driver.hpp"
 

	
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
@@ -977,6 +978,8 @@ void GfxClearSpriteCache()
 
		SpriteCache *sc = GetSpriteCache(i);
 
		if (sc->type != ST_RECOLOUR && sc->ptr != nullptr) DeleteEntryFromSpriteCache(i);
 
	}
 

	
 
	VideoDriver::GetInstance()->ClearSystemSprites();
 
}
 

	
 
/* static */ ReusableBuffer<SpriteLoader::CommonPixel> SpriteLoader::Sprite::buffer[ZOOM_LVL_COUNT];
src/video/video_driver.hpp
Show inline comments
 
@@ -86,6 +86,20 @@ public:
 
	}
 

	
 
	/**
 
	 * Get whether the mouse cursor is drawn by the video driver.
 
	 * @return True if cursor drawing is done by the video driver.
 
	 */
 
	virtual bool UseSystemCursor()
 
	{
 
		return false;
 
	}
 

	
 
	/**
 
	 * Clear all cached sprites.
 
	 */
 
	virtual void ClearSystemSprites() {}
 

	
 
	/**
 
	 * Whether the driver has a graphical user interface with the end user.
 
	 * Or in other words, whether we should spawn a thread for world generation
 
	 * and NewGRF scanning so the graphical updates can keep coming. Otherwise
0 comments (0 inline, 0 general)