summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-11-25 13:49:12 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-11-25 15:57:37 -0800
commit1d33790dc06a1127e55753d123d55e6ec6e89713 (patch)
tree3db9915f722dada6375a273297647cc1b0c9df51 /bin
parented5eb9edc1458692bf6ff71d5ec95a7d3400318f (diff)
downloadqtlocation-mapboxgl-1d33790dc06a1127e55753d123d55e6ec6e89713.tar.gz
[core] Fix image type of Map::renderStill
It's a premultiplied image. This implies that we were misusing encodePNG in most cases, as we were passing premultiplied pixels which were then interpreted as unmultiplied. I changed encodePNG to accept premultipled pixels, and unpremultiply in the implementations.
Diffstat (limited to 'bin')
-rw-r--r--bin/render.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/render.cpp b/bin/render.cpp
index 8a8bcc1a4b..ceb95c165c 100644
--- a/bin/render.cpp
+++ b/bin/render.cpp
@@ -104,14 +104,14 @@ int main(int argc, char *argv[]) {
uv_async_t *async = new uv_async_t;
uv_async_init(uv_default_loop(), async, [](UV_ASYNC_PARAMS(as)) {
- std::unique_ptr<UnassociatedImage> image(reinterpret_cast<UnassociatedImage*>(as->data));
+ std::unique_ptr<PremultipliedImage> image(reinterpret_cast<PremultipliedImage*>(as->data));
uv_close(reinterpret_cast<uv_handle_t *>(as), [](uv_handle_t *handle) {
delete reinterpret_cast<uv_async_t *>(handle);
});
util::write_file(output, encodePNG(*image));
});
- map.renderStill([async](std::exception_ptr error, UnassociatedImage&& image) {
+ map.renderStill([async](std::exception_ptr error, PremultipliedImage&& image) {
try {
if (error) {
std::rethrow_exception(error);
@@ -121,7 +121,7 @@ int main(int argc, char *argv[]) {
exit(1);
}
- async->data = new UnassociatedImage(std::move(image));
+ async->data = new PremultipliedImage(std::move(image));
uv_async_send(async);
});