From c0b87a84c6220cfa7b9c411609bf140b9c5928d5 Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Wed, 16 Mar 2016 14:54:51 -0700 Subject: [PATCH] Document the cache bitmap behavior for VD b/26454083 Change-Id: I22aeef9760aaf6bb79dca85740281cf94e19e601 --- .../android/graphics/drawable/VectorDrawable.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java index ae98c22dd4b00..150ecbbee1235 100644 --- a/graphics/java/android/graphics/drawable/VectorDrawable.java +++ b/graphics/java/android/graphics/drawable/VectorDrawable.java @@ -53,8 +53,15 @@ import java.util.HashMap; import java.util.Stack; /** - * This lets you create a drawable based on an XML vector graphic. It can be - * defined in an XML file with the <vector> element. + * This lets you create a drawable based on an XML vector graphic. + *

+ * Note: To optimize for the re-drawing performance, one bitmap cache is created + * for each VectorDrawable. Therefore, referring to the same VectorDrawable means sharing the same + * bitmap cache. If these references don't agree upon on the same size, the bitmap will be recreated + * and redrawn every time size is changed. In other words, if a VectorDrawable is used for + * different sizes, it is more efficient to create multiple VectorDrawables, one for each size. + *

+ * VectorDrawable can be defined in an XML file with the <vector> element. *

* The vector drawable has the following elements: *