Chromium Code Reviews| Index: include/core/SkShader.h |
| diff --git a/include/core/SkShader.h b/include/core/SkShader.h |
| index b0a7fd9f8a1474c2872bf9851ca163551f7933d1..c99e0a808fb66127b9d2c267ff01c4565a4cd5fb 100644 |
| --- a/include/core/SkShader.h |
| +++ b/include/core/SkShader.h |
| @@ -119,10 +119,23 @@ public: |
| */ |
| virtual bool isOpaque() const { return false; } |
| + struct ContextRec { |
|
scroggo
2014/05/01 18:49:38
Could you add some comments?
reed1
2014/05/01 18:57:41
Done.
|
| + ContextRec() : fDevice(NULL), fPaint(NULL), fMatrix(NULL) {} |
| + ContextRec(const ContextRec& other) |
| + : fDevice(other.fDevice), fPaint(other.fPaint), fMatrix(other.fMatrix) {} |
| + ContextRec(const SkBitmap& device, const SkPaint& paint, const SkMatrix& matrix) |
| + : fDevice(&device) |
| + , fPaint(&paint) |
| + , fMatrix(&matrix) {} |
| + |
| + const SkBitmap* fDevice; |
| + const SkPaint* fPaint; |
| + const SkMatrix* fMatrix; |
| + }; |
| + |
| class Context : public ::SkNoncopyable { |
| public: |
| - Context(const SkShader& shader, const SkBitmap& device, |
| - const SkPaint& paint, const SkMatrix& matrix); |
| + Context(const SkShader& shader, const ContextRec&); |
| virtual ~Context(); |
| @@ -200,8 +213,7 @@ public: |
| * Subclasses should be sure to call their INHERITED::validContext() if |
| * they override this method. |
| */ |
| - virtual bool validContext(const SkBitmap& device, const SkPaint& paint, |
| - const SkMatrix& matrix, SkMatrix* totalInverse = NULL) const; |
| + virtual bool validContext(const ContextRec&, SkMatrix* totalInverse = NULL) const; |
| /** |
| * Create the actual object that does the shading. |
| @@ -211,10 +223,7 @@ public: |
| * |
| * Base class implementation returns NULL. |
| */ |
| - virtual Context* createContext(const SkBitmap& device, |
| - const SkPaint& paint, |
| - const SkMatrix& matrix, |
| - void* storage) const; |
| + virtual Context* createContext(const ContextRec&, void* storage) const; |
| /** |
| * Return the size of a Context returned by createContext. |