Make pixelRatio constant across a Map object lifetime

also moves framebuffer size out of TransformState into its own object
This commit is contained in:
Konstantin Käfer
2015-07-01 12:39:21 +02:00
parent 3a07cb2f1e
commit 675ddddee7
40 changed files with 308 additions and 214 deletions

View File

@@ -34,18 +34,13 @@ Transform::Transform(View &view_)
#pragma mark - Map View
bool Transform::resize(const uint16_t w, const uint16_t h, const float ratio,
const uint16_t fb_w, const uint16_t fb_h) {
if (state.width != w || state.height != h || state.pixelRatio != ratio ||
state.framebuffer[0] != fb_w || state.framebuffer[1] != fb_h) {
bool Transform::resize(const std::array<uint16_t, 2> size) {
if (state.width != size[0] || state.height != size[1]) {
view.notifyMapChange(MapChangeRegionWillChange);
state.width = w;
state.height = h;
state.pixelRatio = ratio;
state.framebuffer[0] = fb_w;
state.framebuffer[1] = fb_h;
state.width = size[0];
state.height = size[1];
state.constrain(state.scale, state.y);
view.notifyMapChange(MapChangeRegionDidChange);