diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-04-16 14:31:48 -0400 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-04-16 14:31:48 -0400 |
commit | 6872ac1b49389057c29fe9327392ad15b2083096 (patch) | |
tree | 63b12f9f0b9ddcdd370b4225e8ae9557f51e6e79 /src/util/image.cpp | |
parent | 57c5a009073b18bca9823287979c4e22fc407ee5 (diff) | |
download | qtlocation-mapboxgl-6872ac1b49389057c29fe9327392ad15b2083096.tar.gz |
add flag to allow flipping the png image
Diffstat (limited to 'src/util/image.cpp')
-rw-r--r-- | src/util/image.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/image.cpp b/src/util/image.cpp index e7cb22697e..3a29a95a28 100644 --- a/src/util/image.cpp +++ b/src/util/image.cpp @@ -2,7 +2,7 @@ #include <png.h> -std::string llmr::util::compress_png(int width, int height, void *rgba) { +std::string llmr::util::compress_png(int width, int height, void *rgba, bool flip) { png_voidp error_ptr = 0; png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, error_ptr, NULL, NULL); if (!png_ptr) { @@ -39,7 +39,7 @@ std::string llmr::util::compress_png(int width, int height, void *rgba) { } pointers(height); for (int i = 0; i < height; i++) { - pointers.rows[i] = (png_bytep)((png_bytep)rgba + width * 4 * i); + pointers.rows[flip ? height - 1 - i : i] = (png_bytep)((png_bytep)rgba + width * 4 * i); } png_set_rows(png_ptr, info_ptr, pointers.rows); |