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

Unified Diff: include/core/SkDevice.h

Issue 199413013: add new readPixels with direct memory parameters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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
Index: include/core/SkDevice.h
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 7bb257935ab5e4e09b465e9f78c5e3f5773d729d..abd0a636fffda6b9b8afe6193b9723450c8f3706 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -287,6 +287,7 @@ protected:
virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
const SkPaint&) = 0;
+#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
/**
* On success (returns true), copy the device pixels into the bitmap.
* On failure, the bitmap parameter is left unchanged and false is
@@ -317,6 +318,8 @@ protected:
bool readPixels(SkBitmap* bitmap,
int x, int y,
SkCanvas::Config8888 config8888);
+#endif
+ bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y);
///////////////////////////////////////////////////////////////////////////
@@ -378,9 +381,17 @@ protected:
* 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
* contained in the device bounds.
*/
- virtual bool onReadPixels(const SkBitmap& bitmap,
- int x, int y,
- SkCanvas::Config8888 config8888);
+#ifdef SK_SUPPORT_LEGACY_READPIXELSCONFIG
+ virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y, SkCanvas::Config8888);
+#endif
+
+ /**
+ * The caller is responsible for "pre-clipping" the dst. The impl can assume that the dst
+ * image at the specified x,y offset will fit within the device's bounds.
+ *
+ * This is explicitly asserted in readPixels(), the public way to call this.
+ */
+ virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int x, int y);
/**
* The caller is responsible for "pre-clipping" the src. The impl can assume that the src

Powered by Google App Engine
This is Rietveld 408576698