diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-01-16 16:43:38 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-22 22:16:07 +0100 |
commit | 6bcc4884c20a15b0e627f88ad2bca766a8914377 (patch) | |
tree | a9374abeea6f8863fd0c590883af010ce37324e0 /src/video/win32_v.cpp | |
parent | d4dbb3f46ebeded1506af67fcd53dadb4b04f564 (diff) | |
download | openttd-6bcc4884c20a15b0e627f88ad2bca766a8914377.tar.xz |
Add: [OpenGL] Accelerated mouse cursor drawing.
Diffstat (limited to 'src/video/win32_v.cpp')
-rw-r--r-- | src/video/win32_v.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 55f694990..f5c6d3cc7 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -1520,6 +1520,11 @@ bool VideoDriver_Win32OpenGL::AfterBlitterChange() return true; } +void VideoDriver_Win32OpenGL::ClearSystemSprites() +{ + OpenGLBackend::Get()->ClearCursorCache(); +} + bool VideoDriver_Win32OpenGL::AllocateBackingStore(int w, int h, bool force) { if (!force && w == _screen.width && h == _screen.height) return false; @@ -1554,30 +1559,21 @@ void VideoDriver_Win32OpenGL::Paint() { PerformanceMeasurer framerate(PFE_VIDEO); - if (IsEmptyRect(this->dirty_rect)) return; - if (_cur_palette.count_dirty != 0) { Blitter *blitter = BlitterFactory::GetCurrentBlitter(); - switch (blitter->UsePaletteAnimation()) { - case Blitter::PALETTE_ANIMATION_BLITTER: - blitter->PaletteAnimate(_local_palette); - break; - - case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND: - OpenGLBackend::Get()->UpdatePalette(_local_palette.palette, _local_palette.first_dirty, _local_palette.count_dirty); - break; - - case Blitter::PALETTE_ANIMATION_NONE: - break; - - default: - NOT_REACHED(); + /* Always push a changed palette to OpenGL. */ + OpenGLBackend::Get()->UpdatePalette(_local_palette.palette, _local_palette.first_dirty, _local_palette.count_dirty); + if (blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_BLITTER) { + blitter->PaletteAnimate(_local_palette); } + _cur_palette.count_dirty = 0; } OpenGLBackend::Get()->Paint(); + if (_cursor.in_window) OpenGLBackend::Get()->DrawMouseCursor(); + SwapBuffers(this->dc); } |