[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.
This commit is contained in:
@@ -14,16 +14,16 @@
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
UnassociatedImage render(Map& map) {
|
||||
std::promise<UnassociatedImage> promise;
|
||||
map.renderStill([&](std::exception_ptr, UnassociatedImage&& image) {
|
||||
PremultipliedImage render(Map& map) {
|
||||
std::promise<PremultipliedImage> 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user