| Flutter Impeller |

dl_dispatcher.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_IMPELLER_DISPLAY_LIST_DL_DISPATCHER_H_
6 #define FLUTTER_IMPELLER_DISPLAY_LIST_DL_DISPATCHER_H_
7
8 #include "flutter/display_list/dl_op_receiver.h"
9 #include "impeller/aiks/canvas_type.h"
10 #include "impeller/aiks/paint.h"
11
12 namespace impeller {
13
14 class DlDispatcher final : public flutter::DlOpReceiver {
15 public:
16 DlDispatcher();
17
18 explicit DlDispatcher(Rect cull_rect);
19
20 explicit DlDispatcher(IRect cull_rect);
21
22 ~DlDispatcher();
23
24 Picture EndRecordingAsPicture();
25
26 // |flutter::DlOpReceiver|
27 bool PrefersImpellerPaths() const override { return true; }
28
29 // |flutter::DlOpReceiver|
30 void setAntiAlias(bool aa) override;
31
32 // |flutter::DlOpReceiver|
33 void setDrawStyle(flutter::DlDrawStyle style) override;
34
35 // |flutter::DlOpReceiver|
36 void setColor(flutter::DlColor color) override;
37
38 // |flutter::DlOpReceiver|
39 void setStrokeWidth(SkScalar width) override;
40
41 // |flutter::DlOpReceiver|
42 void setStrokeMiter(SkScalar limit) override;
43
44 // |flutter::DlOpReceiver|
45 void setStrokeCap(flutter::DlStrokeCap cap) override;
46
47 // |flutter::DlOpReceiver|
48 void setStrokeJoin(flutter::DlStrokeJoin join) override;
49
50 // |flutter::DlOpReceiver|
51 void setColorSource(const flutter::DlColorSource* source) override;
52
53 // |flutter::DlOpReceiver|
54 void setColorFilter(const flutter::DlColorFilter* filter) override;
55
56 // |flutter::DlOpReceiver|
57 void setInvertColors(bool invert) override;
58
59 // |flutter::DlOpReceiver|
60 void setBlendMode(flutter::DlBlendMode mode) override;
61
62 // |flutter::DlOpReceiver|
63 void setPathEffect(const flutter::DlPathEffect* effect) override;
64
65 // |flutter::DlOpReceiver|
66 void setMaskFilter(const flutter::DlMaskFilter* filter) override;
67
68 // |flutter::DlOpReceiver|
69 void setImageFilter(const flutter::DlImageFilter* filter) override;
70
71 // |flutter::DlOpReceiver|
72 void save() override;
73
74 // |flutter::DlOpReceiver|
75 void saveLayer(const SkRect& bounds,
76 const flutter::SaveLayerOptions options,
77 const flutter::DlImageFilter* backdrop) override;
78
79 // |flutter::DlOpReceiver|
80 void restore() override;
81
82 // |flutter::DlOpReceiver|
83 void translate(SkScalar tx, SkScalar ty) override;
84
85 // |flutter::DlOpReceiver|
86 void scale(SkScalar sx, SkScalar sy) override;
87
88 // |flutter::DlOpReceiver|
89 void rotate(SkScalar degrees) override;
90
91 // |flutter::DlOpReceiver|
92 void skew(SkScalar sx, SkScalar sy) override;
93
94 // |flutter::DlOpReceiver|
95 void transform2DAffine(SkScalar mxx,
96 SkScalar mxy,
97 SkScalar mxt,
98 SkScalar myx,
99 SkScalar myy,
100 SkScalar myt) override;
101
102 // |flutter::DlOpReceiver|
103 void transformFullPerspective(SkScalar mxx,
104 SkScalar mxy,
105 SkScalar mxz,
106 SkScalar mxt,
107 SkScalar myx,
108 SkScalar myy,
109 SkScalar myz,
110 SkScalar myt,
111 SkScalar mzx,
112 SkScalar mzy,
113 SkScalar mzz,
114 SkScalar mzt,
115 SkScalar mwx,
116 SkScalar mwy,
117 SkScalar mwz,
118 SkScalar mwt) override;
119
120 // |flutter::DlOpReceiver|
121 void transformReset() override;
122
123 // |flutter::DlOpReceiver|
124 void clipRect(const SkRect& rect, ClipOp clip_op, bool is_aa) override;
125
126 // |flutter::DlOpReceiver|
127 void clipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override;
128
129 // |flutter::DlOpReceiver|
130 void clipPath(const SkPath& path, ClipOp clip_op, bool is_aa) override;
131
132 // |flutter::DlOpReceiver|
133 void clipPath(const CacheablePath& cache,
134 ClipOp clip_op,
135 bool is_aa) override;
136
137 // |flutter::DlOpReceiver|
138 void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override;
139
140 // |flutter::DlOpReceiver|
141 void drawPaint() override;
142
143 // |flutter::DlOpReceiver|
144 void drawLine(const SkPoint& p0, const SkPoint& p1) override;
145
146 // |flutter::DlOpReceiver|
147 void drawRect(const SkRect& rect) override;
148
149 // |flutter::DlOpReceiver|
150 void drawOval(const SkRect& bounds) override;
151
152 // |flutter::DlOpReceiver|
153 void drawCircle(const SkPoint& center, SkScalar radius) override;
154
155 // |flutter::DlOpReceiver|
156 void drawRRect(const SkRRect& rrect) override;
157
158 // |flutter::DlOpReceiver|
159 void drawDRRect(const SkRRect& outer, const SkRRect& inner) override;
160
161 // |flutter::DlOpReceiver|
162 void drawPath(const SkPath& path) override;
163
164 // |flutter::DlOpReceiver|
165 void drawPath(const CacheablePath& cache) override;
166
167 // |flutter::DlOpReceiver|
168 void drawArc(const SkRect& oval_bounds,
169 SkScalar start_degrees,
170 SkScalar sweep_degrees,
171 bool use_center) override;
172
173 // |flutter::DlOpReceiver|
174 void drawPoints(PointMode mode,
175 uint32_t count,
176 const SkPoint points[]) override;
177
178 // |flutter::DlOpReceiver|
179 void drawVertices(const flutter::DlVertices* vertices,
180 flutter::DlBlendMode dl_mode) override;
181
182 // |flutter::DlOpReceiver|
183 void drawImage(const sk_sp<flutter::DlImage> image,
184 const SkPoint point,
185 flutter::DlImageSampling sampling,
186 bool render_with_attributes) override;
187
188 // |flutter::DlOpReceiver|
189 void drawImageRect(const sk_sp<flutter::DlImage> image,
190 const SkRect& src,
191 const SkRect& dst,
192 flutter::DlImageSampling sampling,
193 bool render_with_attributes,
194 SrcRectConstraint constraint) override;
195
196 // |flutter::DlOpReceiver|
197 void drawImageNine(const sk_sp<flutter::DlImage> image,
198 const SkIRect& center,
199 const SkRect& dst,
200 flutter::DlFilterMode filter,
201 bool render_with_attributes) override;
202
203 // |flutter::DlOpReceiver|
204 void drawAtlas(const sk_sp<flutter::DlImage> atlas,
205 const SkRSXform xform[],
206 const SkRect tex[],
207 const flutter::DlColor colors[],
208 int count,
209 flutter::DlBlendMode mode,
210 flutter::DlImageSampling sampling,
211 const SkRect* cull_rect,
212 bool render_with_attributes) override;
213
214 // |flutter::DlOpReceiver|
215 void drawDisplayList(const sk_sp<flutter::DisplayList> display_list,
216 SkScalar opacity) override;
217
218 // |flutter::DlOpReceiver|
219 void drawTextBlob(const sk_sp<SkTextBlob> blob,
220 SkScalar x,
221 SkScalar y) override;
222
223 // |flutter::DlOpReceiver|
224 void drawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
225 SkScalar x,
226 SkScalar y) override;
227
228 // |flutter::DlOpReceiver|
229 void drawShadow(const SkPath& path,
230 const flutter::DlColor color,
231 const SkScalar elevation,
232 bool transparent_occluder,
233 SkScalar dpr) override;
234
235 // |flutter::DlOpReceiver|
236 void drawShadow(const CacheablePath& cache,
237 const flutter::DlColor color,
238 const SkScalar elevation,
239 bool transparent_occluder,
240 SkScalar dpr) override;
241
242 private:
243 Paint paint_;
244 CanvasType canvas_;
245 Matrix initial_matrix_;
246
247 static const Path& GetOrCachePath(const CacheablePath& cache);
248
249 static void SimplifyOrDrawPath(CanvasType& canvas,
250 const CacheablePath& cache,
251 const Paint& paint);
252
253 DlDispatcher(const DlDispatcher&) = delete;
254
255 DlDispatcher& operator=(const DlDispatcher&) = delete;
256 };
257
258 } // namespace impeller
259
260 #endif // FLUTTER_IMPELLER_DISPLAY_LIST_DL_DISPATCHER_H_
impeller::DlDispatcher::setBlendMode
void setBlendMode(flutter::DlBlendMode mode) override
Definition: dl_dispatcher.cc:482
impeller::DlDispatcher::drawTextBlob
void drawTextBlob(const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
Definition: dl_dispatcher.cc:1064
impeller::DlDispatcher::save
void save() override
Definition: dl_dispatcher.cc:621
impeller::DlDispatcher::drawOval
void drawOval(const SkRect &bounds) override
Definition: dl_dispatcher.cc:807
impeller::DlDispatcher::DlDispatcher
DlDispatcher()
impeller::DlDispatcher::drawImageRect
void drawImageRect(const sk_sp< flutter::DlImage > image, const SkRect &src, const SkRect &dst, flutter::DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
Definition: dl_dispatcher.cc:956
impeller::DlDispatcher::scale
void scale(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:648
impeller::DlDispatcher
Definition: dl_dispatcher.h:14
impeller::Paint
Definition: paint.h:23
impeller::DlDispatcher::drawRRect
void drawRRect(const SkRRect &rrect) override
Definition: dl_dispatcher.cc:817
impeller::DlDispatcher::clipRRect
void clipRRect(const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:731
impeller::DlDispatcher::drawArc
void drawArc(const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
Definition: dl_dispatcher.cc:873
impeller::DlDispatcher::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: dl_dispatcher.cc:1149
impeller::DlDispatcher::drawPaint
void drawPaint() override
Definition: dl_dispatcher.cc:791
impeller::DlDispatcher::setStrokeJoin
void setStrokeJoin(flutter::DlStrokeJoin join) override
Definition: dl_dispatcher.cc:236
impeller::Canvas
Definition: canvas.h:58
impeller::DlDispatcher::setImageFilter
void setImageFilter(const flutter::DlImageFilter *filter) override
Definition: dl_dispatcher.cc:616
impeller::DlDispatcher::transform2DAffine
void transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
Definition: dl_dispatcher.cc:663
impeller::DlDispatcher::transformFullPerspective
void transformFullPerspective(SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
Definition: dl_dispatcher.cc:680
impeller::DlDispatcher::drawRect
void drawRect(const SkRect &rect) override
Definition: dl_dispatcher.cc:802
impeller::DlDispatcher::drawLine
void drawLine(const SkPoint &p0, const SkPoint &p1) override
Definition: dl_dispatcher.cc:796
impeller::DlDispatcher::drawColor
void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override
Definition: dl_dispatcher.cc:782
impeller::DlDispatcher::drawImage
void drawImage(const sk_sp< flutter::DlImage > image, const SkPoint point, flutter::DlImageSampling sampling, bool render_with_attributes) override
Definition: dl_dispatcher.cc:928
impeller::DlDispatcher::~DlDispatcher
~DlDispatcher()
impeller::DlDispatcher::restore
void restore() override
Definition: dl_dispatcher.cc:638
impeller::DlDispatcher::drawPath
void drawPath(const SkPath &path) override
Definition: dl_dispatcher.cc:835
impeller::DlDispatcher::clipRect
void clipRect(const SkRect &rect, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:726
impeller::DlDispatcher::drawDisplayList
void drawDisplayList(const sk_sp< flutter::DisplayList > display_list, SkScalar opacity) override
Definition: dl_dispatcher.cc:1005
impeller::DlDispatcher::setStrokeWidth
void setStrokeWidth(SkScalar width) override
Definition: dl_dispatcher.cc:211
impeller::DlDispatcher::setColorFilter
void setColorFilter(const flutter::DlColorFilter *filter) override
Definition: dl_dispatcher.cc:472
impeller::Picture
Definition: picture.h:20
impeller::DlDispatcher::drawImageNine
void drawImageNine(const sk_sp< flutter::DlImage > image, const SkIRect &center, const SkRect &dst, flutter::DlFilterMode filter, bool render_with_attributes) override
Definition: dl_dispatcher.cc:973
impeller::DlDispatcher::saveLayer
void saveLayer(const SkRect &bounds, const flutter::SaveLayerOptions options, const flutter::DlImageFilter *backdrop) override
Definition: dl_dispatcher.cc:626
impeller::DlDispatcher::transformReset
void transformReset() override
Definition: dl_dispatcher.cc:710
impeller::Path
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition: path.h:51
impeller::DlDispatcher::drawDRRect
void drawDRRect(const SkRRect &outer, const SkRRect &inner) override
Definition: dl_dispatcher.cc:827
impeller::DlDispatcher::clipPath
void clipPath(const SkPath &path, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:747
impeller::DlDispatcher::setMaskFilter
void setMaskFilter(const flutter::DlMaskFilter *filter) override
Definition: dl_dispatcher.cc:506
impeller::DlDispatcher::PrefersImpellerPaths
bool PrefersImpellerPaths() const override
Definition: dl_dispatcher.h:27
impeller::DlDispatcher::drawShadow
void drawShadow(const SkPath &path, const flutter::DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
Definition: dl_dispatcher.cc:1082
impeller::DlDispatcher::setAntiAlias
void setAntiAlias(bool aa) override
Definition: dl_dispatcher.cc:178
impeller::DlDispatcher::setInvertColors
void setInvertColors(bool invert) override
Definition: dl_dispatcher.cc:477
impeller::DlDispatcher::drawVertices
void drawVertices(const flutter::DlVertices *vertices, flutter::DlBlendMode dl_mode) override
Definition: dl_dispatcher.cc:922
impeller::DlDispatcher::setColorSource
void setColorSource(const flutter::DlColorSource *source) override
Definition: dl_dispatcher.cc:286
impeller::DlDispatcher::drawTextFrame
void drawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
Definition: dl_dispatcher.cc:1072
impeller::DlDispatcher::skew
void skew(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:658
impeller::DlDispatcher::setDrawStyle
void setDrawStyle(flutter::DlDrawStyle style) override
Definition: dl_dispatcher.cc:196
impeller::DlDispatcher::setColor
void setColor(flutter::DlColor color) override
Definition: dl_dispatcher.cc:201
paint.h
impeller::DlDispatcher::rotate
void rotate(SkScalar degrees) override
Definition: dl_dispatcher.cc:653
canvas_type.h
impeller::DlDispatcher::setStrokeMiter
void setStrokeMiter(SkScalar limit) override
Definition: dl_dispatcher.cc:216
impeller::DlDispatcher::drawPoints
void drawPoints(PointMode mode, uint32_t count, const SkPoint points[]) override
Definition: dl_dispatcher.cc:884
impeller::DlDispatcher::drawAtlas
void drawAtlas(const sk_sp< flutter::DlImage > atlas, const SkRSXform xform[], const SkRect tex[], const flutter::DlColor colors[], int count, flutter::DlBlendMode mode, flutter::DlImageSampling sampling, const SkRect *cull_rect, bool render_with_attributes) override
Definition: dl_dispatcher.cc:987
impeller
Definition: aiks_blur_unittests.cc:20
impeller::DlDispatcher::translate
void translate(SkScalar tx, SkScalar ty) override
Definition: dl_dispatcher.cc:643
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::DlDispatcher::setStrokeCap
void setStrokeCap(flutter::DlStrokeCap cap) override
Definition: dl_dispatcher.cc:221
impeller::DlDispatcher::setPathEffect
void setPathEffect(const flutter::DlPathEffect *effect) override
Definition: dl_dispatcher.cc:487
impeller::DlDispatcher::drawCircle
void drawCircle(const SkPoint &center, SkScalar radius) override
Definition: dl_dispatcher.cc:812