summaryrefslogtreecommitdiff
path: root/libs/hwui/SkiaCanvas.cpp
diff options
context:
space:
mode:
author Doris Liu <tianliu@google.com> 2016-01-07 13:49:26 -0800
committer Doris Liu <tianliu@google.com> 2016-02-02 15:04:01 -0800
commitf276acd98457bcaabc9e79a17a736b3b484f005e (patch)
treeb9efee10194c520b09a4813f7b8074be9a2f99c8 /libs/hwui/SkiaCanvas.cpp
parent650e3b70e4aa2fa9acf2f9c6ce211c4b46862c15 (diff)
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
Diffstat (limited to 'libs/hwui/SkiaCanvas.cpp')
-rw-r--r--libs/hwui/SkiaCanvas.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index 20e7c711a9ce..550995b2b9c6 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -27,6 +27,8 @@
#include <SkTLazy.h>
#include <SkTemplates.h>
+#include "VectorDrawable.h"
+
#include <memory>
namespace android {
@@ -136,6 +138,7 @@ public:
float hOffset, float vOffset, const SkPaint& paint) override;
virtual bool drawTextAbsolutePos() const override { return true; }
+ virtual void drawVectorDrawable(VectorDrawableRoot* vectorDrawable) override;
private:
struct SaveRec {
@@ -713,6 +716,14 @@ void SkiaCanvas::drawNinePatch(const SkBitmap& bitmap, const Res_png_9patch& chu
NinePatch::Draw(mCanvas, bounds, bitmap, chunk, paint, nullptr);
}
+void SkiaCanvas::drawVectorDrawable(VectorDrawableRoot* vectorDrawable) {
+ const SkBitmap& bitmap = vectorDrawable->getBitmapUpdateIfDirty();
+ SkRect bounds = vectorDrawable->getBounds();
+ drawBitmap(bitmap, 0, 0, bitmap.width(), bitmap.height(),
+ bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom,
+ vectorDrawable->getPaint());
+}
+
// ----------------------------------------------------------------------------
// Canvas draw operations: Text
// ----------------------------------------------------------------------------