summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2015-02-12 16:16:49 -0800
committerRaph Levien <raph@google.com>2015-02-12 16:29:25 -0800
commitbb2397c523dc3e1e54fcd2ebf7ae20907e3f37ad (patch)
tree6e66d3acd9da06f7327548dc9846613b6906b815
parentd7c020e9e525f1db44da1d0428d87a53babb3927 (diff)
downloadframeworks_base-bb2397c523dc3e1e54fcd2ebf7ae20907e3f37ad.zip
frameworks_base-bb2397c523dc3e1e54fcd2ebf7ae20907e3f37ad.tar.gz
frameworks_base-bb2397c523dc3e1e54fcd2ebf7ae20907e3f37ad.tar.bz2
Fix EditText RenderNode invalidation bugs
EditText uses a TextDisplayList data structure to hold RenderNode objects for optimized incremental drawing. This data structure uses an isDirty flag to indicate when it has been invalidated and needs to be re-rendered. This flag was not being computed correctly, leading to excessive re-rendering. This patch clears isDirty after rendering text into the RenderNode, so that it can be reused until it is invalidated, and also explicitly sets it when it is recycled. Bug: 19371378 Change-Id: I70239cc30e43bb8631dfffc2ea2705e8d4c452f4
-rw-r--r--core/java/android/widget/Editor.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index d5166f3..4752594 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -1352,6 +1352,9 @@ public class Editor {
searchStartIndex);
// Note how dynamic layout's internal block indices get updated from Editor
blockIndices[i] = blockIndex;
+ if (mTextDisplayLists[blockIndex] != null) {
+ mTextDisplayLists[blockIndex].isDirty = true;
+ }
searchStartIndex = blockIndex + 1;
}
@@ -1388,6 +1391,7 @@ public class Editor {
// brings this range of text back to the top left corner of the viewport
hardwareCanvas.translate(-left, -top);
layout.drawText(hardwareCanvas, blockBeginLine, blockEndLine);
+ mTextDisplayLists[blockIndex].isDirty = false;
// No need to untranslate, previous context is popped after
// drawDisplayList
} finally {