Compute full text layout in MeasuredText and use it for drawing
The full layout is required for drawing text on UI thread. To save this work, store the full layout result in MeasuredText and compose the final layout from stored full layout if possible. Currently justification/hyphenation is not supported but works normally as before. Nothing changes on existing non measured text. StaticLayout creation time for no style text (w/o patch -> w/ patch, N=30) MeasuredText Balanced Hyphenation : 721,297 -> 720,657: (-0.1%) MeasuredText Balanced NoHyphenation: 550,588 -> 546,069: (-0.8%) MeasuredText Greedy Hyphenation : 503,582 -> 498,009: (-1.1%) MeasuredText Greedy NoHyphenation : 502,344 -> 498,507: (-0.8%) RandomText Balanced Hyphenation : 19,351,802 -> 19,176,024: (-0.9%) RandomText Balanced NoHyphenation : 8,033,830 -> 7,973,336: (-0.8%) RandomText Greedy Hyphenation : 7,957,335 -> 7,927,316: (-0.4%) RandomText Greedy NoHyphenation : 7,988,884 -> 7,929,717: (-0.7%) StaticLayout.draw time for no style text (w/o patch -> w/ patch, N=30) MeasuredText NoStyled : 644,453 -> 660,684: (+2.5%) MeasuredText NoStyled WithoutCache : 9,251,919 -> 648,992: (-93.0%) MeasuredText Styled : 3,092,353 -> 870,702: (-71.8%) MeasuredText Styled WithoutCache : 12,544,014 -> 1,114,557: (-91.1%) RandomText NoStyled : 582,167 -> 572,092: (-1.7%) RandomText NoStyled WithoutCache : 9,167,670 -> 9,056,447: (-1.2%) RandomText Styled : 3,064,490 -> 3,029,028: (-1.2%) RandomText Styled WithoutCache : 12,314,863 -> 12,283,026: (-0.3%) Test: minikin_test Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest Test: bit FrameworksCoreTests:android.text.MeasuredParagraphTest Bug: 63897135 Change-Id: I7e6ec5c953d7d0f767aba4f61f94e62b6f3a3a2b
Loading
Please register or sign in to comment