Index: src/effects/gradients/SkGradientShaderPriv.h |
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h |
index 1787e243886068cb31154d2ab21d7399a603c5c6..cf6c671d2a26cb4dc0f9641c986a0dee6e7dc880 100644 |
--- a/src/effects/gradients/SkGradientShaderPriv.h |
+++ b/src/effects/gradients/SkGradientShaderPriv.h |
@@ -95,6 +95,29 @@ public: |
int fCount; |
SkShader::TileMode fTileMode; |
uint32_t fGradFlags; |
+ |
+ void flatten(SkWriteBuffer&) const; |
+ }; |
+ |
+ class DescriptorScope : public Descriptor { |
+ public: |
+ DescriptorScope() {} |
+ |
+ bool unflatten(SkReadBuffer&); |
+ |
+ // fColors and fPos always point into local memory, so they can be safely mutated |
+ // |
+ SkColor* mutableColors() { return const_cast<SkColor*>(fColors); } |
+ SkScalar* mutablePos() { return const_cast<SkScalar*>(fPos); } |
+ |
+ private: |
+ enum { |
+ kStorageCount = 16 |
+ }; |
+ SkColor fColorStorage[kStorageCount]; |
+ SkScalar fPosStorage[kStorageCount]; |
+ SkMatrix fLocalMatrixStorage; |
+ SkAutoMalloc fDynamicStorage; |
}; |
public: |
@@ -234,10 +257,11 @@ private: |
enum { |
kColorStorageCount = 4, // more than this many colors, and we'll use sk_malloc for the space |
- kStorageSize = kColorStorageCount * (sizeof(SkColor) + sizeof(Rec)) |
+ kStorageSize = kColorStorageCount * (sizeof(SkColor) + sizeof(SkScalar) + sizeof(Rec)) |
}; |
SkColor fStorage[(kStorageSize + 3) >> 2]; |
SkColor* fOrigColors; // original colors, before modulation by paint in context. |
+ SkScalar* fOrigPos; // original positions |
bool fColorsAreOpaque; |
GradientShaderCache* refCache(U8CPU alpha) const; |