diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-04-10 11:49:43 -0400 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-04-10 11:49:43 -0400 |
commit | eb499e77c1f6cc77452cadd2445b7d99d1b6b7fa (patch) | |
tree | c41e27e63f9811335205f2f2c41081fe2191a12b /src/map/map.cpp | |
parent | 524c8737e418c22e97ab7c3d269e456212662a14 (diff) | |
download | qtlocation-mapboxgl-eb499e77c1f6cc77452cadd2445b7d99d1b6b7fa.tar.gz |
fix linejoin drawing on retina
Diffstat (limited to 'src/map/map.cpp')
-rw-r--r-- | src/map/map.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/map/map.cpp b/src/map/map.cpp index 75bfdb2c9e..884e21146a 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -25,15 +25,9 @@ Map::~Map() { settings.sync(); } -void Map::setup(float pixelRatio) { - +void Map::setup() { painter.setup(); - pixel_ratio = pixelRatio; - - style.sprite = std::make_shared<Sprite>(); - style.sprite->load(kSpriteURL, pixel_ratio); - style.loadJSON(resources::style, resources::style_size); } @@ -50,13 +44,15 @@ void Map::loadSettings() { update(); } -void Map::resize(uint32_t width, uint32_t height, uint32_t fb_width, uint32_t fb_height) { - transform.width = width; - transform.height = height; - transform.fb_width = fb_width; - transform.fb_height = fb_height; - transform.pixelRatio = pixel_ratio; +void Map::resize(uint16_t width, uint16_t height, uint16_t fb_width, uint16_t fb_height) { + transform.resize(width, height, fb_width, fb_height); painter.resize(fb_width, fb_height); + + if (!style.sprite || style.sprite->pixelRatio) { + style.sprite = std::make_shared<Sprite>(transform.getPixelRatio()); + style.sprite->load(kSpriteURL); + } + update(); } @@ -177,8 +173,8 @@ void Map::setAngle(double angle, double x, double y, double duration) { double dx = 0, dy = 0; if (x >= 0 && y >= 0) { - dx = (transform.width / 2) - x; - dy = (transform.height / 2) - y; + dx = (transform.getWidth() / 2) - x; + dy = (transform.getWidth() / 2) - y; transform.moveBy(dx, dy, duration); } |