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

Unified Diff: include/utils/SkDeferredCanvas.h

Issue 14178002: Adding SkSurface support to SkDeferredCanvas (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « no previous file | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/SkDeferredCanvas.h
===================================================================
--- include/utils/SkDeferredCanvas.h (revision 8622)
+++ include/utils/SkDeferredCanvas.h (working copy)
@@ -12,6 +12,8 @@
#include "SkPixelRef.h"
class DeferredDevice;
+class SkImage;
+class SkSurface;
/** \class SkDeferredCanvas
Subclass of SkCanvas that encapsulates an SkPicture or SkGPipe for deferred
@@ -33,6 +35,12 @@
*/
explicit SkDeferredCanvas(SkDevice* device);
+ /** Construct a canvas with the specified surface to draw into.
+ This constructor must be used for newImageSnapshot to work.
+ @param surface Specifies a surface for the canvas to draw into.
+ */
+ explicit SkDeferredCanvas(SkSurface* surface);
+
virtual ~SkDeferredCanvas();
/**
@@ -93,6 +101,15 @@
bool hasPendingCommands() const;
/**
+ * Flushes pending draw commands, if any, and returns an image of the
+ * current state of the surface pixels up to this point. Subsequent
+ * changes to the surface (by drawing into its canvas) will not be
+ * reflected in this image. Will return NULL if the deferred canvas
+ * was not constructed from an SkSurface.
+ */
+ SkImage* newImageShapshot();
+
+ /**
* Specify the maximum number of bytes to be allocated for the purpose
* of recording draw commands to this canvas. The default limit, is
* 64MB.
« no previous file with comments | « no previous file | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698