add readPixels to SkSurface (later try to remove it from SkCanvas)
BUG=skia:
TBR=bsalomon, robertphilips
Review URL: https://codereview.chromium.org/789993002
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index 3ca5747..13b7d65 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -170,6 +170,20 @@
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