summaryrefslogtreecommitdiff
path: root/platform/default/webp_reader.cpp
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2016-06-09 15:10:05 -0500
committerBrad Leege <bleege@gmail.com>2016-06-09 15:10:05 -0500
commit3972044308410bc5281e267b5247a3a0898c777a (patch)
tree95bdbee967eb783be701847fc07072868c9040c2 /platform/default/webp_reader.cpp
parentb90571107d6fa5dd970d77c0b67029de8cd3461a (diff)
parent40211abd9a6cb6a3b0eb8dbe61e1ccb605d19677 (diff)
downloadqtlocation-mapboxgl-3972044308410bc5281e267b5247a3a0898c777a.tar.gz
Merge branch 'master' of github.com:mapbox/mapbox-gl-native
Diffstat (limited to 'platform/default/webp_reader.cpp')
-rw-r--r--platform/default/webp_reader.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/default/webp_reader.cpp b/platform/default/webp_reader.cpp
index 37d23da110..5b0eaf4741 100644
--- a/platform/default/webp_reader.cpp
+++ b/platform/default/webp_reader.cpp
@@ -15,8 +15,11 @@ PremultipliedImage decodeWebP(const uint8_t* data, size_t size) {
throw std::runtime_error("failed to retrieve WebP basic header information");
}
- std::unique_ptr<uint8_t[]> webp(WebPDecodeRGBA(data, size, &width, &height));
- if (!webp) {
+ int stride = width * 4;
+ size_t webpSize = stride * height;
+ auto webp = std::make_unique<uint8_t[]>(webpSize);
+
+ if (!WebPDecodeRGBAInto(data, size, webp.get(), webpSize, stride)) {
throw std::runtime_error("failed to decode WebP data");
}