Skip to content
Commit 7fd36d19 authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Reorganize MeasuredText API

This CL changes the MeasuredText API:
- Rename MeasuredText to PrecomputedText.
- PrecomputedText is no longer a Spanned.
- Introduce PrecomputedText.Param which holds all text layout parameters.
- Add API to get PrecomputedText.Param from TextView.
- Remove MeasuredText.Builder and add PrecomputedText.create method instead.
- Remove setRange from MeasuredText since it is not for normal use case.
  (It can not be used for TextView)

Here is a performance scores: (median, walleye-userdebug, N=20)

StaticLayout creation time (w/o patch -> w/ patch)
 PrecomputedText Balanced Hyphenation  :    743,615 ->    737,145: (-0.9%)
 PrecomputedText Balanced NoHyphenation:    551,544 ->    542,715: (-1.6%)
 PrecomputedText Greedy Hyphenation    :    500,343 ->    499,601: (-0.1%)
 PrecomputedText Greedy NoHyphenation  :    497,987 ->    492,587: (-1.1%)
 RandomText Balanced Hyphenation       : 19,100,592 -> 19,135,289: (+0.2%)
 RandomText Balanced NoHyphenation     :  8,015,088 ->  7,954,260: (-0.8%)
 RandomText Greedy Hyphenation         :  7,950,915 ->  7,877,424: (-0.9%)
 RandomText Greedy NoHyphenation       :  7,939,337 ->  7,863,471: (-1.0%)

PrecomputedText creation time (w/o patch -> w/ patch)
 NoStyled Hyphenation                  : 18,935,638 -> 18,925,422: (-0.1%)
 NoStyled Hyphenation WidthOnly        : 18,469,726 -> 18,978,413: (+2.8%)
 NoStyled NoHyphenation                :  7,940,792 ->  7,919,127: (-0.3%)
 NoStyled NoHyphenation WidthOnly      :  7,463,230 ->  7,922,643: (+6.2%)
 Styled Hyphenation                    : 14,822,501 -> 14,809,017: (-0.1%)
 Styled Hyphenation WidthOnly          : 13,891,770 -> 14,656,617: (+5.5%)
 Styled NoHyphenation                  : 14,511,134 -> 14,301,503: (-1.4%)
 Styled NoHyphenation WidthOnly        : 13,495,345 -> 14,264,314: (+5.7%)

StaticLayout draw time (w/o patch -> w/ patch)
 PrecomputedText NoStyled              :    663,974 ->    661,610: (-0.4%)
 PrecomputedText NoStyled WithoutCache :    648,294 ->    648,766: (+0.1%)
 PrecomputedText Styled                :    879,322 ->    852,770: (-3.0%)
 PrecomputedText Styled WithoutCache   :  1,084,570 ->  1,110,147: (+2.4%)
 RandomText NoStyled                   :    565,682 ->    555,435: (-1.8%)
 RandomText NoStyled WithoutCache      :  9,070,533 ->  9,064,825: (-0.1%)
 RandomText Styled                     :  2,955,202 ->  2,962,008: (+0.2%)
 RandomText Styled WithoutCache        : 12,242,325 -> 12,228,573: (-0.1%)

Bug: 67504091
Bug: 73091756
Test: bit FrameworksCoreTests:android.text.
Test: atest CtsWidgetTestCases:EditTextTest \
    CtsWidgetTestCases:TextViewFadingEdgeTest \
    FrameworksCoreTests:TextViewFallbackLineSpacingTest \
    FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
    CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \
    CtsTextTestCases
Change-Id: I7db9e2ca4db68a16648cfb8fcf63555f501304c2
parent d3905e65
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment