26#define STROKE_WIDTH SkIntToScalar(20)
31 paint.setAntiAlias(
true);
36 paint.setStrokeJoin(join);
40 paint.setStrokeWidth(0);
44 paint.setStrokeWidth(3);
46 int n = path.countPoints();
48 path.getPoints(
points.get(), n);
81 constexpr SkRect gRects[] = {
91 { 0, 0,
W, FLT_EPSILON },
92 { 0, 0, FLT_EPSILON,
H },
93 { 0, 0, FLT_EPSILON, FLT_EPSILON },
96 for (
int doFill = 0; doFill <= 1; ++doFill) {
97 for (
size_t i = 0; i < std::size(gJoins); ++i) {
99 paint.setStrokeJoin(join);
102 for (
size_t j = 0; j < std::size(gRects); ++j) {
103 const SkRect& r = gRects[j];
108 draw_path(canvas, fillPath, r, join, doFill);
120 using INHERITED =
GM;
135 canvas->scale(10, 1);
137 canvas->drawRect(r, p);
static const int points[]
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorWHITE
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void drawPath(const SkPath &path, const SkPaint &paint)
@ kPoints_PointMode
draw each point separately
@ kStroke_Style
set to stroke geometry
@ kStrokeAndFill_Style
sets to stroke and fill geometry
@ kMiter_Join
extends to miter limit
@ kBevel_Join
connects outside edges
SkString getName() const override
void onDraw(SkCanvas *canvas) override
SkISize getISize() override
GM(SkColor backgroundColor=SK_ColorWHITE)
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)
static void draw_path(SkCanvas *canvas, const SkPath &path, const SkRect &rect, SkPaint::Join join, int doFill)
static constexpr SkISize Make(int32_t w, int32_t h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)