Avoid unnecessary calculations when the passed DPI is the active DPI

This commit is contained in:
Matt 2020-12-31 20:36:17 +02:00
parent ac2057775e
commit 114be0e62b
No known key found for this signature in database
GPG Key ID: 6D4C24A61C93E208
1 changed files with 6 additions and 0 deletions

View File

@ -1010,6 +1010,12 @@ void OpenGLDrawingContext::HandleTransparency()
void OpenGLDrawingContext::SetDPI(rct_drawpixelinfo* dpi)
{
if (dpi == _dpi)
{
// Don't need to recalculate anything if identical.
return;
}
auto screenDPI = _engine->GetDPI();
auto bytesPerRow = screenDPI->GetBytesPerRow();
auto bitsOffset = static_cast<size_t>(dpi->bits - screenDPI->bits);