summaryrefslogtreecommitdiff
path: root/libs/hwui/VectorDrawable.h
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2016-05-26 15:19:15 -0700
committerDoris Liu <tianliu@google.com>2016-05-26 16:06:58 -0700
commit335d7d174464ea3fc2d058dcff6e436df1cf0fd9 (patch)
tree7fff98258ae55ed73221533525fe27beee6a914d /libs/hwui/VectorDrawable.h
parent67ce99b66ebc816ae8bbc222db8f3695fb15495b (diff)
Copy native tree's property when mutate vector drawable
When mutating vector drawables, we need to not only copy over the VD tree structure, but also the properties of the VD tree, such as alpha. Bug: 28974071 Change-Id: If793f5f2b6e116472a1c6da0fb60d8278a78b03f
Diffstat (limited to 'libs/hwui/VectorDrawable.h')
-rw-r--r--libs/hwui/VectorDrawable.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/hwui/VectorDrawable.h b/libs/hwui/VectorDrawable.h
index 1a1f49f04cb9..940b1ca84dc1 100644
--- a/libs/hwui/VectorDrawable.h
+++ b/libs/hwui/VectorDrawable.h
@@ -549,6 +549,12 @@ public:
Tree(Group* rootNode) : mRootNode(rootNode) {
mRootNode->setPropertyChangedListener(&mPropertyChangedListener);
}
+
+ // Copy properties from the tree and use the give node as the root node
+ Tree(const Tree* copy, Group* rootNode) : Tree(rootNode) {
+ mStagingProperties.syncAnimatableProperties(*copy->stagingProperties());
+ mStagingProperties.syncNonAnimatableProperties(*copy->stagingProperties());
+ }
// Draws the VD onto a bitmap cache, then the bitmap cache will be rendered onto the input
// canvas. Returns the number of pixels needed for the bitmap cache.
int draw(Canvas* outCanvas, SkColorFilter* colorFilter,
@@ -673,7 +679,7 @@ public:
};
void onPropertyChanged(TreeProperties* prop);
TreeProperties* mutateStagingProperties() { return &mStagingProperties; }
- const TreeProperties* stagingProperties() { return &mStagingProperties; }
+ const TreeProperties* stagingProperties() const { return &mStagingProperties; }
// This should only be called from animations on RT
TreeProperties* mutateProperties() { return &mProperties; }