| 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 void setAntiAlias(bool aa) override;
28
29 // |flutter::DlOpReceiver|
30 void setDrawStyle(flutter::DlDrawStyle style) override;
31
32 // |flutter::DlOpReceiver|
33 void setColor(flutter::DlColor color) override;
34
35 // |flutter::DlOpReceiver|
36 void setStrokeWidth(SkScalar width) override;
37
38 // |flutter::DlOpReceiver|
39 void setStrokeMiter(SkScalar limit) override;
40
41 // |flutter::DlOpReceiver|
42 void setStrokeCap(flutter::DlStrokeCap cap) override;
43
44 // |flutter::DlOpReceiver|
45 void setStrokeJoin(flutter::DlStrokeJoin join) override;
46
47 // |flutter::DlOpReceiver|
48 void setColorSource(const flutter::DlColorSource* source) override;
49
50 // |flutter::DlOpReceiver|
51 void setColorFilter(const flutter::DlColorFilter* filter) override;
52
53 // |flutter::DlOpReceiver|
54 void setInvertColors(bool invert) override;
55
56 // |flutter::DlOpReceiver|
57 void setBlendMode(flutter::DlBlendMode mode) override;
58
59 // |flutter::DlOpReceiver|
60 void setPathEffect(const flutter::DlPathEffect* effect) override;
61
62 // |flutter::DlOpReceiver|
63 void setMaskFilter(const flutter::DlMaskFilter* filter) override;
64
65 // |flutter::DlOpReceiver|
66 void setImageFilter(const flutter::DlImageFilter* filter) override;
67
68 // |flutter::DlOpReceiver|
69 void save() override;
70
71 // |flutter::DlOpReceiver|
72 void saveLayer(const SkRect* bounds,
73 const flutter::SaveLayerOptions options,
74 const flutter::DlImageFilter* backdrop) override;
75
76 // |flutter::DlOpReceiver|
77 void restore() override;
78
79 // |flutter::DlOpReceiver|
80 void translate(SkScalar tx, SkScalar ty) override;
81
82 // |flutter::DlOpReceiver|
83 void scale(SkScalar sx, SkScalar sy) override;
84
85 // |flutter::DlOpReceiver|
86 void rotate(SkScalar degrees) override;
87
88 // |flutter::DlOpReceiver|
89 void skew(SkScalar sx, SkScalar sy) override;
90
91 // |flutter::DlOpReceiver|
92 void transform2DAffine(SkScalar mxx,
93 SkScalar mxy,
94 SkScalar mxt,
95 SkScalar myx,
96 SkScalar myy,
97 SkScalar myt) override;
98
99 // |flutter::DlOpReceiver|
100 void transformFullPerspective(SkScalar mxx,
101 SkScalar mxy,
102 SkScalar mxz,
103 SkScalar mxt,
104 SkScalar myx,
105 SkScalar myy,
106 SkScalar myz,
107 SkScalar myt,
108 SkScalar mzx,
109 SkScalar mzy,
110 SkScalar mzz,
111 SkScalar mzt,
112 SkScalar mwx,
113 SkScalar mwy,
114 SkScalar mwz,
115 SkScalar mwt) override;
116
117 // |flutter::DlOpReceiver|
118 void transformReset() override;
119
120 // |flutter::DlOpReceiver|
121 void clipRect(const SkRect& rect, ClipOp clip_op, bool is_aa) override;
122
123 // |flutter::DlOpReceiver|
124 void clipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override;
125
126 // |flutter::DlOpReceiver|
127 void clipPath(const SkPath& path, ClipOp clip_op, bool is_aa) override;
128
129 // |flutter::DlOpReceiver|
130 void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override;
131
132 // |flutter::DlOpReceiver|
133 void drawPaint() override;
134
135 // |flutter::DlOpReceiver|
136 void drawLine(const SkPoint& p0, const SkPoint& p1) override;
137
138 // |flutter::DlOpReceiver|
139 void drawRect(const SkRect& rect) override;
140
141 // |flutter::DlOpReceiver|
142 void drawOval(const SkRect& bounds) override;
143
144 // |flutter::DlOpReceiver|
145 void drawCircle(const SkPoint& center, SkScalar radius) override;
146
147 // |flutter::DlOpReceiver|
148 void drawRRect(const SkRRect& rrect) override;
149
150 // |flutter::DlOpReceiver|
151 void drawDRRect(const SkRRect& outer, const SkRRect& inner) override;
152
153 // |flutter::DlOpReceiver|
154 void drawPath(const SkPath& path) override;
155
156 // |flutter::DlOpReceiver|
157 void drawArc(const SkRect& oval_bounds,
158 SkScalar start_degrees,
159 SkScalar sweep_degrees,
160 bool use_center) override;
161
162 // |flutter::DlOpReceiver|
163 void drawPoints(PointMode mode,
164 uint32_t count,
165 const SkPoint points[]) override;
166
167 // |flutter::DlOpReceiver|
168 void drawVertices(const flutter::DlVertices* vertices,
169 flutter::DlBlendMode dl_mode) override;
170
171 // |flutter::DlOpReceiver|
172 void drawImage(const sk_sp<flutter::DlImage> image,
173 const SkPoint point,
174 flutter::DlImageSampling sampling,
175 bool render_with_attributes) override;
176
177 // |flutter::DlOpReceiver|
178 void drawImageRect(const sk_sp<flutter::DlImage> image,
179 const SkRect& src,
180 const SkRect& dst,
181 flutter::DlImageSampling sampling,
182 bool render_with_attributes,
183 SrcRectConstraint constraint) override;
184
185 // |flutter::DlOpReceiver|
186 void drawImageNine(const sk_sp<flutter::DlImage> image,
187 const SkIRect& center,
188 const SkRect& dst,
189 flutter::DlFilterMode filter,
190 bool render_with_attributes) override;
191
192 // |flutter::DlOpReceiver|
193 void drawAtlas(const sk_sp<flutter::DlImage> atlas,
194 const SkRSXform xform[],
195 const SkRect tex[],
196 const flutter::DlColor colors[],
197 int count,
198 flutter::DlBlendMode mode,
199 flutter::DlImageSampling sampling,
200 const SkRect* cull_rect,
201 bool render_with_attributes) override;
202
203 // |flutter::DlOpReceiver|
204 void drawDisplayList(const sk_sp<flutter::DisplayList> display_list,
205 SkScalar opacity) override;
206
207 // |flutter::DlOpReceiver|
208 void drawTextBlob(const sk_sp<SkTextBlob> blob,
209 SkScalar x,
210 SkScalar y) override;
211
212 // |flutter::DlOpReceiver|
213 void drawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
214 SkScalar x,
215 SkScalar y) override;
216
217 // |flutter::DlOpReceiver|
218 void drawShadow(const SkPath& path,
219 const flutter::DlColor color,
220 const SkScalar elevation,
221 bool transparent_occluder,
222 SkScalar dpr) override;
223
224 private:
225 Paint paint_;
226 CanvasType canvas_;
227 Matrix initial_matrix_;
228
229 static void SimplifyOrDrawPath(CanvasType& canvas,
230 const SkPath& path,
231 const Paint& paint);
232
233 DlDispatcher(const DlDispatcher&) = delete;
234
235 DlDispatcher& operator=(const DlDispatcher&) = delete;
236 };
237
238 } // namespace impeller
239
240 #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:1042
impeller::DlDispatcher::save
void save() override
Definition: dl_dispatcher.cc:621
impeller::DlDispatcher::drawOval
void drawOval(const SkRect &bounds) override
Definition: dl_dispatcher.cc:790
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:934
impeller::DlDispatcher::scale
void scale(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:645
impeller::DlDispatcher::saveLayer
void saveLayer(const SkRect *bounds, const flutter::SaveLayerOptions options, const flutter::DlImageFilter *backdrop) override
Definition: dl_dispatcher.cc:626
impeller::DlDispatcher
Definition: dl_dispatcher.h:14
impeller::Paint
Definition: paint.h:22
impeller::DlDispatcher::drawRRect
void drawRRect(const SkRRect &rrect) override
Definition: dl_dispatcher.cc:800
impeller::DlDispatcher::clipRRect
void clipRRect(const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:728
impeller::DlDispatcher::drawArc
void drawArc(const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
Definition: dl_dispatcher.cc:851
impeller::DlDispatcher::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: dl_dispatcher.cc:1118
impeller::DlDispatcher::drawPaint
void drawPaint() override
Definition: dl_dispatcher.cc:774
impeller::DlDispatcher::setStrokeJoin
void setStrokeJoin(flutter::DlStrokeJoin join) override
Definition: dl_dispatcher.cc:236
impeller::Canvas
Definition: canvas.h:48
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:660
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:677
impeller::DlDispatcher::drawRect
void drawRect(const SkRect &rect) override
Definition: dl_dispatcher.cc:785
impeller::DlDispatcher::drawLine
void drawLine(const SkPoint &p0, const SkPoint &p1) override
Definition: dl_dispatcher.cc:779
impeller::DlDispatcher::drawColor
void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override
Definition: dl_dispatcher.cc:765
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:906
impeller::DlDispatcher::~DlDispatcher
~DlDispatcher()
impeller::DlDispatcher::restore
void restore() override
Definition: dl_dispatcher.cc:635
impeller::DlDispatcher::drawPath
void drawPath(const SkPath &path) override
Definition: dl_dispatcher.cc:818
impeller::DlDispatcher::clipRect
void clipRect(const SkRect &rect, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:723
impeller::DlDispatcher::drawDisplayList
void drawDisplayList(const sk_sp< flutter::DisplayList > display_list, SkScalar opacity) override
Definition: dl_dispatcher.cc:983
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:951
impeller::DlDispatcher::transformReset
void transformReset() override
Definition: dl_dispatcher.cc:707
impeller::DlDispatcher::drawDRRect
void drawDRRect(const SkRRect &outer, const SkRRect &inner) override
Definition: dl_dispatcher.cc:810
impeller::DlDispatcher::clipPath
void clipPath(const SkPath &path, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:744
impeller::DlDispatcher::setMaskFilter
void setMaskFilter(const flutter::DlMaskFilter *filter) override
Definition: dl_dispatcher.cc:506
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:1060
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:900
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:1050
impeller::DlDispatcher::skew
void skew(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:655
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:650
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:862
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:965
impeller
Definition: aiks_context.cc:10
impeller::DlDispatcher::translate
void translate(SkScalar tx, SkScalar ty) override
Definition: dl_dispatcher.cc:640
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:795