-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use correct pixel ratio when creating image buffer from map.addImage() (
#4645) For images added using Mp.addImage - default to using pixel ratio : 1. When providing an Image HTMLElement, the pixel ratio can be adjusted by setting the img element's height and width accordingly. When providing an ArrayBuffer, we need to know the pixel ratio explicitly as already defined by the API.
- Loading branch information
Asheem Mamoowala
authored
Apr 27, 2017
1 parent
495a695
commit 9ddd3cc
Showing
11 changed files
with
135 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.17 KB
...egration/render-tests/runtime-styling/image-add-1x-image-1x-screen/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
[ | ||
"addImage", | ||
"marker", | ||
"./image/marker.png" | ||
"./sprites/1x.png" | ||
], | ||
[ | ||
"addLayer", | ||
|
Binary file added
BIN
+4.6 KB
...egration/render-tests/runtime-styling/image-add-1x-image-2x-screen/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
test/integration/render-tests/runtime-styling/image-add-1x-image-2x-screen/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"height": 64, | ||
"pixelRatio": 2, | ||
"operations": [ | ||
[ | ||
"addImage", | ||
"marker", | ||
"./sprites/1x.png" | ||
], | ||
[ | ||
"addLayer", | ||
{ | ||
"id": "geometry", | ||
"type": "symbol", | ||
"source": "geometry", | ||
"layout": { | ||
"icon-image": "marker" | ||
} | ||
} | ||
], | ||
[ | ||
"wait" | ||
] | ||
] | ||
} | ||
}, | ||
"sources": { | ||
"geometry": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Point", | ||
"coordinates": [0, 0] | ||
} | ||
} | ||
}, | ||
"layers": [] | ||
} |
Binary file added
BIN
+1.39 KB
...egration/render-tests/runtime-styling/image-add-2x-image-1x-screen/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions
42
test/integration/render-tests/runtime-styling/image-add-2x-image-1x-screen/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"height": 64, | ||
"pixelRatio": 1, | ||
"operations": [ | ||
[ | ||
"addImage", | ||
"marker", | ||
"./sprites/2x.png", | ||
2 | ||
], | ||
[ | ||
"addLayer", | ||
{ | ||
"id": "geometry", | ||
"type": "symbol", | ||
"source": "geometry", | ||
"layout": { | ||
"icon-image": "marker" | ||
} | ||
} | ||
], | ||
[ | ||
"wait" | ||
] | ||
] | ||
} | ||
}, | ||
"sources": { | ||
"geometry": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Point", | ||
"coordinates": [0, 0] | ||
} | ||
} | ||
}, | ||
"layers": [] | ||
} |
Binary file added
BIN
+2.54 KB
...egration/render-tests/runtime-styling/image-add-2x-image-2x-screen/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions
42
test/integration/render-tests/runtime-styling/image-add-2x-image-2x-screen/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"height": 64, | ||
"pixelRatio" :2, | ||
"operations": [ | ||
[ | ||
"addImage", | ||
"marker", | ||
"./sprites/2x.png", | ||
2 | ||
], | ||
[ | ||
"addLayer", | ||
{ | ||
"id": "geometry", | ||
"type": "symbol", | ||
"source": "geometry", | ||
"layout": { | ||
"icon-image": "marker" | ||
} | ||
} | ||
], | ||
[ | ||
"wait" | ||
] | ||
] | ||
} | ||
}, | ||
"sources": { | ||
"geometry": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Point", | ||
"coordinates": [0, 0] | ||
} | ||
} | ||
}, | ||
"layers": [] | ||
} |
Binary file removed
BIN
-871 Bytes
test/integration/render-tests/runtime-styling/image-add/expected.png
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters