aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkShader.h
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-13 21:53:41 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-13 21:53:41 +0000
commit135e16cd8ebb2ba30458b284d4a17e1eea81ad35 (patch)
tree1738da6c7015a4828d782ba31cbf170587a01643 /include/core/SkShader.h
parent2a3f08b0a71d044ba48694ed04b3dc1ce846e9d9 (diff)
revert 6798 (assert in GM)
git-svn-id: http://skia.googlecode.com/svn/trunk@6802 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkShader.h')
-rw-r--r--include/core/SkShader.h29
1 files changed, 10 insertions, 19 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 7edbe6fd4b..1286177271 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -139,29 +139,12 @@ public:
/**
* Called once before drawing, with the current paint and device matrix.
* Return true if your shader supports these parameters, or false if not.
- * If false is returned, nothing will be drawn. If true is returned, then
- * a balancing call to endContext() will be made before the next call to
- * setContext.
- *
- * Subclasses should be sure to call their INHERITED::setContext() if they
- * override this method.
+ * If false is returned, nothing will be drawn.
*/
virtual bool setContext(const SkBitmap& device, const SkPaint& paint,
const SkMatrix& matrix);
/**
- * Assuming setContext returned true, endContext() will be called when
- * the draw using the shader has completed. It is an error for setContext
- * to be called twice w/o an intervening call to endContext().
- *
- * Subclasses should be sure to call their INHERITED::endContext() if they
- * override this method.
- */
- virtual void endContext();
-
- SkDEBUGCODE(bool setContextHasBeenCalled() const { return fInSetContext; })
-
- /**
* Called for each span of the object being drawn. Your subclass should
* set the appropriate colors (with premultiplied alpha) that correspond
* to the specified device coordinates.
@@ -200,6 +183,14 @@ public:
}
/**
+ * Called before a session using the shader begins. Some shaders override
+ * this to defer some of their work (like calling bitmap.lockPixels()).
+ * Must be balanced by a call to endSession.
+ */
+ virtual void beginSession();
+ virtual void endSession();
+
+ /**
Gives method bitmap should be read to implement a shader.
Also determines number and interpretation of "extra" parameters returned
by asABitmap
@@ -364,7 +355,7 @@ private:
uint8_t fPaintAlpha;
uint8_t fDeviceConfig;
uint8_t fTotalInverseClass;
- SkDEBUGCODE(SkBool8 fInSetContext;)
+ SkDEBUGCODE(SkBool8 fInSession;)
static SkShader* CreateBitmapShader(const SkBitmap& src,
TileMode, TileMode,