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

Unified Diff: include/core/SkDevice.h

Issue 180113010: Add SkCanvas::writePixels that takes info+pixels directly (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
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkDevice.h
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 899c5d37540c5f6cf059229f8bbffcb8ec7aa384..b78dfbff90df347fa7afc790bd8dd6928ef08872 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
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698