Flutter Engine
The Flutter Engine
dl_sk_conversions.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_DISPLAY_LIST_SKIA_DL_SK_CONVERSIONS_H_
6#define FLUTTER_DISPLAY_LIST_SKIA_DL_SK_CONVERSIONS_H_
7
8#include "flutter/display_list/dl_op_receiver.h"
9#include "flutter/display_list/skia/dl_sk_types.h"
10
11namespace flutter {
12
16
18 return static_cast<SkBlendMode>(mode);
19}
20
22 // This is safe because both SkColor and DlColor are backed by ARGB uint32_t.
23 // See dl_sk_conversions_unittests.cc.
24 return reinterpret_cast<SkColor&>(color);
25}
26
28 return static_cast<SkPaint::Style>(style);
29}
30
32 return static_cast<SkPaint::Cap>(cap);
33}
34
36 return static_cast<SkPaint::Join>(join);
37}
38
39inline SkTileMode ToSk(DlTileMode dl_mode) {
40 return static_cast<SkTileMode>(dl_mode);
41}
42
43inline SkBlurStyle ToSk(const DlBlurStyle blur_style) {
44 return static_cast<SkBlurStyle>(blur_style);
45}
46
47inline SkFilterMode ToSk(const DlFilterMode filter_mode) {
48 return static_cast<SkFilterMode>(filter_mode);
49}
50
52 return static_cast<SkVertices::VertexMode>(dl_mode);
53}
54
56 switch (sampling) {
58 return SkSamplingOptions(SkCubicResampler{1 / 3.0f, 1 / 3.0f});
65 }
66}
67
69 DlCanvas::SrcRectConstraint constraint) {
70 return static_cast<SkCanvas::SrcRectConstraint>(constraint);
71}
72
74 return static_cast<SkClipOp>(op);
75}
76
78 return static_cast<SkCanvas::PointMode>(mode);
79}
80
81extern sk_sp<SkShader> ToSk(const DlColorSource* source);
83 const std::shared_ptr<const DlColorSource>& source) {
84 return ToSk(source.get());
85}
87 return ToSk(&source);
88}
89
90extern sk_sp<SkImageFilter> ToSk(const DlImageFilter* filter);
92 const std::shared_ptr<const DlImageFilter>& filter) {
93 return ToSk(filter.get());
94}
96 return ToSk(&filter);
97}
98
99extern sk_sp<SkColorFilter> ToSk(const DlColorFilter* filter);
101 const std::shared_ptr<const DlColorFilter>& filter) {
102 return ToSk(filter.get());
103}
105 return ToSk(&filter);
106}
107
108extern sk_sp<SkMaskFilter> ToSk(const DlMaskFilter* filter);
110 const std::shared_ptr<const DlMaskFilter>& filter) {
111 return ToSk(filter.get());
112}
113inline sk_sp<SkMaskFilter> ToSk(const DlMaskFilter& filter) {
114 return ToSk(&filter);
115}
116
117extern sk_sp<SkVertices> ToSk(const DlVertices* vertices);
119 const std::shared_ptr<const DlVertices>& vertices) {
120 return ToSk(vertices.get());
121}
122inline sk_sp<SkVertices> ToSk(const DlVertices& vertices) {
123 return ToSk(&vertices);
124}
125
126} // namespace flutter
127
128#endif // FLUTTER_DISPLAY_LIST_SKIA_DL_SK_CONVERSIONS_H_
SkBlendMode
Definition: SkBlendMode.h:38
SkBlurStyle
Definition: SkBlurTypes.h:11
SkClipOp
Definition: SkClipOp.h:13
uint32_t SkColor
Definition: SkColor.h:37
SkFilterMode
SkTileMode
Definition: SkTileMode.h:13
SrcRectConstraint
Definition: SkCanvas.h:1541
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
Definition: dl_vertices.h:71
const Paint & paint
Definition: color_source.cc:38
DlColor color
SkBitmap source
Definition: examples.cpp:28
SkSamplingOptions sampling
Definition: SkRecords.h:337
SkPaint ToSk(const DlPaint &paint)
DlStrokeJoin
Definition: dl_paint.h:37
DlStrokeCap
Definition: dl_paint.h:28
SkPaint ToStrokedSk(const DlPaint &paint)
DlVertexMode
Defines the way in which the vertices of a DlVertices object are separated into triangles into which ...
Definition: dl_vertices.h:20
SkPaint ToNonShaderSk(const DlPaint &paint)
DlDrawStyle
Definition: dl_paint.h:19
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
SkSamplingOptions(SkFilterMode::kLinear))
flutter::DlPaint DlPaint
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741