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

Commit e5aad7a7 authored by James.cf Lin's avatar James.cf Lin
Browse files

Fix performance regression create_PrecomputedText_NoStyled_Greedy_NoHyphenation_DirDifferent_min

The LineBreakConfig instance in the StaticLayout is null as default.

Because the LineBreakConfig in StaticLayout was not initialized, the null instance was brought to PrecomputedText and caused the function PrecomputedText.Builder#checkResultUsable to return UNUSABLE.

Bug: b/220992481
Test: atest StaticLayoutTest; atest StaticLayoutPerfTest
Change-Id: I93bcb6ebc35344e34e9bb8a24df375aa7b3a8d81
parent 1cd717a2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ public class StaticLayout extends Layout {
            b.mBreakStrategy = Layout.BREAK_STRATEGY_SIMPLE;
            b.mHyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE;
            b.mJustificationMode = Layout.JUSTIFICATION_MODE_NONE;
            b.mLineBreakConfig = LineBreakConfig.NONE;
            return b;
        }

@@ -455,7 +456,7 @@ public class StaticLayout extends Layout {
        @Nullable private int[] mRightIndents;
        private int mJustificationMode;
        private boolean mAddLastLineLineSpacing;
        private LineBreakConfig mLineBreakConfig;
        private LineBreakConfig mLineBreakConfig = LineBreakConfig.NONE;

        private final Paint.FontMetricsInt mFontMetricsInt = new Paint.FontMetricsInt();