diff --git a/flow-typed/shelf-pack.js b/flow-typed/shelf-pack.js index 42c391562f1..49d092b26f3 100644 --- a/flow-typed/shelf-pack.js +++ b/flow-typed/shelf-pack.js @@ -15,6 +15,7 @@ declare module "@mapbox/shelf-pack" { pack(bins: Array<{w: number, h: number}>, options?: {inPlace: boolean}): Array; packOne(w: number, h: number, id?: number|string): Bin; + shrink(): void; ref(bin: Bin): number; unref(bin: Bin): number; diff --git a/package.json b/package.json index 191e4f36530..87f4af8ba40 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "@mapbox/gl-matrix": "^0.0.1", "@mapbox/point-geometry": "^0.1.0", - "@mapbox/shelf-pack": "^3.0.0", + "@mapbox/shelf-pack": "^3.1.0", "@mapbox/tiny-sdf": "^1.1.0", "@mapbox/unitbezier": "^0.0.0", "@mapbox/vector-tile": "^1.3.0", diff --git a/src/render/glyph_atlas.js b/src/render/glyph_atlas.js index b83c4a2221a..c7fd4a89250 100644 --- a/src/render/glyph_atlas.js +++ b/src/render/glyph_atlas.js @@ -61,11 +61,11 @@ function makeGlyphAtlas(stacks: {[string]: {[number]: ?StyleGlyph}}): GlyphAtlas } } - // pack.shrink(); - // resizeAlphaImage(image, { - // width: pack.w, - // height: pack.h - // }); + pack.shrink(); + AlphaImage.resize(image, { + width: pack.w, + height: pack.h + }); return {image, positions}; } diff --git a/src/render/image_atlas.js b/src/render/image_atlas.js index 5bbb9148e69..a51e46dc3b0 100644 --- a/src/render/image_atlas.js +++ b/src/render/image_atlas.js @@ -86,11 +86,11 @@ function makeImageAtlas(images: {[string]: StyleImage}): ImageAtlas { positions[id] = imagePosition(bin, src); } - // pack.shrink(); - // resizeImageData(image, { - // width: pack.w, - // height: pack.h - // }); + pack.shrink(); + RGBAImage.resize(image, { + width: pack.w, + height: pack.h + }); return {image, positions}; } diff --git a/src/render/texture.js b/src/render/texture.js index 54b8a2ccd0e..9b232356c4b 100644 --- a/src/render/texture.js +++ b/src/render/texture.js @@ -38,6 +38,7 @@ class Texture { const {gl} = this; gl.bindTexture(gl.TEXTURE_2D, this.texture); + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1); if (this.format === gl.RGBA) { gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, (true: any)); diff --git a/yarn.lock b/yarn.lock index e16615ec1ce..2cfb3b97345 100644 --- a/yarn.lock +++ b/yarn.lock @@ -26,9 +26,9 @@ version "0.1.0" resolved "https://registry.yarnpkg.com/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz#8a83f9335c7860effa2eeeca254332aa0aeed8f2" -"@mapbox/shelf-pack@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@mapbox/shelf-pack/-/shelf-pack-3.0.0.tgz#44e284c8336eeda1e9dbbb1d61954c70e26e5766" +"@mapbox/shelf-pack@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@mapbox/shelf-pack/-/shelf-pack-3.1.0.tgz#1edea9c0bf6715b217171ba60646c201af520f6a" "@mapbox/tiny-sdf@^1.1.0": version "1.1.0"