Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
gm
bug9331.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2019 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
"
9
#include "
include/core/SkCanvas.h
"
10
#include "
include/core/SkPathEffect.h
"
11
#include "
include/effects/SkDashPathEffect.h
"
12
13
// Reproduces skbug.com/9331, drawing differently in debug and release builds.
14
DEF_SIMPLE_GM
(bug9331, canvas, 256, 256) {
15
SkRect
clip
= {0, 0, 200, 150};
16
{
17
SkPaint
paint
;
18
paint
.setColor(0x44FF0000);
19
canvas->drawRect(
clip
,
paint
);
20
}
21
22
auto
draw
= [&](
SkColor
color
,
SkRect
clip
) {
23
SkScalar
intervals[] = { 13, 17 };
24
SkScalar
phase = 9;
25
26
SkPaint
paint
;
27
paint
.setColor(
color
);
28
paint
.setStyle(
SkPaint::kStroke_Style
);
29
paint
.setStrokeWidth(10);
30
paint
.setPathEffect(
SkDashPathEffect::Make
(intervals, std::size(intervals), phase));
31
32
canvas->save();
33
canvas->clipRect(
clip
);
34
canvas->drawRect({50,50, 150,150},
paint
);
35
canvas->restore();
36
};
37
38
draw
(0xFF000000,
clip
);
39
draw
(0xFF0000FF,
clip
.makeOffset(0,150));
40
}
color
SkColor4f color
Definition
ImageShaderTest.cpp:28
SkCanvas.h
SkColor
uint32_t SkColor
Definition
SkColor.h:37
SkDashPathEffect.h
SkPathEffect.h
clip
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition
SkPath.cpp:3824
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition
aaclip.cpp:27
SkDashPathEffect::Make
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
Definition
SkDashPathEffect.cpp:409
SkPaint
Definition
SkPaint.h:44
SkPaint::kStroke_Style
@ kStroke_Style
set to stroke geometry
Definition
SkPaint.h:194
paint
const Paint & paint
Definition
color_source.cc:38
SkScalar
float SkScalar
Definition
extension.cpp:12
gm.h
DEF_SIMPLE_GM
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition
gm.h:50
SkRect
Definition
extension.cpp:13
Generated on Fri Apr 26 2024 06:16:00 for Flutter Engine by
1.9.8