summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Ferris <bferris@google.com>2019-07-10 21:10:18 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-07-10 21:10:18 +0000
commita94d8aed241a2bcca283068554288f0405803a90 (patch)
tree1647287553b32eb62bddb849ab3296f41e8ba57c
parent60aad1a06f0950b96a63c192e2eac60463bd6a90 (diff)
parent9109ce6b0af6fc94b79cf855a10d85e107c768c2 (diff)
downloadbase-a94d8aed241a2bcca283068554288f0405803a90.tar.gz
Merge "Fix Layout.primaryIsTrailingPreviousAllLineOffsets" into pi-dev
-rw-r--r--core/java/android/text/Layout.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
index c6f73cb47576..c02f7ef65a77 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -1099,6 +1099,9 @@ public abstract class Layout {
if (limit > lineEnd) {
limit = lineEnd;
}
+ if (limit == start) {
+ continue;
+ }
level[limit - lineStart - 1] =
(byte) ((runs[i + 1] >>> RUN_LEVEL_SHIFT) & RUN_LEVEL_MASK);
}
@@ -1194,8 +1197,8 @@ public abstract class Layout {
}
/**
- * Computes in linear time the results of calling
- * #getHorizontal for all offsets on a line.
+ * Computes in linear time the results of calling #getHorizontal for all offsets on a line.
+ *
* @param line The line giving the offsets we compute information for
* @param clamped Whether to clamp the results to the width of the layout
* @param primary Whether the results should be the primary or the secondary horizontal
@@ -1230,7 +1233,7 @@ public abstract class Layout {
TextLine.recycle(tl);
if (clamped) {
- for (int offset = 0; offset <= wid.length; ++offset) {
+ for (int offset = 0; offset < wid.length; ++offset) {
if (wid[offset] > mWidth) {
wid[offset] = mWidth;
}