зеркало из https://github.com/mozilla/moz-skia.git
Change background color and add paths to convexpaths gm
git-svn-id: http://skia.googlecode.com/svn/trunk@3090 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
8bb3ba151e
Коммит
72b55be3f3
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче