diff options
author | Doris Liu <tianliu@google.com> | 2016-04-15 17:47:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-04-15 17:47:25 +0000 |
commit | da62de4f65ccffc4734299f82f1c9ce4836e1c58 (patch) | |
tree | a17eed23bda173ff08e27cf4c48ba6c350ccb4ad /libs/hwui/VectorDrawable.h | |
parent | 6f8476dc155805f121f8236e0c81e9aa7d3cd40d (diff) | |
parent | ad21fe27627c8f4a1de886a2d1c5296694dc3501 (diff) |
Merge "Fix ref count of fillGradient and strokeGradient" into nyc-dev
Diffstat (limited to 'libs/hwui/VectorDrawable.h')
-rw-r--r-- | libs/hwui/VectorDrawable.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libs/hwui/VectorDrawable.h b/libs/hwui/VectorDrawable.h index 691cfa01a498..1c6f48e7276b 100644 --- a/libs/hwui/VectorDrawable.h +++ b/libs/hwui/VectorDrawable.h @@ -219,22 +219,24 @@ public: int fillType = 0; /* non-zero or kWinding_FillType in Skia */ }; FullPathProperties(Node* mNode) : Properties(mNode), mTrimDirty(false) {} + ~FullPathProperties() { + SkSafeUnref(fillGradient); + SkSafeUnref(strokeGradient); + } void syncProperties(const FullPathProperties& prop) { mPrimitiveFields = prop.mPrimitiveFields; mTrimDirty = true; - fillGradient.reset(prop.fillGradient); - strokeGradient.reset(prop.strokeGradient); + UPDATE_SKPROP(fillGradient, prop.fillGradient); + UPDATE_SKPROP(strokeGradient, prop.strokeGradient); onPropertyChanged(); } void setFillGradient(SkShader* gradient) { - if(fillGradient != gradient){ - fillGradient.reset(gradient); + if(UPDATE_SKPROP(fillGradient, gradient)) { onPropertyChanged(); } } void setStrokeGradient(SkShader* gradient) { - if(strokeGradient != gradient){ - strokeGradient.reset(gradient); + if(UPDATE_SKPROP(strokeGradient, gradient)) { onPropertyChanged(); } } @@ -346,8 +348,8 @@ public: count, }; PrimitiveFields mPrimitiveFields; - SkAutoTUnref<SkShader> fillGradient; - SkAutoTUnref<SkShader> strokeGradient; + SkShader* fillGradient = nullptr; + SkShader* strokeGradient = nullptr; }; // Called from UI thread |