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

Unified Diff: include/core/SkCanvas.h

Issue 159723006: add peekPixels to canvas (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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
Index: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 7235efb2f0a9cd3b23132541d9c695b0c81e1704..cc1bfca612277a00c5113798b9af1a00e2ae3d63 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -126,6 +126,18 @@ public:
///////////////////////////////////////////////////////////////////////////
/**
+ * If the canvas has direct access to its pixels (i.e. they are in local
+ * RAM) return the const-address of those pixels, and if not null, return
hal.canary 2014/02/12 15:11:02 And if the canvas has a concept of "pixels" at all
reed1 2014/02/12 17:24:10 Done.
+ * the ImageInfo and rowBytes. The returned address is only valid while
+ * the canvas object is in scope and unchanged. Any API calls made on the
+ * canvas can invalidate this address.
+ *
+ * On failure, returns NULL and the info and rowBytes parameters are
+ * ignored.
+ */
+ const void* peekPixels(SkImageInfo* info, size_t* rowBytes);
+
+ /**
* This enum can be used with read/writePixels to perform a pixel ops to or
* from an 8888 config other than Skia's native config (SkPMColor). There
* are three byte orders supported: native, BGRA, and RGBA. Each has a
@@ -1019,6 +1031,9 @@ protected:
// default impl defers to getDevice()->newSurface(info)
virtual SkSurface* onNewSurface(const SkImageInfo&);
+ // default impl defers to its device
+ virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes);
+
// Returns the canvas to be used by DrawIter. Default implementation
// returns this. Subclasses that encapsulate an indirect canvas may
// need to overload this method. The impl must keep track of this, as it

Powered by Google App Engine
This is Rietveld 408576698