Revert WebP support due to broken builds
This reverts commits2010fbb0e6,a361ce47a1, andd004bb275a.
This commit is contained in:
1
configure
vendored
1
configure
vendored
@@ -105,7 +105,6 @@ print_flags variant static_libs cflags ldflags
|
||||
print_flags rapidjson static_libs cflags ldflags
|
||||
print_flags gtest static_libs cflags ldflags
|
||||
print_flags pixelmatch static_libs cflags ldflags
|
||||
print_flags webp static_libs cflags ldflags
|
||||
|
||||
CONFIG+=" }
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
'../platform/default/application_root.cpp',
|
||||
'../platform/default/thread.cpp',
|
||||
'../platform/default/image.cpp',
|
||||
'../platform/default/webp_reader.cpp',
|
||||
'../platform/default/png_reader.cpp',
|
||||
'../platform/default/jpeg_reader.cpp',
|
||||
'../platform/default/timer.cpp',
|
||||
@@ -36,7 +35,6 @@
|
||||
'<@(nunicode_cflags)',
|
||||
'<@(boost_cflags)',
|
||||
'<@(sqlite_cflags)',
|
||||
'<@(webp_cflags)',
|
||||
],
|
||||
'ldflags': [
|
||||
'<@(libpng_ldflags)',
|
||||
@@ -45,7 +43,6 @@
|
||||
'<@(nunicode_ldflags)',
|
||||
'<@(sqlite_ldflags)',
|
||||
'<@(zlib_ldflags)',
|
||||
'<@(webp_ldflags)',
|
||||
],
|
||||
'libraries': [
|
||||
'<@(libpng_static_libs)',
|
||||
@@ -54,7 +51,6 @@
|
||||
'<@(nunicode_static_libs)',
|
||||
'<@(sqlite_static_libs)',
|
||||
'<@(zlib_static_libs)',
|
||||
'<@(webp_static_libs)',
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
@@ -21,11 +21,6 @@ public:
|
||||
height(h),
|
||||
data(std::make_unique<uint8_t[]>(size())) {}
|
||||
|
||||
Image(size_t w, size_t h, std::unique_ptr<uint8_t[]> data_)
|
||||
: width(w),
|
||||
height(h),
|
||||
data(std::move(data_)) {}
|
||||
|
||||
size_t stride() const { return width * 4; }
|
||||
size_t size() const { return width * height * 4; }
|
||||
|
||||
|
||||
@@ -70,10 +70,6 @@ std::string encodePNG(const PremultipliedImage& pre) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#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);
|
||||
|
||||
@@ -81,26 +77,16 @@ PremultipliedImage decodeImage(const std::string& string) {
|
||||
const uint8_t* 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];
|
||||
unsigned int magic = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
|
||||
if (magic == 0x89504E47U) {
|
||||
return decodePNG(data, size);
|
||||
}
|
||||
}
|
||||
|
||||
if (size >= 2) {
|
||||
uint16_t magic = ((data[0] << 8) | data[1]) & 0xffff;
|
||||
if (magic == 0xFFD8) {
|
||||
unsigned int magic = ((data[0] << 8) | data[1]) & 0xffff;
|
||||
if (magic == 0xffd8) {
|
||||
return decodeJPEG(data, size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#include <mbgl/util/image.hpp>
|
||||
#include <mbgl/util/premultiply.hpp>
|
||||
#include <mbgl/platform/log.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");
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> webp(WebPDecodeRGBA(data, size, &width, &height));
|
||||
if (!webp) {
|
||||
throw std::runtime_error("failed to decode WebP data");
|
||||
}
|
||||
|
||||
UnassociatedImage image { size_t(width), size_t(height), std::move(webp) };
|
||||
return util::premultiply(std::move(image));
|
||||
}
|
||||
|
||||
} // namespace mbgl
|
||||
@@ -15,7 +15,6 @@ VARIANT_VERSION=1.0
|
||||
RAPIDJSON_VERSION=1.0.2
|
||||
GTEST_VERSION=1.7.0
|
||||
PIXELMATCH_VERSION=0.9.0
|
||||
WEBP_VERSION=0.5.0
|
||||
|
||||
function print_opengl_flags {
|
||||
CONFIG+=" 'opengl_cflags%': $(quote_flags $(pkg-config gl x11 --cflags)),"$LN
|
||||
|
||||
@@ -129,12 +129,6 @@ std::string normalizeRasterTileURL(const std::string& url) {
|
||||
}
|
||||
|
||||
std::string normalizedURL(url);
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__)
|
||||
// Replace PNG with WebP.
|
||||
if (normalizedURL.compare(extensionIdx + 1, 3, "png") == 0) {
|
||||
normalizedURL.replace(extensionIdx + 1, 3, "webp");
|
||||
}
|
||||
#endif // !defined(__ANDROID__) && !defined(__APPLE__)
|
||||
normalizedURL.insert(extensionIdx, "{ratio}");
|
||||
return normalizedURL;
|
||||
}
|
||||
|
||||
BIN
test/fixtures/image/tile.webp
vendored
BIN
test/fixtures/image/tile.webp
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 8.7 KiB |
@@ -78,14 +78,6 @@ TEST(Image, JPEGTile) {
|
||||
EXPECT_EQ(256, image.height);
|
||||
}
|
||||
|
||||
#if !defined(__ANDROID__) && !defined(__APPLE__)
|
||||
TEST(Image, WebPTile) {
|
||||
PremultipliedImage image = decodeImage(util::read_file("test/fixtures/image/tile.webp"));
|
||||
EXPECT_EQ(256, image.width);
|
||||
EXPECT_EQ(256, image.height);
|
||||
}
|
||||
#endif // !defined(__ANDROID__) && !defined(__APPLE__)
|
||||
|
||||
TEST(Image, Premultiply) {
|
||||
UnassociatedImage rgba { 1, 1 };
|
||||
rgba.data[0] = 255;
|
||||
|
||||
@@ -37,17 +37,10 @@ TEST(Mapbox, SpriteURL) {
|
||||
|
||||
TEST(Mapbox, TileURL) {
|
||||
try {
|
||||
#if defined(__ANDROID__) || defined(__APPLE__)
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.png", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png"));
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.png32", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png32"));
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.png70", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png70"));
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.png?access_token=foo", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png?access_token=foo"));
|
||||
#else
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.webp", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png"));
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.webp32", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png32"));
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.webp70", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png70"));
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.webp?access_token=foo", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png?access_token=foo"));
|
||||
#endif // defined(__ANDROID__) || defined(__APPLE__)
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.pbf", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.pbf"));
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.pbf?access_token=foo", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.pbf?access_token=foo"));
|
||||
EXPECT_EQ("http://path.png/tile{ratio}.pbf?access_token=foo.png", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.pbf?access_token=foo.png"));
|
||||
|
||||
Reference in New Issue
Block a user