mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-14 02:14:34 -05:00
202033c013
This adds 3 expat patches for n-asb-2022-09 from https://github.com/syphyr/android_external_expat/commits/cm-14.1 and also applies 2 of them to 15.1 Signed-off-by: Tad <tad@spotco.us>
50 lines
1.7 KiB
Diff
50 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Seigo Nonaka <nona@google.com>
|
|
Date: Tue, 8 Jun 2021 16:12:39 -0700
|
|
Subject: [PATCH] Improve ellipsize performance
|
|
|
|
Instead of iterate all ellipsized characters, only iterate the necessary
|
|
ranges for copying.
|
|
|
|
Bug: 188913943
|
|
Test: atest CtsTextTestCases CtsGraphicsTestCases CtsWidgetTestCases
|
|
Change-Id: I3d03b1e3897e427c23fbe51315f412c57a4ce9e9
|
|
Merged-In: I3d03b1e3897e427c23fbe51315f412c57a4ce9e9
|
|
(cherry picked from commit ae1912b62f7dfa361acfbe472cb8a49cd60f746e)
|
|
---
|
|
core/java/android/text/Layout.java | 14 +++++++-------
|
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
|
|
index 0999b982d990..11e5fab2ebb3 100644
|
|
--- a/core/java/android/text/Layout.java
|
|
+++ b/core/java/android/text/Layout.java
|
|
@@ -2054,20 +2054,20 @@ public abstract class Layout {
|
|
int ellipsisStart = getEllipsisStart(line);
|
|
int linestart = getLineStart(line);
|
|
|
|
- for (int i = ellipsisStart; i < ellipsisStart + ellipsisCount; i++) {
|
|
+ final int min = Math.max(0, start - ellipsisStart - linestart);
|
|
+ final int max = Math.min(ellipsisCount, end - ellipsisStart - linestart);
|
|
+
|
|
+ for (int i = min; i < max; i++) {
|
|
char c;
|
|
|
|
- if (i == ellipsisStart) {
|
|
+ if (i == 0) {
|
|
c = getEllipsisChar(method); // ellipsis
|
|
} else {
|
|
c = '\uFEFF'; // 0-width space
|
|
}
|
|
|
|
- int a = i + linestart;
|
|
-
|
|
- if (a >= start && a < end) {
|
|
- dest[destoff + a - start] = c;
|
|
- }
|
|
+ int a = i + ellipsisStart + linestart;
|
|
+ dest[destoff + a - start] = c;
|
|
}
|
|
}
|
|
|