Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e21a048a authored by Seigo Nonaka's avatar Seigo Nonaka Committed by Android Build Coastguard Worker
Browse files

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 ae1912b6)
parent afff8015
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -2214,22 +2214,22 @@ 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) {
            int a = i + ellipsisStart + linestart;
            dest[destoff + a - start] = c;
        }
    }
    }

    /**
     * Stores information about bidirectional (left-to-right or right-to-left)