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. --- test/api/annotations.cpp | 8 ++++---- test/api/api_misuse.cpp | 2 +- test/api/repeated_render.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test/api') diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp index c4fea02079..ae9c804730 100644 --- a/test/api/annotations.cpp +++ b/test/api/annotations.cpp @@ -14,16 +14,16 @@ using namespace mbgl; -UnassociatedImage render(Map& map) { - std::promise promise; - map.renderStill([&](std::exception_ptr, UnassociatedImage&& image) { +PremultipliedImage render(Map& map) { + std::promise promise; + map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) { promise.set_value(std::move(image)); }); return std::move(promise.get_future().get()); } void checkRendering(Map& map, const char * name) { - UnassociatedImage actual = render(map); + PremultipliedImage actual = render(map); test::checkImage(std::string("test/fixtures/annotations/") + name + "/", actual, 0.0002, 0.1); } diff --git a/test/api/api_misuse.cpp b/test/api/api_misuse.cpp index 4d5fe11042..538f09a040 100644 --- a/test/api/api_misuse.cpp +++ b/test/api/api_misuse.cpp @@ -45,7 +45,7 @@ TEST(API, RenderWithoutStyle) { Map map(view, fileSource, MapMode::Still); std::promise promise; - map.renderStill([&promise](std::exception_ptr error, UnassociatedImage&&) { + map.renderStill([&promise](std::exception_ptr error, PremultipliedImage&&) { promise.set_value(error); }); diff --git a/test/api/repeated_render.cpp b/test/api/repeated_render.cpp index 79349c67e7..77e4569dbf 100644 --- a/test/api/repeated_render.cpp +++ b/test/api/repeated_render.cpp @@ -25,8 +25,8 @@ TEST(API, RepeatedRender) { { map.setStyleJSON(style, ""); - std::promise promise; - map.renderStill([&promise](std::exception_ptr, UnassociatedImage&& image) { + std::promise promise; + map.renderStill([&promise](std::exception_ptr, PremultipliedImage&& image) { promise.set_value(std::move(image)); }); auto result = std::move(promise.get_future().get()); @@ -37,8 +37,8 @@ TEST(API, RepeatedRender) { { map.setStyleJSON(style, "TEST_DATA/suite"); - std::promise promise; - map.renderStill([&promise](std::exception_ptr, UnassociatedImage&& image) { + std::promise promise; + map.renderStill([&promise](std::exception_ptr, PremultipliedImage&& image) { promise.set_value(std::move(image)); }); auto result = std::move(promise.get_future().get()); -- cgit v1.2.1