Chromium Code Reviews| Index: gm/inversestrokefill.cpp |
| diff --git a/gm/inversestrokefill.cpp b/gm/inversestrokefill.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..842cbd6fa81e58ee68a1c7dbf44128e6ab9c1d09 |
| --- /dev/null |
| +++ b/gm/inversestrokefill.cpp |
| @@ -0,0 +1,55 @@ |
| +/* |
| + * Copyright 2013 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#include "gm.h" |
| +#include "SkCanvas.h" |
| +#include "SkPath.h" |
| + |
| +namespace skiagm { |
| + |
| +class InverseStrokeFillGM : public GM { |
| +public: |
| + InverseStrokeFillGM() { |
| + |
| + } |
| + |
| +protected: |
| + virtual SkString onShortName() { |
| + return SkString("inverse_stroke_fill"); |
| + } |
| + |
| + virtual SkISize onISize() { |
| + return make_isize(100, 100); |
| + } |
| + |
| + virtual void onDraw(SkCanvas* canvas) { |
| + SkScalar x = SkIntToScalar(50); |
| + SkScalar y = SkIntToScalar(50); |
| + SkScalar r = SkIntToScalar(40); |
| + |
| + SkPaint paint; |
| + paint.setStrokeWidth(SkIntToScalar(5)); |
|
edisonn
2013/07/26 20:23:52
add option for stoke width 0
ducky
2013/07/29 19:07:51
Done. The original intent of this GM was to test o
|
| + paint.setStyle(SkPaint::kStrokeAndFill_Style); |
|
edisonn
2013/07/26 20:23:52
what about the rest of styles?
ducky
2013/07/29 19:07:51
Done.
|
| + |
| + SkPath path; |
| + path.setFillType(SkPath::kInverseWinding_FillType); |
| + path.addCircle(x, y, r, SkPath::kCW_Direction); |
| + canvas->drawPath(path, paint); |
|
edisonn
2013/07/26 20:23:52
please add tests for other addFoo operations. some
ducky
2013/07/29 19:07:51
Done.
|
| + |
| + // Draw positive centerline for reference. |
| + paint.setStrokeWidth(SkIntToScalar(0)); |
| + paint.setStyle(SkPaint::kStroke_Style); |
| + path.setFillType(SkPath::kWinding_FillType); |
| + canvas->drawPath(path, paint); |
| + } |
| + |
| +private: |
| + typedef GM INHERITED; |
| +}; |
| + |
| +DEF_GM( return new InverseStrokeFillGM; ) |
| +} |