aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-08 15:51:12 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-08 15:51:12 +0000
commit42feaaf0a5fbb508b237d5c844c484a1a3b0c865 (patch)
tree92a7a2255e5b2cdb62877577705390efc31debd7 /tests
parentc78b8f2f738d3e20ceb971f2b0da0a0802eab9bd (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/PathTest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index f6c2a7ae6e..2dbf5c695e 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 @@ static void test_empty(skiatest::Reporter* reporter, const SkPath& p) {
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 @@ static void TestPath(skiatest::Reporter* reporter) {
test_gen_id(reporter);
test_path_close_issue1474(reporter);
test_path_to_region(reporter);
+ test_rrect(reporter);
}
#include "TestClassDef.h"