From 46fe0df2a2a2b4c28d8579245c0caad258a8b512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 25 Jan 2017 16:09:11 +0100 Subject: [core] add clone() call to Image objects --- platform/default/png_writer.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'platform/default/png_writer.cpp') 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' }; -- cgit v1.2.1