2

I've made some tests on macOS 10.13 with dppx.

macOS has 4 scales:

  1. 1680 х 1050
  2. 1440 х 900 (as default begin 2016+)
  3. 1280 x 800 (as default untill 2016)
  4. 1024 х 640

I've cheched dppx (using this online service) and as a results, I've always got 2dppx!

Why? What am I doing wrong? This is a bug?

macbook resolution is 2560*1600, assuming that I have 2 dppx, real scaling is: 2560 / 2dppx x 1600 / 2 dppx === 1280 x 800

Other scalling is:

  1. 1680 х 1050 = 1.52 dppx
  2. 1440 х 900 = 1.77 dppx
  3. 1280 x 800 = 2 dppx
  4. 1024 х 640 = 2.5 dppx

I'm right? If so, why do the tools for checking dppx always write 2dppx?

mixalbl4
  • 3,507
  • 1
  • 30
  • 44
  • dppx are usually rounded to whole values; so that stuff is scaled by whole factors. Pictures of line drawings, for instance, those would look horrible when multiplied by 1.77. – Mr Lister Sep 29 '17 at 13:12
  • @MrLister dppx has 0.1 step, http://s3.micp.ru/yTv35.png – mixalbl4 Sep 29 '17 at 13:30
  • And Chrome uses nice round numbers for its zoom levels (sacrificing a consistent ratio), while Firefox uses a somewhat consistent ratio between zoom levels (sacrificing nice round numbers). – Josh Lee Sep 29 '17 at 16:38

1 Answers1

2

This is consistent with how Mac OS treats retina as a whole. The scaling factor is locked at 2x and the virtual resolution of the screen changes, instead of the resolution of the screen being fixed and the scaling factor changing. The web browser is faithfully exposing this fact to the web page.

At 1680x1050, for instance, the entire screen is rendered at 3360x2100 with a 2x scaling factor, and then scaled down by a factor of 1.3125 to fit on the screen, but this scaling is invisible to apps. If the MacBook Retina is set to any resolution other than exactly 2x the physical display, then the user has no hope of seeing a pixel-perfect image.

For a platform where the devicePixelRatio can change, test your site against the display scaling in Android N, or change the zoom level in Chrome or Firefox, but not Safari.

Some links:

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
  • And as a result, this is a bug or feature? I think this is a bug, because macOS doesn't give real screen dppx. It does not matter double-processing the image (increase-decrease), as a result, what should be painted on 100px in reality is drawn for example at 50 pixels, while the browser thinks it was drawn on 100 pixels. – mixalbl4 Oct 02 '17 at 08:08