| Index: src/image/SkImage.cpp
|
| diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
|
| index 07279501a38df3db1b7e4f5d48d771690f3729d3..5e7cb07226125d0277a2ed31c6b9b8c177e7c192 100644
|
| --- a/src/image/SkImage.cpp
|
| +++ b/src/image/SkImage.cpp
|
| @@ -36,17 +36,29 @@ SkImage::SkImage(int width, int height, uint32_t uniqueID)
|
| SkASSERT(height > 0);
|
| }
|
|
|
| -const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const {
|
| - SkImageInfo infoStorage;
|
| - size_t rowBytesStorage;
|
| - if (nullptr == info) {
|
| - info = &infoStorage;
|
| +bool SkImage::peekPixels(SkPixmap* pm) const {
|
| + SkPixmap tmp;
|
| + if (!pm) {
|
| + pm = &tmp;
|
| }
|
| - if (nullptr == rowBytes) {
|
| - rowBytes = &rowBytesStorage;
|
| + return as_IB(this)->onPeekPixels(pm);
|
| +}
|
| +
|
| +#ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS
|
| +const void* SkImage::peekPixels(SkImageInfo* info, size_t* rowBytes) const {
|
| + SkPixmap pm;
|
| + if (this->peekPixels(&pm)) {
|
| + if (info) {
|
| + *info = pm.info();
|
| + }
|
| + if (rowBytes) {
|
| + *rowBytes = pm.rowBytes();
|
| + }
|
| + return pm.addr();
|
| }
|
| - return as_IB(this)->onPeekPixels(info, rowBytes);
|
| + return nullptr;
|
| }
|
| +#endif
|
|
|
| bool SkImage::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
|
| int srcX, int srcY, CachingHint chint) const {
|
| @@ -241,19 +253,6 @@ bool SkImage_Base::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, siz
|
|
|
| ///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
| -bool SkImage::peekPixels(SkPixmap* pmap) const {
|
| - SkImageInfo info;
|
| - size_t rowBytes;
|
| - const void* pixels = this->peekPixels(&info, &rowBytes);
|
| - if (pixels) {
|
| - if (pmap) {
|
| - pmap->reset(info, pixels, rowBytes);
|
| - }
|
| - return true;
|
| - }
|
| - return false;
|
| -}
|
| -
|
| bool SkImage::readPixels(const SkPixmap& pmap, int srcX, int srcY, CachingHint chint) const {
|
| return this->readPixels(pmap.info(), pmap.writable_addr(), pmap.rowBytes(), srcX, srcY, chint);
|
| }
|
|
|