From abf440d01ce1e7056997a4aa50f2da8200a13541 Mon Sep 17 00:00:00 2001 From: Dennis-Z Date: Wed, 16 Aug 2017 23:11:43 +0200 Subject: [PATCH] Fix viewport clipping issues with the OpenGL renderer (#6188) --- distribution/changelog.txt | 1 + .../drawing/engines/opengl/OpenGLDrawingEngine.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index a3b1d34db6..c7ab6f56d7 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -6,6 +6,7 @@ - Fix: [#6101] Rides remain in ride list window briefly after demolition. - Fix: [#6115] Random title screen music not random on launch - Fix: [#6133] Construction rights not shown after selecting buy mode. +- Fix: [#6188] Viewports not being clipped properly when zoomed out in OpenGL mode. - Fix: Infinite loop when removing scenery elements with >127 base height. - Improved: [#6186] Transparent menu items now draw properly in OpenGL mode. diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 9bbd30b6d0..9f1c182a9c 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -927,8 +927,8 @@ void OpenGLDrawingContext::SetDPI(rct_drawpixelinfo * dpi) _clipLeft = (sint32)(bitsOffset % (screenDPI->width + screenDPI->pitch)); _clipTop = (sint32)(bitsOffset / (screenDPI->width + screenDPI->pitch)); - _clipRight = _clipLeft + dpi->width; - _clipBottom = _clipTop + dpi->height; + _clipRight = _clipLeft + (dpi->width >> dpi->zoom_level); + _clipBottom = _clipTop + (dpi->height >> dpi->zoom_level); _offsetX = _clipLeft - dpi->x; _offsetY = _clipTop - dpi->y;