Add RT-enabled reveal animator
Bug: 16161431
Also re-writes RevealAnimator to avoid using any listeners internally,
removing the logic around shadowing the update listeners.
Change-Id: I6ed8126398eed971a87f20bccb7584c9acafbb6c
diff --git a/libs/hwui/Animator.cpp b/libs/hwui/Animator.cpp
index d35dce9..24ed6cd 100644
--- a/libs/hwui/Animator.cpp
+++ b/libs/hwui/Animator.cpp
@@ -288,5 +288,23 @@
LOG_ALWAYS_FATAL("Unknown field %d", (int) mField);
}
+RevealAnimator::RevealAnimator(int centerX, int centerY, bool inverseClip,
+ float startValue, float finalValue)
+ : BaseRenderNodeAnimator(finalValue)
+ , mCenterX(centerX)
+ , mCenterY(centerY)
+ , mInverseClip(inverseClip) {
+ setStartValue(startValue);
+}
+
+float RevealAnimator::getValue(RenderNode* target) const {
+ return target->properties().getRevealClip().radius();
+}
+
+void RevealAnimator::setValue(RenderNode* target, float value) {
+ target->animatorProperties().mutableRevealClip().set(true, mInverseClip,
+ mCenterX, mCenterY, value);
+}
+
} /* namespace uirenderer */
} /* namespace android */
diff --git a/libs/hwui/Animator.h b/libs/hwui/Animator.h
index 0dda23f..9a080a7 100644
--- a/libs/hwui/Animator.h
+++ b/libs/hwui/Animator.h
@@ -51,7 +51,7 @@
mListener = listener;
}
ANDROID_API void start() { mStagingPlayState = RUNNING; onStagingPlayStateChanged(); }
- ANDROID_API void cancel() { mStagingPlayState = FINISHED; onStagingPlayStateChanged(); }
+ ANDROID_API void end() { mStagingPlayState = FINISHED; onStagingPlayStateChanged(); }
void attach(RenderNode* target);
virtual void onAttached() {}
@@ -169,6 +169,19 @@
PaintField mField;
};
+class RevealAnimator : public BaseRenderNodeAnimator {
+public:
+ ANDROID_API RevealAnimator(int centerX, int centerY, bool inverseClip,
+ float startValue, float finalValue);
+protected:
+ virtual float getValue(RenderNode* target) const;
+ virtual void setValue(RenderNode* target, float value);
+
+private:
+ int mCenterX, mCenterY;
+ bool mInverseClip;
+};
+
} /* namespace uirenderer */
} /* namespace android */
diff --git a/libs/hwui/RevealClip.h b/libs/hwui/RevealClip.h
index ece8498..07404cb 100644
--- a/libs/hwui/RevealClip.h
+++ b/libs/hwui/RevealClip.h
@@ -57,6 +57,10 @@
return mShouldClip;
}
+ float radius() const {
+ return mRadius;
+ }
+
const SkPath* getPath() const {
if (!mShouldClip) return NULL;