mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 22:34:33 +01:00
Fix openGl zooming placement.
Note there are still bugs with zooming
This commit is contained in:
@@ -605,10 +605,12 @@ void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 t
|
||||
|
||||
GLuint texture = _textureCache->GetOrLoadImageTexture(image);
|
||||
|
||||
uint8 zoomLevel = (1 << _dpi->zoom_level);
|
||||
|
||||
sint32 drawOffsetX = g1Element->x_offset;
|
||||
sint32 drawOffsetY = g1Element->y_offset;
|
||||
sint32 drawWidth = (uint16)g1Element->width >> _dpi->zoom_level;
|
||||
sint32 drawHeight = (uint16)g1Element->height >> _dpi->zoom_level;
|
||||
sint32 drawWidth = g1Element->width;
|
||||
sint32 drawHeight = g1Element->height;
|
||||
|
||||
sint32 left = x + drawOffsetX;
|
||||
sint32 top = y + drawOffsetY;
|
||||
@@ -624,10 +626,20 @@ void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 t
|
||||
std::swap(top, bottom);
|
||||
}
|
||||
|
||||
left += _offsetX;
|
||||
top += _offsetY;
|
||||
right += _offsetX;
|
||||
bottom += _offsetY;
|
||||
left -= _dpi->x;
|
||||
top -= _dpi->y;
|
||||
right -= _dpi->x;
|
||||
bottom -= _dpi->y;
|
||||
|
||||
left /= zoomLevel;
|
||||
top /= zoomLevel;
|
||||
right /= zoomLevel;
|
||||
bottom /= zoomLevel;
|
||||
|
||||
left += _clipLeft;
|
||||
top += _clipTop;
|
||||
right += _clipLeft;
|
||||
bottom += _clipTop;
|
||||
|
||||
_drawImageShader->Use();
|
||||
_drawImageShader->SetClip(_clipLeft, _clipTop, _clipRight, _clipBottom);
|
||||
@@ -643,6 +655,8 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(sint32 x, sint32 y, uint32 maskIm
|
||||
GLuint textureMask = _textureCache->GetOrLoadImageTexture(maskImage);
|
||||
GLuint textureColour = _textureCache->GetOrLoadImageTexture(colourImage);
|
||||
|
||||
uint8 zoomLevel = (1 << _dpi->zoom_level);
|
||||
|
||||
sint32 drawOffsetX = g1ElementMask->x_offset;
|
||||
sint32 drawOffsetY = g1ElementMask->y_offset;
|
||||
sint32 drawWidth = Math::Min(g1ElementMask->width, g1ElementColour->width);
|
||||
@@ -662,10 +676,20 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(sint32 x, sint32 y, uint32 maskIm
|
||||
std::swap(top, bottom);
|
||||
}
|
||||
|
||||
left += _offsetX;
|
||||
top += _offsetY;
|
||||
right += _offsetX;
|
||||
bottom += _offsetY;
|
||||
left -= _dpi->x;
|
||||
top -= _dpi->y;
|
||||
right -= _dpi->x;
|
||||
bottom -= _dpi->y;
|
||||
|
||||
left /= zoomLevel;
|
||||
top /= zoomLevel;
|
||||
right /= zoomLevel;
|
||||
bottom /= zoomLevel;
|
||||
|
||||
left += _clipLeft;
|
||||
top += _clipTop;
|
||||
right += _clipLeft;
|
||||
bottom += _clipTop;
|
||||
|
||||
_drawImageMaskedShader->Use();
|
||||
_drawImageMaskedShader->SetClip(_clipLeft, _clipTop, _clipRight, _clipBottom);
|
||||
|
||||
Reference in New Issue
Block a user