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. --- include/mbgl/map/map.hpp | 2 +- include/mbgl/map/view.hpp | 2 +- include/mbgl/platform/default/headless_view.hpp | 2 +- include/mbgl/util/image.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include/mbgl') diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 80b50c2fa4..35895660f2 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -58,7 +58,7 @@ public: // Register a callback that will get called (on the render thread) when all resources have // been loaded and a complete render occurs. - using StillImageCallback = std::function; + using StillImageCallback = std::function; void renderStill(StillImageCallback callback); // Triggers a synchronous render. diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp index 68bde5fe30..ecdd93377f 100644 --- a/include/mbgl/map/view.hpp +++ b/include/mbgl/map/view.hpp @@ -70,7 +70,7 @@ public: // Reads the pixel data from the current framebuffer. If your View implementation // doesn't support reading from the framebuffer, return a null pointer. - virtual UnassociatedImage readStillImage(); + virtual PremultipliedImage readStillImage(); // Notifies a watcher of map x/y/scale/rotation changes. // Must only be called from the same thread that caused the change. diff --git a/include/mbgl/platform/default/headless_view.hpp b/include/mbgl/platform/default/headless_view.hpp index 8b25620524..4b25b81bb9 100644 --- a/include/mbgl/platform/default/headless_view.hpp +++ b/include/mbgl/platform/default/headless_view.hpp @@ -39,7 +39,7 @@ public: void invalidate() override; void beforeRender() override; void afterRender() override; - UnassociatedImage readStillImage() override; + PremultipliedImage readStillImage() override; void resizeFramebuffer(); void resize(uint16_t width, uint16_t height); diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp index 0604691dd1..b8e018f696 100644 --- a/include/mbgl/util/image.hpp +++ b/include/mbgl/util/image.hpp @@ -34,7 +34,7 @@ using PremultipliedImage = Image; // TODO: don't use std::string for binary data. PremultipliedImage decodeImage(const std::string&); -std::string encodePNG(const UnassociatedImage&); +std::string encodePNG(const PremultipliedImage&); } -- cgit v1.2.1