From 1d33790dc06a1127e55753d123d55e6ec6e89713 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 25 Nov 2015 13:49:12 -0800 Subject: [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. --- bin/render.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin') 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 image(reinterpret_cast(as->data)); + std::unique_ptr image(reinterpret_cast(as->data)); uv_close(reinterpret_cast(as), [](uv_handle_t *handle) { delete reinterpret_cast(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); }); -- cgit v1.2.1