From bd1f71cdbd4aa55ffa1beb61ddee1dd6da32412d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Thu, 7 Jan 2016 16:21:45 +0100 Subject: [core] use stale sprite data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a naïve implementation that essentially merges updated data into existing data. It will *not* remove icons from the stale sprite if they aren't present in the fresh sprite (we aren't tracking the source of a sprite, and the user could have changed it as well). Similarly, it will not update icons that have changed in dimension. This is a rare edge case and probably not worth implementing. --- test/fixtures/stale/sprite.json | 10 ++++++++ test/fixtures/stale/sprite.png | Bin 0 -> 3351 bytes .../stale/stale_style_and_sprite/expected.png | Bin 0 -> 26859 bytes test/fixtures/stale/style_and_sprite.json | 26 +++++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 test/fixtures/stale/sprite.json create mode 100644 test/fixtures/stale/sprite.png create mode 100644 test/fixtures/stale/stale_style_and_sprite/expected.png create mode 100644 test/fixtures/stale/style_and_sprite.json (limited to 'test/fixtures') diff --git a/test/fixtures/stale/sprite.json b/test/fixtures/stale/sprite.json new file mode 100644 index 0000000000..e640365519 --- /dev/null +++ b/test/fixtures/stale/sprite.json @@ -0,0 +1,10 @@ +{ + "noise": { + "x": 0, + "y": 0, + "width": 32, + "height": 32, + "pixelRatio": 1, + "sdf": false + } +} diff --git a/test/fixtures/stale/sprite.png b/test/fixtures/stale/sprite.png new file mode 100644 index 0000000000..a02d8eb542 Binary files /dev/null and b/test/fixtures/stale/sprite.png differ diff --git a/test/fixtures/stale/stale_style_and_sprite/expected.png b/test/fixtures/stale/stale_style_and_sprite/expected.png new file mode 100644 index 0000000000..171599bf5c Binary files /dev/null and b/test/fixtures/stale/stale_style_and_sprite/expected.png differ diff --git a/test/fixtures/stale/style_and_sprite.json b/test/fixtures/stale/style_and_sprite.json new file mode 100644 index 0000000000..61e3214a5e --- /dev/null +++ b/test/fixtures/stale/style_and_sprite.json @@ -0,0 +1,26 @@ +{ + "version": 8, + "name": "Water", + "sources": { + "mapbox": { + "type": "vector", + "url": "asset://test/fixtures/stale/streets.json" + } + }, + "sprite": "http://127.0.0.1:3000/stale/sprite", + "layers": [{ + "id": "background", + "type": "background", + "paint": { + "background-color": "red" + } + }, { + "id": "water", + "type": "fill", + "source": "mapbox", + "source-layer": "water", + "paint": { + "fill-pattern": "noise" + } + }] +} -- cgit v1.2.1