From f276acd98457bcaabc9e79a17a736b3b484f005e Mon Sep 17 00:00:00 2001 From: Doris Liu Date: Thu, 7 Jan 2016 13:49:26 -0800 Subject: VectorDrawable native rendering - Step 4 of MANY This CL runs VectorDrawable animation on RenderThread. The changes in this CL include: - Convert all the animators in AnimatorSet for AVD into a set of RenderNodeAnimators. - Hook up the new animators with RenderThread - Add drawOp in RecordingCanvas for drawing VD so that during the animation on RenderThread, all the property changes on VD can be reflected on the screen. TODO: - Implement reverse and reset for AVD. Change-Id: I2df1d754f2db0ad098d9c15dde4bb2bdfafc2315 --- core/java/android/view/RenderNode.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'core/java/android/view/RenderNode.java') diff --git a/core/java/android/view/RenderNode.java b/core/java/android/view/RenderNode.java index 88bffb5827aa..2aace0f30139 100644 --- a/core/java/android/view/RenderNode.java +++ b/core/java/android/view/RenderNode.java @@ -22,6 +22,7 @@ import android.graphics.Matrix; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.Rect; +import android.graphics.drawable.AnimatedVectorDrawable; /** *

A display list records a series of graphics related operations and can replay @@ -771,6 +772,14 @@ public class RenderNode { mOwningView.mAttachInfo.mViewRootImpl.registerAnimatingRenderNode(this); } + public void addAnimator(AnimatedVectorDrawable.VectorDrawableAnimator animatorSet) { + if (mOwningView == null || mOwningView.mAttachInfo == null) { + throw new IllegalStateException("Cannot start this animator on a detached view!"); + } + nAddAnimator(mNativeRenderNode, animatorSet.getAnimatorNativePtr()); + mOwningView.mAttachInfo.mViewRootImpl.registerAnimatingRenderNode(this); + } + public void endAllAnimators() { nEndAllAnimators(mNativeRenderNode); } -- cgit v1.2.3