| 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 #pragma once
6
7 #include "flutter/display_list/dl_op_receiver.h"
8 #include "flutter/fml/macros.h"
9 #include "impeller/aiks/canvas.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 setDither(bool dither) 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 drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override;
134
135 // |flutter::DlOpReceiver|
136 void drawPaint() override;
137
138 // |flutter::DlOpReceiver|
139 void drawLine(const SkPoint& p0, const SkPoint& p1) override;
140
141 // |flutter::DlOpReceiver|
142 void drawRect(const SkRect& rect) override;
143
144 // |flutter::DlOpReceiver|
145 void drawOval(const SkRect& bounds) override;
146
147 // |flutter::DlOpReceiver|
148 void drawCircle(const SkPoint& center, SkScalar radius) override;
149
150 // |flutter::DlOpReceiver|
151 void drawRRect(const SkRRect& rrect) override;
152
153 // |flutter::DlOpReceiver|
154 void drawDRRect(const SkRRect& outer, const SkRRect& inner) override;
155
156 // |flutter::DlOpReceiver|
157 void drawPath(const SkPath& path) override;
158
159 // |flutter::DlOpReceiver|
160 void drawArc(const SkRect& oval_bounds,
161 SkScalar start_degrees,
162 SkScalar sweep_degrees,
163 bool use_center) override;
164
165 // |flutter::DlOpReceiver|
166 void drawPoints(PointMode mode,
167 uint32_t count,
168 const SkPoint points[]) override;
169
170 // |flutter::DlOpReceiver|
171 void drawVertices(const flutter::DlVertices* vertices,
172 flutter::DlBlendMode dl_mode) override;
173
174 // |flutter::DlOpReceiver|
175 void drawImage(const sk_sp<flutter::DlImage> image,
176 const SkPoint point,
177 flutter::DlImageSampling sampling,
178 bool render_with_attributes) override;
179
180 // |flutter::DlOpReceiver|
181 void drawImageRect(const sk_sp<flutter::DlImage> image,
182 const SkRect& src,
183 const SkRect& dst,
184 flutter::DlImageSampling sampling,
185 bool render_with_attributes,
186 SrcRectConstraint constraint) override;
187
188 // |flutter::DlOpReceiver|
189 void drawImageNine(const sk_sp<flutter::DlImage> image,
190 const SkIRect& center,
191 const SkRect& dst,
192 flutter::DlFilterMode filter,
193 bool render_with_attributes) override;
194
195 // |flutter::DlOpReceiver|
196 void drawAtlas(const sk_sp<flutter::DlImage> atlas,
197 const SkRSXform xform[],
198 const SkRect tex[],
199 const flutter::DlColor colors[],
200 int count,
201 flutter::DlBlendMode mode,
202 flutter::DlImageSampling sampling,
203 const SkRect* cull_rect,
204 bool render_with_attributes) override;
205
206 // |flutter::DlOpReceiver|
207 void drawDisplayList(const sk_sp<flutter::DisplayList> display_list,
208 SkScalar opacity) override;
209
210 // |flutter::DlOpReceiver|
211 void drawTextBlob(const sk_sp<SkTextBlob> blob,
212 SkScalar x,
213 SkScalar y) override;
214
215 // |flutter::DlOpReceiver|
216 void drawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
217 SkScalar x,
218 SkScalar y) override;
219
220 // |flutter::DlOpReceiver|
221 void drawShadow(const SkPath& path,
222 const flutter::DlColor color,
223 const SkScalar elevation,
224 bool transparent_occluder,
225 SkScalar dpr) override;
226
227 private:
228 Paint paint_;
229 Canvas canvas_;
230 Matrix initial_matrix_;
231
232 FML_DISALLOW_COPY_AND_ASSIGN(DlDispatcher);
233 };
234
235 } // namespace impeller
impeller::DlDispatcher::setBlendMode
void setBlendMode(flutter::DlBlendMode mode) override
Definition: dl_dispatcher.cc:496
impeller::DlDispatcher::drawTextBlob
void drawTextBlob(const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
Definition: dl_dispatcher.cc:1046
impeller::DlDispatcher::save
void save() override
Definition: dl_dispatcher.cc:635
impeller::DlDispatcher::drawOval
void drawOval(const SkRect &bounds) override
Definition: dl_dispatcher.cc:788
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:938
impeller::DlDispatcher::scale
void scale(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:659
impeller::DlDispatcher::saveLayer
void saveLayer(const SkRect *bounds, const flutter::SaveLayerOptions options, const flutter::DlImageFilter *backdrop) override
Definition: dl_dispatcher.cc:640
impeller::DlDispatcher
Definition: dl_dispatcher.h:14
impeller::Paint
Definition: paint.h:25
impeller::DlDispatcher::drawRRect
void drawRRect(const SkRRect &rrect) override
Definition: dl_dispatcher.cc:807
impeller::DlDispatcher::clipRRect
void clipRRect(const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:742
impeller::DlDispatcher::drawArc
void drawArc(const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
Definition: dl_dispatcher.cc:853
impeller::DlDispatcher::EndRecordingAsPicture
Picture EndRecordingAsPicture()
Definition: dl_dispatcher.cc:1135
impeller::DlDispatcher::drawPaint
void drawPaint() override
Definition: dl_dispatcher.cc:766
impeller::DlDispatcher::setStrokeJoin
void setStrokeJoin(flutter::DlStrokeJoin join) override
Definition: dl_dispatcher.cc:249
impeller::Canvas
Definition: canvas.h:50
impeller::DlDispatcher::setImageFilter
void setImageFilter(const flutter::DlImageFilter *filter) override
Definition: dl_dispatcher.cc:630
impeller::DlDispatcher::transform2DAffine
void transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
Definition: dl_dispatcher.cc:674
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:691
impeller::DlDispatcher::drawRect
void drawRect(const SkRect &rect) override
Definition: dl_dispatcher.cc:783
impeller::DlDispatcher::drawLine
void drawLine(const SkPoint &p0, const SkPoint &p1) override
Definition: dl_dispatcher.cc:771
impeller::DlDispatcher::drawColor
void drawColor(flutter::DlColor color, flutter::DlBlendMode mode) override
Definition: dl_dispatcher.cc:757
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:910
impeller::DlDispatcher::~DlDispatcher
~DlDispatcher()
impeller::DlDispatcher::restore
void restore() override
Definition: dl_dispatcher.cc:649
impeller::DlDispatcher::drawPath
void drawPath(const SkPath &path) override
Definition: dl_dispatcher.cc:825
impeller::DlDispatcher::clipRect
void clipRect(const SkRect &rect, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:737
impeller::DlDispatcher::drawDisplayList
void drawDisplayList(const sk_sp< flutter::DisplayList > display_list, SkScalar opacity) override
Definition: dl_dispatcher.cc:987
impeller::DlDispatcher::setStrokeWidth
void setStrokeWidth(SkScalar width) override
Definition: dl_dispatcher.cc:224
impeller::DlDispatcher::setColorFilter
void setColorFilter(const flutter::DlColorFilter *filter) override
Definition: dl_dispatcher.cc:485
impeller::Picture
Definition: picture.h:19
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:955
impeller::DlDispatcher::transformReset
void transformReset() override
Definition: dl_dispatcher.cc:721
impeller::DlDispatcher::setDither
void setDither(bool dither) override
Definition: dl_dispatcher.cc:191
impeller::DlDispatcher::drawDRRect
void drawDRRect(const SkRRect &outer, const SkRRect &inner) override
Definition: dl_dispatcher.cc:817
impeller::DlDispatcher::clipPath
void clipPath(const SkPath &path, ClipOp clip_op, bool is_aa) override
Definition: dl_dispatcher.cc:752
impeller::DlDispatcher::setMaskFilter
void setMaskFilter(const flutter::DlMaskFilter *filter) override
Definition: dl_dispatcher.cc:520
canvas.h
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:1064
impeller::DlDispatcher::setAntiAlias
void setAntiAlias(bool aa) override
Definition: dl_dispatcher.cc:186
impeller::DlDispatcher::setInvertColors
void setInvertColors(bool invert) override
Definition: dl_dispatcher.cc:491
impeller::DlDispatcher::drawVertices
void drawVertices(const flutter::DlVertices *vertices, flutter::DlBlendMode dl_mode) override
Definition: dl_dispatcher.cc:904
impeller::DlDispatcher::setColorSource
void setColorSource(const flutter::DlColorSource *source) override
Definition: dl_dispatcher.cc:299
impeller::DlDispatcher::drawTextFrame
void drawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
Definition: dl_dispatcher.cc:1054
impeller::DlDispatcher::skew
void skew(SkScalar sx, SkScalar sy) override
Definition: dl_dispatcher.cc:669
impeller::DlDispatcher::setDrawStyle
void setDrawStyle(flutter::DlDrawStyle style) override
Definition: dl_dispatcher.cc:209
impeller::DlDispatcher::setColor
void setColor(flutter::DlColor color) override
Definition: dl_dispatcher.cc:214
paint.h
impeller::DlDispatcher::rotate
void rotate(SkScalar degrees) override
Definition: dl_dispatcher.cc:664
impeller::DlDispatcher::setStrokeMiter
void setStrokeMiter(SkScalar limit) override
Definition: dl_dispatcher.cc:229
impeller::DlDispatcher::drawPoints
void drawPoints(PointMode mode, uint32_t count, const SkPoint points[]) override
Definition: dl_dispatcher.cc:864
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:969
impeller
Definition: aiks_context.cc:10
impeller::DlDispatcher::translate
void translate(SkScalar tx, SkScalar ty) override
Definition: dl_dispatcher.cc:654
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:36
impeller::DlDispatcher::setStrokeCap
void setStrokeCap(flutter::DlStrokeCap cap) override
Definition: dl_dispatcher.cc:234
impeller::DlDispatcher::setPathEffect
void setPathEffect(const flutter::DlPathEffect *effect) override
Definition: dl_dispatcher.cc:501
impeller::DlDispatcher::drawCircle
void drawCircle(const SkPoint &center, SkScalar radius) override
Definition: dl_dispatcher.cc:802