Flutter Engine
The Flutter Engine
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);
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)
Definition: SkCanvas.cpp:1673
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1456
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
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
Definition: SkPath.h:59
SkPath & addOval(const SkRect &oval, SkPathDirection dir=SkPathDirection::kCW)
Definition: SkPath.cpp:1106
SkPath & addRect(const SkRect &rect, SkPathDirection dir, unsigned start)
Definition: SkPath.cpp:864
REG_FIDDLE(bug5252, 256, 256, false, 0)
Definition: bug5252.cpp:4
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
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