use quads for mixed radius rrects
Create a specialized version of adding a pair of corner quads
that avoids the overhead of the full arc machinery.
This is on the way to changing Chrome to calling Skia directly to create fully general round rects rather than rolling their own.
R=robertphillips@google.com, reed@google.com
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/60203002
git-svn-id: http://skia.googlecode.com/svn/trunk@12190 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index f6c2a7a..2dbf5c6 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -14,6 +14,7 @@
#include "SkPathEffect.h"
#include "SkRandom.h"
#include "SkReader32.h"
+#include "SkRRect.h"
#include "SkSize.h"
#include "SkSurface.h"
#include "SkTypes.h"
@@ -2572,6 +2573,33 @@
REPORTER_ASSERT(reporter, !(p != empty));
}
+static void test_rrect_is_convex(skiatest::Reporter* reporter, SkPath* path) {
+ REPORTER_ASSERT(reporter, path->isConvex());
+ path->setConvexity(SkPath::kUnknown_Convexity);
+ REPORTER_ASSERT(reporter, path->isConvex());
+ path->reset();
+}
+
+static void test_rrect(skiatest::Reporter* reporter) {
+ SkPath p;
+ SkRRect rr;
+ SkVector radii[] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}};
+ SkRect r = {10, 20, 30, 40};
+ rr.setRectRadii(r, radii);
+ p.addRRect(rr);
+ test_rrect_is_convex(reporter, &p);
+ p.addRRect(rr, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p);
+ p.addRoundRect(r, &radii[0].fX);
+ test_rrect_is_convex(reporter, &p);
+ p.addRoundRect(r, &radii[0].fX, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p);
+ p.addRoundRect(r, radii[1].fX, radii[1].fY);
+ test_rrect_is_convex(reporter, &p);
+ p.addRoundRect(r, radii[1].fX, radii[1].fY, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p);
+}
+
static void TestPath(skiatest::Reporter* reporter) {
SkTSize<SkScalar>::Make(3,4);
@@ -2673,6 +2701,7 @@
test_gen_id(reporter);
test_path_close_issue1474(reporter);
test_path_to_region(reporter);
+ test_rrect(reporter);
}
#include "TestClassDef.h"