summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2014-12-01 16:36:11 -0500
committerMike Morris <michael.patrick.morris@gmail.com>2014-12-01 16:36:11 -0500
commit0fd7f26533b56703137567c9843683c5e8ddfade (patch)
tree24a6761cd900ad6996e7471a907db86e6d42a703 /platform
parentc732f5c7123c574d6b4a94350953bc518266be7e (diff)
downloadqtlocation-mapboxgl-0fd7f26533b56703137567c9843683c5e8ddfade.tar.gz
move pixel flip from headless test into HeadlessView::readPixels
Diffstat (limited to 'platform')
-rw-r--r--platform/default/headless_view.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp
index 1f5a0ec987..59bf7f49ae 100644
--- a/platform/default/headless_view.cpp
+++ b/platform/default/headless_view.cpp
@@ -237,6 +237,15 @@ std::unique_ptr<uint32_t[]> HeadlessView::readPixels() {
glReadPixels(0, 0, width_, height_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
make_inactive();
+ const int stride = w * 4;
+ auto tmp = std::unique_ptr<char[]>(new char[stride]());
+ char *rgba = reinterpret_cast<char *>(pixels.get());
+ for (int i = 0, j = height_ - 1; i < j; i++, j--) {
+ memcpy(tmp.get(), rgba + i * stride, stride);
+ memcpy(rgba + i * stride, rgba + j * stride, stride);
+ memcpy(rgba + j * stride, tmp.get(), stride);
+ }
+
return pixels;
}