aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/hittestpath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gm/hittestpath.cpp')
-rw-r--r--gm/hittestpath.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/gm/hittestpath.cpp b/gm/hittestpath.cpp
index 83f3507da1..4347c9b22f 100644
--- a/gm/hittestpath.cpp
+++ b/gm/hittestpath.cpp
@@ -13,12 +13,12 @@
static void test_hittest(SkCanvas* canvas, const SkPath& path) {
SkPaint paint;
SkRect r = path.getBounds();
-
+
paint.setColor(SK_ColorRED);
canvas->drawPath(path, paint);
-
+
const SkScalar MARGIN = SkIntToScalar(4);
-
+
paint.setColor(0x800000FF);
for (SkScalar y = r.fTop + SK_ScalarHalf - MARGIN; y < r.fBottom + MARGIN; y += SK_Scalar1) {
for (SkScalar x = r.fLeft + SK_ScalarHalf - MARGIN; x < r.fRight + MARGIN; x += SK_Scalar1) {
@@ -32,18 +32,18 @@ static void test_hittest(SkCanvas* canvas, const SkPath& path) {
class HitTestPathGM : public skiagm::GM {
public:
HitTestPathGM () {}
-
+
protected:
virtual SkString onShortName() {
return SkString("hittestpath");
}
-
+
virtual SkISize onISize() { return SkISize::Make(700, 460); }
-
+
virtual void onDraw(SkCanvas* canvas) {
SkPath path;
SkRandom rand;
-
+
int scale = 300;
for (int i = 0; i < 4; ++i) {
path.lineTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale);
@@ -53,18 +53,18 @@ protected:
rand.nextUScalar1() * scale, rand.nextUScalar1() * scale,
rand.nextUScalar1() * scale, rand.nextUScalar1() * scale);
}
-
+
path.setFillType(SkPath::kEvenOdd_FillType);
path.offset(SkIntToScalar(20), SkIntToScalar(20));
-
+
test_hittest(canvas, path);
canvas->translate(SkIntToScalar(scale), 0);
path.setFillType(SkPath::kWinding_FillType);
-
+
test_hittest(canvas, path);
}
-
+
private:
typedef GM INHERITED;
};