Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: src/image/SkImage_Raster.cpp

Issue 793723002: add readPixels to SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use better name on test Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkImage_Base.h ('k') | src/image/SkReadPixelsRec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Raster.cpp
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 9ae3d364269c1dcb678d90da6c277b6889b7b2bb..24b971ad8491be40a909106a70895a138598c2b0 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -57,7 +57,7 @@ public:
void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) const SK_OVERRIDE;
void onDrawRect(SkCanvas*, const SkRect*, const SkRect&, const SkPaint*) const SK_OVERRIDE;
SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const SK_OVERRIDE;
- bool onReadPixels(SkBitmap*, const SkIRect&) const SK_OVERRIDE;
+ bool onReadPixels(const SkImageInfo&, void*, size_t, int srcX, int srcY) const SK_OVERRIDE;
const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const SK_OVERRIDE;
bool getROPixels(SkBitmap*) const SK_OVERRIDE;
@@ -143,16 +143,9 @@ SkSurface* SkImage_Raster::onNewSurface(const SkImageInfo& info, const SkSurface
return SkSurface::NewRaster(info, &props);
}
-bool SkImage_Raster::onReadPixels(SkBitmap* dst, const SkIRect& subset) const {
- if (dst->pixelRef()) {
- return this->INHERITED::onReadPixels(dst, subset);
- } else {
- SkBitmap src;
- if (!fBitmap.extractSubset(&src, subset)) {
- return false;
- }
- return src.copyTo(dst, src.colorType());
- }
+bool SkImage_Raster::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
+ int srcX, int srcY) const {
+ return fBitmap.readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY);
}
const void* SkImage_Raster::onPeekPixels(SkImageInfo* infoPtr, size_t* rowBytesPtr) const {
« no previous file with comments | « src/image/SkImage_Base.h ('k') | src/image/SkReadPixelsRec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698