summaryrefslogtreecommitdiff
path: root/include/minikin/Range.h
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2018-02-26 17:16:07 -0800
committerSeigo Nonaka <nona@google.com>2018-02-28 15:22:36 -0800
commit56f8ea51818c682991c1e700e07f93e26167ed89 (patch)
tree79879b6455c83c7a1c206732b585cf205c653263 /include/minikin/Range.h
parent3998e6fc7fb9cdd27e056253fa2af6de221da926 (diff)
downloadminikin-56f8ea51818c682991c1e700e07f93e26167ed89.tar.gz
Move BidiText to its own header with tests
Also revised the doLayoutRunCached arguments to use string pieces. StaticLayout creation time: RandomText Balanced Hyphenation : 18,073,107 -> 18,016,001: (-0.3%) RandomText Balanced NoHyphenation : 7,450,524 -> 7,443,239: (-0.1%) RandomText Greedy Hyphenation : 7,400,186 -> 7,395,553: (-0.1%) RandomText Greedy NoHyphenation : 7,399,679 -> 7,388,850: (-0.1%) PrecomputedText Balanced Hyphenation : 689,868 -> 694,994: (+0.7%) PrecomputedText Balanced NoHyphenation: 516,777 -> 521,159: (+0.8%) PrecomputedText Greedy Hyphenation : 466,565 -> 467,685: (+0.2%) PrecomputedText Greedy NoHyphenation : 466,130 -> 469,467: (+0.7%) PrecomputedText creation time: NoStyled Hyphenation : 18,068,965 -> 17,992,733: (-0.4%) NoStyled Hyphenation WidthOnly : 18,028,284 -> 18,055,468: (+0.2%) NoStyled NoHyphenation : 7,454,650 -> 7,487,982: (+0.4%) NoStyled NoHyphenation WidthOnly : 7,445,369 -> 7,454,787: (+0.1%) Styled Hyphenation : 15,385,852 -> 15,357,579: (-0.2%) Styled Hyphenation WidthOnly : 15,390,795 -> 15,381,445: (-0.1%) Styled NoHyphenation : 14,975,306 -> 14,939,929: (-0.2%) Styled NoHyphenation WidthOnly : 14,983,997 -> 14,979,650: (-0.0%) StaticLayout draw time: PrecomputedText NoStyled : 536,392 -> 541,213: (+0.9%) PrecomputedText NoStyled WithoutCache : 528,682 -> 524,672: (-0.8%) PrecomputedText Styled : 806,088 -> 820,548: (+1.8%) PrecomputedText Styled WithoutCache : 856,605 -> 844,277: (-1.4%) RandomText NoStyled : 535,535 -> 547,398: (+2.2%) RandomText NoStyled WithoutCache : 6,819,228 -> 6,807,230: (-0.2%) RandomText Styled : 2,929,458 -> 2,930,573: (+0.0%) RandomText Styled WithoutCache : 3,360,559 -> 3,384,135: (+0.7%) Bug: 65024629 Test: minikin_tests Test: atest CtsWidgetTestCases:EditTextTest CtsWidgetTestCases:TextViewFadingEdgeTest FrameworksCoreTests:TextViewFallbackLineSpacingTest FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest CtsTextTestCases FrameworksCoreTests:android.text Change-Id: I5080db4c42be496771a4042464b48395bd1567eb
Diffstat (limited to 'include/minikin/Range.h')
-rw-r--r--include/minikin/Range.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/minikin/Range.h b/include/minikin/Range.h
index 2e94237..2efde7e 100644
--- a/include/minikin/Range.h
+++ b/include/minikin/Range.h
@@ -30,6 +30,7 @@ public:
// start must be smaller than or equal to end otherwise the behavior is undefined.
Range(uint32_t start, uint32_t end) : mStart(start), mEnd(end) {}
+ Range() : Range(NOWHERE, NOWHERE) {}
Range(const Range&) = default;
Range& operator=(const Range&) = default;
@@ -79,6 +80,10 @@ public:
return Range({std::min(left.mStart, right.mStart), std::max(left.mEnd, right.mEnd)});
}
+ inline bool operator==(const Range& o) const { return mStart == o.mStart && mEnd == o.mEnd; }
+
+ inline bool operator!=(const Range& o) const { return !(*this == o); }
+
private:
// Helper class for "for (uint32_t i : range)" style for-loop.
class RangeIterator {