aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkDevice.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-07 03:25:16 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-07 03:25:16 +0000
commit4cd9e2169e35cd67ee7358acea6541245e1d1744 (patch)
tree6e78d84ef91181b41f5c45a73bab003c63780f10 /include/core/SkDevice.h
parenta5572e5bb2a2bbeeb59de0741c2527869d365a0c (diff)
Add SkCanvas::writePixels that takes info+pixels directly
add corresponding methods to device (w/ diff name to avoid colliding with exising virtuals) BUG=skia: R=bsalomon@google.com, robertphillips@google.com, junov@google.com, junov@chromium.org Author: reed@google.com Review URL: https://codereview.chromium.org/180113010 git-svn-id: http://skia.googlecode.com/svn/trunk@13697 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkDevice.h')
-rw-r--r--include/core/SkDevice.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 899c5d3754..b78dfbff90 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -116,6 +116,7 @@ public:
*/
const SkBitmap& accessBitmap(bool changePixels);
+#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG
/**
* DEPRECATED: This will be made protected once WebKit stops using it.
* Instead use Canvas' writePixels method.
@@ -132,7 +133,10 @@ public:
* not kARGB_8888_Config then this parameter is ignored.
*/
virtual void writePixels(const SkBitmap& bitmap, int x, int y,
- SkCanvas::Config8888 config8888 = SkCanvas::kNative_Premul_Config8888) = 0;
+ SkCanvas::Config8888 config8888 = SkCanvas::kNative_Premul_Config8888);
+#endif
+
+ bool writePixelsDirect(const SkImageInfo&, const void*, size_t rowBytes, int x, int y);
/**
* Return the device's associated gpu render target, or NULL.
@@ -388,6 +392,14 @@ protected:
virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes);
/**
+ * The caller is responsible for "pre-clipping" the src. The impl can assume that the src
+ * image at the specified x,y offset will fit within the device's bounds.
+ *
+ * This is explicitly asserted in writePixelsDirect(), the public way to call this.
+ */
+ virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, int y);
+
+ /**
* Leaky properties are those which the device should be applying but it isn't.
* These properties will be applied by the draw, when and as it can.
* If the device does handle a property, that property should be set to the identity value