Flutter Engine
The Flutter Engine
bug5252.cpp
Go to the documentation of this file.
1/*
2* Copyright 2016 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
7
8#include "gm/gm.h"
12#include "include/core/SkRect.h"
14
15DEF_SIMPLE_GM(bug5252, canvas, 500, 500) {
16 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
17
18 canvas->clipPath(SkPath::Oval(SkRect::MakeWH(225, 200))); // bug
19
20 //canvas->clipPath(SkPath::Oval(SkRect::MakeWH(220, 200))); // ok
21
22 SkPaint pa;
24 pa.setAntiAlias(true);
25 pa.setStrokeWidth(1.0f);
26 for (int i = 0; i < 15; i++)
27 {
28 for (int j = 0; j < 10; j++)
29 {
30 SkAutoCanvasRestore acs(canvas, true);
31
32 canvas->translate(i * 15.f, j * 20.f);
33 canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 15),pa);
34 canvas->drawPath(SkPathBuilder().moveTo(6, 6)
35 .cubicTo(14, 10, 13, 12, 10, 12)
36 .cubicTo(7, 15, 8, 17, 14, 18)
37 .detach(), pa);
38 }
39 }
40}
#define SkIntToScalar(x)
Definition: SkScalar.h:57
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
static SkPath Oval(const SkRect &, SkPathDirection=SkPathDirection::kCW)
Definition: SkPath.cpp:3590
DEF_SIMPLE_GM(bug5252, canvas, 500, 500)
Definition: bug5252.cpp:15
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