Teach the mid-end about device pixel ratios

The device pixel ratio indicates how many physical pixels there are in
the platonic ideal of a pixel, at least approximately.  In Web browsers,
the device pixel ratio is used to represent "retina" displays with
particularly high pixel densities, and also to reflect user-driven
zooming of the page to different text sizes.

The mid-end uses the device pixel ratio to adjust the tile size at
startup, and can also respond to changes in device pixel ratio by
adjusting the time size later.  This is accomplished through a new
argument to midend_size() which can simply be passed as 1.0 in any front
end that doesn't care about this.
This commit is contained in:
Ben Harris
2022-11-07 21:42:38 +00:00
parent fba22f04d6
commit e45cd43aaa
8 changed files with 87 additions and 20 deletions

6
osx.m
View File

@ -524,7 +524,7 @@ struct frontend {
frame.origin.x = 0;
w = h = INT_MAX;
midend_size(me, &w, &h, false);
midend_size(me, &w, &h, false, 1.0);
frame.size.width = w;
frame.size.height = h;
fe.w = w;
@ -559,7 +559,7 @@ struct frontend {
*/
midend_new_game(me);
w = h = INT_MAX;
midend_size(me, &w, &h, false);
midend_size(me, &w, &h, false, 1.0);
rect.size.width = w;
rect.size.height = h;
fe.w = w;
@ -959,7 +959,7 @@ struct frontend {
int w, h;
w = h = INT_MAX;
midend_size(me, &w, &h, false);
midend_size(me, &w, &h, false, 1.0);
size.width = w;
size.height = h;
fe.w = w;