aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/convexpaths.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-26 20:33:19 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-26 20:33:19 +0000
commit72b55be3f3448287e8ff6fe83633edadfb60f59a (patch)
treef2b82e11ed7104c50944298c2d78f74802db1977 /gm/convexpaths.cpp
parent8bb3ba151e83cdb76aeab13ea6d6527a061c2176 (diff)
Change background color and add paths to convexpaths gm
git-svn-id: http://skia.googlecode.com/svn/trunk@3090 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/convexpaths.cpp')
-rw-r--r--gm/convexpaths.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/gm/convexpaths.cpp b/gm/convexpaths.cpp
index 5d8f049bab..b3800cd2d4 100644
--- a/gm/convexpaths.cpp
+++ b/gm/convexpaths.cpp
@@ -14,7 +14,7 @@ namespace skiagm {
class ConvexPathsGM : public GM {
public:
ConvexPathsGM() {
- this->setBGColor(0xFFDDDDDD);
+ this->setBGColor(0xFF000000);
this->makePaths();
}
@@ -63,10 +63,6 @@ protected:
100 * SK_Scalar1),
SkPath::kCCW_Direction);
- fPaths.push_back().addRect(0, 0,
- 100 * SK_Scalar1, 100 * SK_Scalar1,
- SkPath::kCCW_Direction);
-
fPaths.push_back().addRoundRect(SkRect::MakeXYWH(0, 0,
SK_Scalar1 * 100,
SK_Scalar1 * 100),
@@ -78,6 +74,12 @@ protected:
SK_Scalar1 * 100),
20 * SK_Scalar1, 40 * SK_Scalar1,
SkPath::kCCW_Direction);
+
+ // shallow diagonals
+ fPaths.push_back().lineTo(100 * SK_Scalar1, SK_Scalar1);
+ fPaths.back().lineTo(98 * SK_Scalar1, 100 * SK_Scalar1);
+ fPaths.back().lineTo(3 * SK_Scalar1, 96 * SK_Scalar1);
+
/*
It turns out arcTos are not automatically marked as convex and they
may in fact be ever so slightly concave.
@@ -87,6 +89,14 @@ protected:
25 * SK_Scalar1, 130 * SK_Scalar1, false);
*/
+ // cubics
+ fPaths.push_back().cubicTo( 1 * SK_Scalar1, 1 * SK_Scalar1,
+ 10 * SK_Scalar1, 90 * SK_Scalar1,
+ 0 * SK_Scalar1, 100 * SK_Scalar1);
+ fPaths.push_back().cubicTo(100 * SK_Scalar1, 50 * SK_Scalar1,
+ 20 * SK_Scalar1, 100 * SK_Scalar1,
+ 0 * SK_Scalar1, 0 * SK_Scalar1);
+
// point degenerate
fPaths.push_back().moveTo(50 * SK_Scalar1, 50 * SK_Scalar1);
fPaths.back().lineTo(50 * SK_Scalar1, 50 * SK_Scalar1);
@@ -117,7 +127,7 @@ protected:
paint.setAntiAlias(true);
SkRandom rand;
canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1);
- for (int i = 0 ; i < fPaths.count(); ++i) {
+ for (int i = 0; i < fPaths.count(); ++i) {
canvas->save();
// position the path, and make it at off-integer coords.
canvas->translate(SK_Scalar1 * 200 * (i % 5) + SK_Scalar1 / 4,