diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-09-11 13:05:30 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-09-13 13:27:44 +0200 |
commit | 071129bf61dda7d23c6f305b0c42139bf20560cb (patch) | |
tree | 9315fb5421cf5a98a7a1a227a64f39e21e9e9e8e /platform/default | |
parent | 6367fcb2a82c52c7f80e82941621be603373a57b (diff) | |
download | qtlocation-mapboxgl-071129bf61dda7d23c6f305b0c42139bf20560cb.tar.gz |
[linux,qt] Remove remainder of WebP support
Diffstat (limited to 'platform/default')
-rw-r--r-- | platform/default/image.cpp | 14 | ||||
-rw-r--r-- | platform/default/webp_reader.cpp | 31 |
2 files changed, 0 insertions, 45 deletions
diff --git a/platform/default/image.cpp b/platform/default/image.cpp index 447c6bcd66..25063892b7 100644 --- a/platform/default/image.cpp +++ b/platform/default/image.cpp @@ -4,10 +4,6 @@ namespace mbgl { -#if !defined(__ANDROID__) && !defined(__APPLE__) -PremultipliedImage decodeWebP(const uint8_t*, size_t); -#endif // !defined(__ANDROID__) && !defined(__APPLE__) - PremultipliedImage decodePNG(const uint8_t*, size_t); PremultipliedImage decodeJPEG(const uint8_t*, size_t); @@ -15,16 +11,6 @@ PremultipliedImage decodeImage(const std::string& string) { const auto* data = reinterpret_cast<const uint8_t*>(string.data()); const size_t size = string.size(); -#if !defined(__ANDROID__) && !defined(__APPLE__) - if (size >= 12) { - uint32_t riff_magic = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; - uint32_t webp_magic = (data[8] << 24) | (data[9] << 16) | (data[10] << 8) | data[11]; - if (riff_magic == 0x52494646 && webp_magic == 0x57454250) { - return decodeWebP(data, size); - } - } -#endif // !defined(__ANDROID__) && !defined(__APPLE__) - if (size >= 4) { uint32_t magic = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; if (magic == 0x89504E47U) { diff --git a/platform/default/webp_reader.cpp b/platform/default/webp_reader.cpp deleted file mode 100644 index 2c01fb4479..0000000000 --- a/platform/default/webp_reader.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include <mbgl/util/image.hpp> -#include <mbgl/util/premultiply.hpp> -#include <mbgl/util/logging.hpp> - -extern "C" -{ -#include <webp/decode.h> -} - -namespace mbgl { - -PremultipliedImage decodeWebP(const uint8_t* data, size_t size) { - int width = 0, height = 0; - if (WebPGetInfo(data, size, &width, &height) == 0) { - throw std::runtime_error("failed to retrieve WebP basic header information"); - } - - 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"); - } - - UnassociatedImage image({ static_cast<uint32_t>(width), static_cast<uint32_t>(height) }, - std::move(webp)); - return util::premultiply(std::move(image)); -} - -} // namespace mbgl |