summaryrefslogtreecommitdiff
path: root/platform/default
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-11-04 17:39:14 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-11-04 21:24:05 +0100
commitc90a55959980f9ef9678a45b9c9ded906d637b34 (patch)
tree7bf7a9041c269934b3bb25f2b84934f29d330d8b /platform/default
parenteed16cb1bb14c5de68e71ba7960cbe264cc08760 (diff)
downloadqtlocation-mapboxgl-c90a55959980f9ef9678a45b9c9ded906d637b34.tar.gz
[core] move framebuffer reading to gl::Context
Diffstat (limited to 'platform/default')
-rw-r--r--platform/default/offscreen_view.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/platform/default/offscreen_view.cpp b/platform/default/offscreen_view.cpp
index 613e00fc2b..574686ebc9 100644
--- a/platform/default/offscreen_view.cpp
+++ b/platform/default/offscreen_view.cpp
@@ -1,6 +1,5 @@
#include <mbgl/platform/default/offscreen_view.hpp>
#include <mbgl/gl/context.hpp>
-#include <mbgl/gl/gl.hpp>
#include <cstring>
#include <cassert>
@@ -25,19 +24,7 @@ void OffscreenView::bind() {
}
PremultipliedImage OffscreenView::readStillImage() {
- PremultipliedImage image { size };
- MBGL_CHECK_ERROR(glReadPixels(0, 0, size.width, size.height, GL_RGBA, GL_UNSIGNED_BYTE, image.data.get()));
-
- const auto stride = image.stride();
- auto tmp = std::make_unique<uint8_t[]>(stride);
- uint8_t* rgba = image.data.get();
- for (int i = 0, j = size.height - 1; i < j; i++, j--) {
- std::memcpy(tmp.get(), rgba + i * stride, stride);
- std::memcpy(rgba + i * stride, rgba + j * stride, stride);
- std::memcpy(rgba + j * stride, tmp.get(), stride);
- }
-
- return image;
+ return context.readFramebuffer<PremultipliedImage>(size);
}
} // namespace mbgl