summaryrefslogtreecommitdiff
path: root/src/util/image.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-07-07 20:30:46 -0700
committerKonstantin Käfer <mail@kkaefer.com>2014-07-07 20:31:42 -0700
commit49b0f098c237ff43b07e88130eaf47b94870fa23 (patch)
treebc7c2a6a51548068f2c783f899d4a82757d59cdc /src/util/image.cpp
parent501af4a3807474d6de288939266b1f866889bf60 (diff)
downloadqtlocation-mapboxgl-49b0f098c237ff43b07e88130eaf47b94870fa23.tar.gz
add test fixture and image comparison
Diffstat (limited to 'src/util/image.cpp')
-rw-r--r--src/util/image.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/image.cpp b/src/util/image.cpp
index 2d4eb36021..f29f3451b5 100644
--- a/src/util/image.cpp
+++ b/src/util/image.cpp
@@ -84,7 +84,7 @@ void warningHandler(png_structp, png_const_charp error_msg) {
fprintf(stderr, "PNG: %s\n", error_msg);
}
-Image::Image(const std::string &data) {
+Image::Image(const std::string &data, bool flip) {
Buffer buffer(data);
if (buffer.length < 8 || !png_check_sig((const png_bytep)buffer.data, 8)) {
@@ -148,7 +148,7 @@ Image::Image(const std::string &data) {
png_bytep *rows = nullptr;
} pointers(height);
for (unsigned i = 0; i < height; ++i) {
- pointers.rows[i] = (png_bytep)(surface + (i * rowbytes));
+ pointers.rows[flip ? height - 1 - i : i] = (png_bytep)(surface + (i * rowbytes));
}
// Read image data