mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Merge pull request #13668 from ZehMatt/performance/opengl-setdpi
Avoid unnecessary calculations when the passed DPI is the active DPI
This commit is contained in:
@@ -1010,6 +1010,12 @@ void OpenGLDrawingContext::HandleTransparency()
|
|||||||
|
|
||||||
void OpenGLDrawingContext::SetDPI(rct_drawpixelinfo* dpi)
|
void OpenGLDrawingContext::SetDPI(rct_drawpixelinfo* dpi)
|
||||||
{
|
{
|
||||||
|
if (dpi == _dpi)
|
||||||
|
{
|
||||||
|
// Don't need to recalculate anything if identical.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto screenDPI = _engine->GetDPI();
|
auto screenDPI = _engine->GetDPI();
|
||||||
auto bytesPerRow = screenDPI->GetBytesPerRow();
|
auto bytesPerRow = screenDPI->GetBytesPerRow();
|
||||||
auto bitsOffset = static_cast<size_t>(dpi->bits - screenDPI->bits);
|
auto bitsOffset = static_cast<size_t>(dpi->bits - screenDPI->bits);
|
||||||
|
|||||||
Reference in New Issue
Block a user