From 30c4cae7d3a26252e7e45adf6e5722b34adf6848 Mon Sep 17 00:00:00 2001 From: robertphillips Date: Tue, 15 Sep 2015 10:20:55 -0700 Subject: Add special case circle blur for Ganesh This makes the blurcircles bench go from ~33us to ~8us on Windows desktop. It will require layout test suppressions Review URL: https://codereview.chromium.org/1311583005 --- include/core/SkRRect.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include/core/SkRRect.h') diff --git a/include/core/SkRRect.h b/include/core/SkRRect.h index 37766219df..064e7be8e4 100644 --- a/include/core/SkRRect.h +++ b/include/core/SkRRect.h @@ -96,8 +96,13 @@ public: inline bool isRect() const { return kRect_Type == this->getType(); } inline bool isOval() const { return kOval_Type == this->getType(); } inline bool isSimple() const { return kSimple_Type == this->getType(); } + // TODO: should isSimpleCircular & isCircle take a tolerance? This could help + // instances where the mapping to device space is noisy. inline bool isSimpleCircular() const { - return this->isSimple() && fRadii[0].fX == fRadii[0].fY; + return this->isSimple() && SkScalarNearlyEqual(fRadii[0].fX, fRadii[0].fY); + } + inline bool isCircle() const { + return this->isOval() && SkScalarNearlyEqual(fRadii[0].fX, fRadii[0].fY); } inline bool isNinePatch() const { return kNinePatch_Type == this->getType(); } inline bool isComplex() const { return kComplex_Type == this->getType(); } @@ -140,6 +145,12 @@ public: return rr; } + static SkRRect MakeOval(const SkRect& oval) { + SkRRect rr; + rr.setOval(oval); + return rr; + } + /** * Set this RR to match the supplied oval. All x radii will equal half the * width and all y radii will equal half the height. -- cgit v1.2.3