fix one part of #2024

This commit is contained in:
Dane Springmeyer 2013-09-26 19:29:05 -07:00
parent 68ff3ceead
commit 3531276864
2 changed files with 5 additions and 8 deletions

View file

@ -89,11 +89,10 @@ public:
return data_.getRow(row + y_) + x_; return data_.getRow(row + y_) + x_;
} }
inline char const* getBytes() const inline const unsigned char* getBytes() const
{ {
return reinterpret_cast<char const*>(&data_); return data_.getBytes();
} }
inline T& data() inline T& data()
{ {
return data_; return data_;

View file

@ -116,17 +116,15 @@ void save_as_webp(T1& file,
if (alpha) if (alpha)
{ {
int stride = sizeof(typename T2::pixel_type) * image.width(); int stride = sizeof(typename T2::pixel_type) * image.width();
uint8_t const* bytes = reinterpret_cast<uint8_t const*>(image.getBytes()); ok = WebPPictureImportRGBA(&pic, image.getBytes(), stride);
ok = WebPPictureImportRGBA(&pic, bytes, stride);
} }
else else
{ {
int stride = sizeof(typename T2::pixel_type) * image.width(); int stride = sizeof(typename T2::pixel_type) * image.width();
uint8_t const* bytes = reinterpret_cast<uint8_t const*>(image.getBytes());
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1 #if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
ok = WebPPictureImportRGBX(&pic, bytes, stride); ok = WebPPictureImportRGBX(&pic, image.getBytes(), stride);
#else #else
ok = WebPPictureImportRGBA(&pic, bytes, stride); ok = WebPPictureImportRGBA(&pic, image.getBytes(), stride);
#endif #endif
} }