fix sprites for pixel ratios that are not 1 and 2

- OpenGL ES 2 doesn't allow NPOT textures with wrap-around
- The Sprite object reported the map's pixelRatio, even though it loaded @2x assets
- Copying icons from the sprite into the atlas now uses bilinear scaling to scale up to the actual size
This commit is contained in:
Konstantin Käfer
2015-03-16 19:30:08 +01:00
parent 0b1faba369
commit 48c55af5c1
19 changed files with 283 additions and 61 deletions

View File

@@ -374,7 +374,7 @@ std::string Map::getStyleJSON() const {
util::ptr<Sprite> Map::getSprite() {
const float pixelRatio = state.getPixelRatio();
const std::string &sprite_url = style->getSpriteURL();
if (!sprite || sprite->pixelRatio != pixelRatio) {
if (!sprite || !sprite->hasPixelRatio(pixelRatio)) {
sprite = Sprite::Create(sprite_url, pixelRatio, *env);
}