summaryrefslogtreecommitdiff
path: root/platform/default/png_writer.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-01-25 16:09:11 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-01-26 15:26:55 +0100
commit46fe0df2a2a2b4c28d8579245c0caad258a8b512 (patch)
tree53eb17f6b31be7f738a86c02324ae38340c091af /platform/default/png_writer.cpp
parentbe43310b6ff5465e6717128b577f6e61c0335c44 (diff)
downloadqtlocation-mapboxgl-46fe0df2a2a2b4c28d8579245c0caad258a8b512.tar.gz
[core] add clone() call to Image objects
Diffstat (limited to 'platform/default/png_writer.cpp')
-rw-r--r--platform/default/png_writer.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/platform/default/png_writer.cpp b/platform/default/png_writer.cpp
index a620d8b986..13d60c34fe 100644
--- a/platform/default/png_writer.cpp
+++ b/platform/default/png_writer.cpp
@@ -39,12 +39,8 @@ namespace mbgl {
// Encode PNGs without libpng.
std::string encodePNG(const PremultipliedImage& pre) {
- const UnassociatedImage src = [&pre] {
- // Make copy of the image so that we can unpremultiply it.
- PremultipliedImage copy(pre.size);
- std::copy(pre.data.get(), pre.data.get() + pre.bytes(), copy.data.get());
- return util::unpremultiply(std::move(copy));
- }();
+ // Make copy of the image so that we can unpremultiply it.
+ const auto src = util::unpremultiply(pre.clone());
// PNG magic bytes
const char preamble[8] = { char(0x89), 'P', 'N', 'G', '\r', '\n', 0x1a, '\n' };