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

Unified Diff: src/image/SkSurface.cpp

Issue 1784563002: unify peekPixels around pixmap parameter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update GrUploadPixmapToTexture to know about the new desc if readPixels was called Created 4 years, 9 months 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_Raster.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface.cpp
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index b018ef9756b96fccd584a7590cf505553cd107f3..9bec562df90a90a590062eb59a28ae0fabe7445e 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -182,9 +182,25 @@ void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y,
return asSB(this)->onDraw(canvas, x, y, paint);
}
+bool SkSurface::peekPixels(SkPixmap* pmap) {
+ return this->getCanvas()->peekPixels(pmap);
+}
+
+#ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS
const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) {
- return this->getCanvas()->peekPixels(info, rowBytes);
+ SkPixmap pm;
+ if (this->peekPixels(&pm)) {
+ if (info) {
+ *info = pm.info();
+ }
+ if (rowBytes) {
+ *rowBytes = pm.rowBytes();
+ }
+ return pm.addr();
+ }
+ return nullptr;
}
+#endif
bool SkSurface::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY) {
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698