diff options
author | 2014-12-09 14:39:44 -0800 | |
---|---|---|
committer | 2014-12-09 14:39:44 -0800 | |
commit | 7543aa2b365abfc968bd84ee32247ac51f904608 (patch) | |
tree | 0abead02f9642650200c32fb136f74ce12df962e /src/image | |
parent | 9a0c7abfd7ce8694136840fa224e99579b8329f6 (diff) |
add readPixels to SkSurface (later try to remove it from SkCanvas)
BUG=skia:
TBR=bsalomon, robertphilips
Review URL: https://codereview.chromium.org/789993002
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkSurface.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index 3ca5747252..13b7d65546 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -170,6 +170,20 @@ const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { return this->getCanvas()->peekPixels(info, rowBytes); } +bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, + int srcX, int srcY) { + return this->getCanvas()->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY); +} + +bool SkSurface::readPixels(SkBitmap* dst, const SkIRect* srcRect) { + SkIRect storage; + if (NULL == srcRect) { + storage.set(0, 0, this->width(), this->height()); + srcRect = &storage; + } + return this->getCanvas()->readPixels(*srcRect, dst); +} + ////////////////////////////////////////////////////////////////////////////////////// #ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE |