Mapbox-gl-native: [core] mbgl::View::getPixelRatio should be dynamic

Created on 13 May 2016  路  4Comments  路  Source: mapbox/mapbox-gl-native

Documentation for mbgl::View::getPixelRatio() says:

// Called directly after initialization. Must always return the same value, i.e. it may
// not change over time.

This is OK as long as the application window remains on a fixed device pixel ratio during its runtime. However, in my environment I have an external monitor connected to my MacBook. When moving the application window between the Retina display and the external monitor, the pixel ratio could also be updated.

@kkaefer @ansis is this something feasible for us to do?

Core bug

All 4 comments

We used to support that, but it turned out too much of a hassle. Since this only every occurs on Mac desktops, we punted on it.

@brunoabinader Is it possible to detect the change in pixel ratio in platform specific bindibg? Calling setStyleURL with the currently loaded style upon change should fix it.

@mb12 The issue isn't about detecting the pixel ratio change event itself, but about everything that has to happen when we're changing the pixel ratio (e.g. recreate textures, scale + reload the spritesheet + atlas.

This is also the source of crashes or unexpected behavior in the OS X SDK: #3451 #5010.

Was this page helpful?
0 / 5 - 0 ratings