Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
bug5252.cpp
Go to the documentation of this file.
1// Copyright 2020 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(bug5252, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
6 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
7
8 SkPath clip1;
9 clip1.addOval(SkRect::MakeWH(225, 200));
10 canvas->clipPath(clip1); // bug
11
12 SkPath clip2;
13 clip2.addRect(SkRect::MakeWH(220, 200));
14 // canvas->clipPath(clip2); // ok
15
16 SkPaint pa;
18 pa.setAntiAlias(true);
19 pa.setStrokeWidth(1.0f);
20 for (int i = 0; i < 15; i++) {
21 for (int j = 0; j < 10; j++) {
22 SkAutoCanvasRestore acs(canvas, true);
23
24 canvas->translate(i * 15, j * 20);
25 canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 15), pa);
26 SkPath path;
27 path.moveTo(6, 6);
28 path.cubicTo(14, 10, 13, 12, 10, 12);
29 path.cubicTo(7, 15, 8, 17, 14, 18);
30 canvas->drawPath(path, pa);
31 }
32 }
33}
34} // END FIDDLE
#define SkIntToScalar(x)
Definition SkScalar.h:57
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
void drawPath(const SkPath &path, const SkPaint &paint)
void setStyle(Style style)
Definition SkPaint.cpp:105
void setAntiAlias(bool aa)
Definition SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
void setStrokeWidth(SkScalar width)
Definition SkPaint.cpp:159
SkPath & addOval(const SkRect &oval, SkPathDirection dir=SkPathDirection::kCW)
Definition SkPath.cpp:1101
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
Definition SkPath.cpp:854
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition SkRect.h:659
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609