summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-11-24 10:07:18 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-11-25 15:57:36 -0800
commit0c1e378bc9555f6cf826bb38b1a36fa742f8ce9b (patch)
tree9aec8e4f475ff715645072503b3e0ec78f0573af /bin
parent2de0a351a0635192bd05116cebdf0103c2638d05 (diff)
downloadqtlocation-mapboxgl-0c1e378bc9555f6cf826bb38b1a36fa742f8ce9b.tar.gz
[core] Rewrite image handling
* Consolidate Image and StillImage * Typecheck unassociated vs premultiplied images * Rewrite default platform image decoding implementation
Diffstat (limited to 'bin')
-rw-r--r--bin/render.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/bin/render.cpp b/bin/render.cpp
index 685f3ddac4..8a8bcc1a4b 100644
--- a/bin/render.cpp
+++ b/bin/render.cpp
@@ -1,5 +1,4 @@
#include <mbgl/map/map.hpp>
-#include <mbgl/map/still_image.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
@@ -105,16 +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<const StillImage> image(reinterpret_cast<const StillImage *>(as->data));
+ std::unique_ptr<UnassociatedImage> image(reinterpret_cast<UnassociatedImage*>(as->data));
uv_close(reinterpret_cast<uv_handle_t *>(as), [](uv_handle_t *handle) {
delete reinterpret_cast<uv_async_t *>(handle);
});
-
- const std::string png = util::compress_png(image->width, image->height, image->pixels.get());
- util::write_file(output, png);
+ util::write_file(output, encodePNG(*image));
});
- map.renderStill([async](std::exception_ptr error, std::unique_ptr<const StillImage> image) {
+ map.renderStill([async](std::exception_ptr error, UnassociatedImage&& image) {
try {
if (error) {
std::rethrow_exception(error);
@@ -124,7 +121,7 @@ int main(int argc, char *argv[]) {
exit(1);
}
- async->data = const_cast<StillImage *>(image.release());
+ async->data = new UnassociatedImage(std::move(image));
uv_async_send(async);
});