Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
strokefill.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2011 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"
11#include "include/core/SkFont.h"
14#include "include/core/SkPath.h"
15#include "include/core/SkRect.h"
20#include "src/core/SkPathPriv.h"
22#include "tools/ToolUtils.h"
23
24DEF_SIMPLE_GM(bug339297, canvas, 640, 480) {
25 SkPath path;
26 path.moveTo(-469515, -10354890);
27 path.cubicTo(771919.62f, -10411179, 2013360.1f, -10243774, 3195542.8f, -9860664);
28 path.lineTo(3195550, -9860655);
29 path.lineTo(3195539, -9860652);
30 path.lineTo(3195539, -9860652);
31 path.lineTo(3195539, -9860652);
32 path.cubicTo(2013358.1f, -10243761, 771919.25f, -10411166, -469513.84f, -10354877);
33 path.lineTo(-469515, -10354890);
34 path.close();
35
36 canvas->translate(258, 10365663);
37
39 paint.setAntiAlias(true);
40 paint.setColor(SK_ColorBLACK);
42 canvas->drawPath(path, paint);
43
44 paint.setColor(SK_ColorRED);
46 paint.setStrokeWidth(1);
47 canvas->drawPath(path, paint);
48}
49
50DEF_SIMPLE_GM(bug339297_as_clip, canvas, 640, 480) {
51 SkPath path;
52 path.moveTo(-469515, -10354890);
53 path.cubicTo(771919.62f, -10411179, 2013360.1f, -10243774, 3195542.8f, -9860664);
54 path.lineTo(3195550, -9860655);
55 path.lineTo(3195539, -9860652);
56 path.lineTo(3195539, -9860652);
57 path.lineTo(3195539, -9860652);
58 path.cubicTo(2013358.1f, -10243761, 771919.25f, -10411166, -469513.84f, -10354877);
59 path.lineTo(-469515, -10354890);
60 path.close();
61
62 canvas->translate(258, 10365663);
63
64 canvas->save();
65 canvas->clipPath(path, true);
66 canvas->clear(SK_ColorBLACK);
67 canvas->restore();
68
70 paint.setAntiAlias(true);
72 paint.setColor(SK_ColorRED);
74 paint.setStrokeWidth(1);
75 canvas->drawPath(path, paint);
76}
77
78DEF_SIMPLE_GM(bug6987, canvas, 200, 200) {
81 paint.setStrokeWidth(0.0001f);
82 paint.setAntiAlias(true);
83 SkPath path;
84 canvas->save();
85 canvas->scale(50000.0f, 50000.0f);
86 path.moveTo(0.0005f, 0.0004f);
87 path.lineTo(0.0008f, 0.0010f);
88 path.lineTo(0.0002f, 0.0010f);
89 path.close();
90 canvas->drawPath(path, paint);
91 canvas->restore();
92}
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
@ kFill_Style
set to fill geometry
Definition SkPaint.h:193
const Paint & paint
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition gm.h:50