Skip to content

Commit

Permalink
Fix mac Device::getPixelRatio incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 committed Dec 11, 2023
1 parent 159f49d commit 206c7e3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/platform/mac/Device-mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ of this software and associated documentation files (the "Software"), to deal

float Device::getPixelRatio()
{
return Device::getDPI() / 25.4f;
NSScreen* screen = [NSScreen mainScreen];
const auto points = [screen frame];
const auto pixels = [screen convertRectToBacking:points];
return static_cast<float>(pixels.size.width / points.size.width);
}

void Device::setAccelerometerEnabled(bool isEnabled) {}
Expand Down

0 comments on commit 206c7e3

Please sign in to comment.