diff --git a/include/mapnik/image_view.hpp b/include/mapnik/image_view.hpp index b7bf54985..0f0e1be9e 100644 --- a/include/mapnik/image_view.hpp +++ b/include/mapnik/image_view.hpp @@ -89,11 +89,10 @@ public: return data_.getRow(row + y_) + x_; } - inline char const* getBytes() const + inline const unsigned char* getBytes() const { - return reinterpret_cast(&data_); + return data_.getBytes(); } - inline T& data() { return data_; diff --git a/include/mapnik/webp_io.hpp b/include/mapnik/webp_io.hpp index a697b39c9..3e0043770 100644 --- a/include/mapnik/webp_io.hpp +++ b/include/mapnik/webp_io.hpp @@ -116,17 +116,15 @@ void save_as_webp(T1& file, if (alpha) { int stride = sizeof(typename T2::pixel_type) * image.width(); - uint8_t const* bytes = reinterpret_cast(image.getBytes()); - ok = WebPPictureImportRGBA(&pic, bytes, stride); + ok = WebPPictureImportRGBA(&pic, image.getBytes(), stride); } else { int stride = sizeof(typename T2::pixel_type) * image.width(); - uint8_t const* bytes = reinterpret_cast(image.getBytes()); #if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1 - ok = WebPPictureImportRGBX(&pic, bytes, stride); + ok = WebPPictureImportRGBX(&pic, image.getBytes(), stride); #else - ok = WebPPictureImportRGBA(&pic, bytes, stride); + ok = WebPPictureImportRGBA(&pic, image.getBytes(), stride); #endif }