aboutsummaryrefslogtreecommitdiff
path: root/tests/PathTest.cpp
diff options
context:
space:
mode:
authorreed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-06-03 02:35:01 +0000
committerreed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-06-03 02:35:01 +0000
commit6b82d1adc6a4726e36674e468ff1157e0b75373f (patch)
treeb54346ec55abc1e2ed1986883ea5e6931287a6ba /tests/PathTest.cpp
parent4a7fd2bd275446ecad0e70aff2b9fd31d2bc8e95 (diff)
add isConvex() hit to SkPath, to be used to speed up fills and opengl
set linewidth in gldevice for hair rects remove some cruft from samples add more gl-unimpl messages git-svn-id: http://skia.googlecode.com/svn/trunk@199 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PathTest.cpp')
-rw-r--r--tests/PathTest.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index c17fa45955..89fe93b963 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1,11 +1,27 @@
#include "Test.h"
#include "SkPath.h"
+static void check_convex_bounds(skiatest::Reporter* reporter, const SkPath& p,
+ const SkRect& bounds) {
+ REPORTER_ASSERT(reporter, p.isConvex());
+ REPORTER_ASSERT(reporter, p.getBounds() == bounds);
+
+ SkPath p2(p);
+ REPORTER_ASSERT(reporter, p2.isConvex());
+ REPORTER_ASSERT(reporter, p2.getBounds() == bounds);
+
+ SkPath other;
+ other.swap(p2);
+ REPORTER_ASSERT(reporter, other.isConvex());
+ REPORTER_ASSERT(reporter, other.getBounds() == bounds);
+}
+
static void TestPath(skiatest::Reporter* reporter) {
SkPath p, p2;
SkRect bounds, bounds2;
REPORTER_ASSERT(reporter, p.isEmpty());
+ REPORTER_ASSERT(reporter, !p.isConvex());
REPORTER_ASSERT(reporter, p.getFillType() == SkPath::kWinding_FillType);
REPORTER_ASSERT(reporter, !p.isInverseFillType());
REPORTER_ASSERT(reporter, p == p2);
@@ -14,8 +30,20 @@ static void TestPath(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, p.getBounds().isEmpty());
bounds.set(0, 0, SK_Scalar1, SK_Scalar1);
+
+ p.setIsConvex(false);
+ p.addRoundRect(bounds, SK_Scalar1, SK_Scalar1);
+ check_convex_bounds(reporter, p, bounds);
+
+ p.reset();
+ p.setIsConvex(false);
+ p.addOval(bounds);
+ check_convex_bounds(reporter, p, bounds);
+
+ p.reset();
+ p.setIsConvex(false);
p.addRect(bounds);
- REPORTER_ASSERT(reporter, bounds == p.getBounds());
+ check_convex_bounds(reporter, p, bounds);
REPORTER_ASSERT(reporter, p != p2);
REPORTER_ASSERT(reporter, !(p == p2));