Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
flutter::DlSkCanvasDispatcher Class Reference

Backend implementation of |DlOpReceiver| for |SkCanvas|. More...

#include <dl_sk_dispatcher.h>

Inheritance diagram for flutter::DlSkCanvasDispatcher:
flutter::DlOpReceiver flutter::DlSkPaintDispatchHelper flutter::DlOpReceiver

Public Member Functions

 DlSkCanvasDispatcher (SkCanvas *canvas, SkScalar opacity=SK_Scalar1)
 
const SkPaintsafe_paint (bool use_attributes)
 
void save () override
 
void restore () override
 
void saveLayer (const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop) override
 
void translate (SkScalar tx, SkScalar ty) override
 
void scale (SkScalar sx, SkScalar sy) override
 
void rotate (SkScalar degrees) override
 
void skew (SkScalar sx, SkScalar sy) override
 
void transform2DAffine (SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
 
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
 
void transformReset () override
 
void clipRect (const SkRect &rect, ClipOp clip_op, bool is_aa) override
 
void clipRRect (const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
 
void clipPath (const SkPath &path, ClipOp clip_op, bool is_aa) override
 
void drawPaint () override
 
void drawColor (DlColor color, DlBlendMode mode) override
 
void drawLine (const SkPoint &p0, const SkPoint &p1) override
 
void drawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length) override
 
void drawRect (const SkRect &rect) override
 
void drawOval (const SkRect &bounds) override
 
void drawCircle (const SkPoint &center, SkScalar radius) override
 
void drawRRect (const SkRRect &rrect) override
 
void drawDRRect (const SkRRect &outer, const SkRRect &inner) override
 
void drawPath (const SkPath &path) override
 
void drawArc (const SkRect &bounds, SkScalar start, SkScalar sweep, bool useCenter) override
 
void drawPoints (PointMode mode, uint32_t count, const SkPoint pts[]) override
 
void drawVertices (const DlVertices *vertices, DlBlendMode mode) override
 
void drawImage (const sk_sp< DlImage > image, const SkPoint point, DlImageSampling sampling, bool render_with_attributes) override
 
void drawImageRect (const sk_sp< DlImage > image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
 
void drawImageNine (const sk_sp< DlImage > image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, bool render_with_attributes) override
 
void drawAtlas (const sk_sp< DlImage > atlas, const SkRSXform xform[], const SkRect tex[], const DlColor colors[], int count, DlBlendMode mode, DlImageSampling sampling, const SkRect *cullRect, bool render_with_attributes) override
 
void drawDisplayList (const sk_sp< DisplayList > display_list, SkScalar opacity) override
 
void drawTextBlob (const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
 
void drawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
 
void drawShadow (const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
 
- Public Member Functions inherited from flutter::DlOpReceiver
virtual bool PrefersImpellerPaths () const
 
virtual void clipPath (const CacheablePath &cache, ClipOp clip_op, bool is_aa)
 
virtual void drawPath (const CacheablePath &cache)
 
virtual void drawShadow (const CacheablePath &cache, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr)
 
virtual void setAntiAlias (bool aa)=0
 
virtual void setDrawStyle (DlDrawStyle style)=0
 
virtual void setColor (DlColor color)=0
 
virtual void setStrokeWidth (float width)=0
 
virtual void setStrokeMiter (float limit)=0
 
virtual void setStrokeCap (DlStrokeCap cap)=0
 
virtual void setStrokeJoin (DlStrokeJoin join)=0
 
virtual void setColorSource (const DlColorSource *source)=0
 
virtual void setColorFilter (const DlColorFilter *filter)=0
 
virtual void setInvertColors (bool invert)=0
 
virtual void setBlendMode (DlBlendMode mode)=0
 
virtual void setMaskFilter (const DlMaskFilter *filter)=0
 
virtual void setImageFilter (const DlImageFilter *filter)=0
 
virtual void save ()=0
 
virtual void save (uint32_t total_content_depth)
 
virtual void saveLayer (const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop=nullptr)=0
 
virtual void saveLayer (const SkRect &bounds, const SaveLayerOptions &options, uint32_t total_content_depth, DlBlendMode max_content_blend_mode, const DlImageFilter *backdrop=nullptr)
 
virtual void restore ()=0
 
virtual void saveLayer (const SkRect *bounds, const SaveLayerOptions options, const DlImageFilter *backdrop=nullptr) final
 
virtual void translate (SkScalar tx, SkScalar ty)=0
 
virtual void scale (SkScalar sx, SkScalar sy)=0
 
virtual void rotate (SkScalar degrees)=0
 
virtual void skew (SkScalar sx, SkScalar sy)=0
 
virtual void transform2DAffine (SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt)=0
 
virtual 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)=0
 
virtual void transformReset ()=0
 
virtual void clipRect (const SkRect &rect, ClipOp clip_op, bool is_aa)=0
 
virtual void clipRRect (const SkRRect &rrect, ClipOp clip_op, bool is_aa)=0
 
virtual void clipPath (const SkPath &path, ClipOp clip_op, bool is_aa)=0
 
virtual void drawColor (DlColor color, DlBlendMode mode)=0
 
virtual void drawPaint ()=0
 
virtual void drawLine (const SkPoint &p0, const SkPoint &p1)=0
 
virtual void drawDashedLine (const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length)=0
 
virtual void drawRect (const SkRect &rect)=0
 
virtual void drawOval (const SkRect &bounds)=0
 
virtual void drawCircle (const SkPoint &center, SkScalar radius)=0
 
virtual void drawRRect (const SkRRect &rrect)=0
 
virtual void drawDRRect (const SkRRect &outer, const SkRRect &inner)=0
 
virtual void drawPath (const SkPath &path)=0
 
virtual void drawArc (const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center)=0
 
virtual void drawPoints (PointMode mode, uint32_t count, const SkPoint points[])=0
 
virtual void drawVertices (const DlVertices *vertices, DlBlendMode mode)=0
 
virtual void drawImage (const sk_sp< DlImage > image, const SkPoint point, DlImageSampling sampling, bool render_with_attributes)=0
 
virtual void drawImageRect (const sk_sp< DlImage > image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint=SrcRectConstraint::kFast)=0
 
virtual void drawImageNine (const sk_sp< DlImage > image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, bool render_with_attributes)=0
 
virtual void drawAtlas (const sk_sp< DlImage > atlas, const SkRSXform xform[], const SkRect tex[], const DlColor colors[], int count, DlBlendMode mode, DlImageSampling sampling, const SkRect *cull_rect, bool render_with_attributes)=0
 
virtual void drawDisplayList (const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1)=0
 
virtual void drawTextBlob (const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y)=0
 
virtual void drawTextFrame (const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y)=0
 
virtual void drawShadow (const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr)=0
 
- Public Member Functions inherited from flutter::DlSkPaintDispatchHelper
 DlSkPaintDispatchHelper (SkScalar opacity=SK_Scalar1)
 
void setAntiAlias (bool aa) override
 
void setDrawStyle (DlDrawStyle style) override
 
void setColor (DlColor color) override
 
void setStrokeWidth (SkScalar width) override
 
void setStrokeMiter (SkScalar limit) override
 
void setStrokeCap (DlStrokeCap cap) override
 
void setStrokeJoin (DlStrokeJoin join) override
 
void setColorSource (const DlColorSource *source) override
 
void setColorFilter (const DlColorFilter *filter) override
 
void setInvertColors (bool invert) override
 
void setBlendMode (DlBlendMode mode) override
 
void setMaskFilter (const DlMaskFilter *filter) override
 
void setImageFilter (const DlImageFilter *filter) override
 
const SkPaintpaint (bool uses_shader=true)
 
SkScalar opacity ()
 
SkScalar combined_opacity ()
 
bool has_opacity ()
 

Static Public Member Functions

static void DrawShadow (SkCanvas *canvas, const SkPath &path, DlColor color, float elevation, bool transparentOccluder, SkScalar dpr)
 

Additional Inherited Members

- Static Public Attributes inherited from flutter::DlOpReceiver
static constexpr int kMaxDrawPointsCount = ((1 << 29) - 1)
 
- Protected Types inherited from flutter::DlOpReceiver
using ClipOp = DlCanvas::ClipOp
 
using PointMode = DlCanvas::PointMode
 
using SrcRectConstraint = DlCanvas::SrcRectConstraint
 
- Protected Member Functions inherited from flutter::DlSkPaintDispatchHelper
void save_opacity (SkScalar opacity_for_children)
 
void restore_opacity ()
 

Detailed Description

Backend implementation of |DlOpReceiver| for |SkCanvas|.

See also
DlOpReceiver

Definition at line 20 of file dl_sk_dispatcher.h.

Constructor & Destructor Documentation

◆ DlSkCanvasDispatcher()

flutter::DlSkCanvasDispatcher::DlSkCanvasDispatcher ( SkCanvas canvas,
SkScalar  opacity = SK_Scalar1 
)
inlineexplicit

Definition at line 23 of file dl_sk_dispatcher.h.

25 canvas_(canvas),
26 original_transform_(canvas->getLocalToDevice()) {}
SkM44 getLocalToDevice() const
Definition: SkCanvas.cpp:1633
DlSkPaintDispatchHelper(SkScalar opacity=SK_Scalar1)

Member Function Documentation

◆ clipPath()

void flutter::DlSkCanvasDispatcher::clipPath ( const SkPath path,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 130 of file dl_sk_dispatcher.cc.

132 {
133 canvas_->clipPath(path, ToSk(clip_op), is_aa);
134}
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1456
SkPaint ToSk(const DlPaint &paint)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ clipRect()

void flutter::DlSkCanvasDispatcher::clipRect ( const SkRect rect,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 120 of file dl_sk_dispatcher.cc.

122 {
123 canvas_->clipRect(rect, ToSk(clip_op), is_aa);
124}
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ clipRRect()

void flutter::DlSkCanvasDispatcher::clipRRect ( const SkRRect rrect,
ClipOp  clip_op,
bool  is_aa 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 125 of file dl_sk_dispatcher.cc.

127 {
128 canvas_->clipRRect(rrect, ToSk(clip_op), is_aa);
129}
void clipRRect(const SkRRect &rrect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1439
SkRRect rrect
Definition: SkRecords.h:232

◆ drawArc()

void flutter::DlSkCanvasDispatcher::drawArc ( const SkRect bounds,
SkScalar  start,
SkScalar  sweep,
bool  useCenter 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 184 of file dl_sk_dispatcher.cc.

187 {
188 canvas_->drawArc(bounds, start, sweep, useCenter, paint());
189}
void drawArc(const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint)
Definition: SkCanvas.cpp:2728
const SkPaint & paint(bool uses_shader=true)
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ drawAtlas()

void flutter::DlSkCanvasDispatcher::drawAtlas ( const sk_sp< DlImage atlas,
const SkRSXform  xform[],
const SkRect  tex[],
const DlColor  colors[],
int  count,
DlBlendMode  mode,
DlImageSampling  sampling,
const SkRect cullRect,
bool  render_with_attributes 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 231 of file dl_sk_dispatcher.cc.

239 {
240 if (!atlas) {
241 return;
242 }
243 auto skia_atlas = atlas->skia_image();
244 if (!skia_atlas) {
245 return;
246 }
247 const SkColor* sk_colors = reinterpret_cast<const SkColor*>(colors);
248 canvas_->drawAtlas(skia_atlas.get(), xform, tex, sk_colors, count, ToSk(mode),
249 ToSk(sampling), cullRect,
250 safe_paint(render_with_attributes));
251}
int count
Definition: FontMgrTest.cpp:50
uint32_t SkColor
Definition: SkColor.h:37
void drawAtlas(const SkImage *atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, SkBlendMode mode, const SkSamplingOptions &sampling, const SkRect *cullRect, const SkPaint *paint)
Definition: SkCanvas.cpp:1810
const SkPaint * safe_paint(bool use_attributes)
sk_sp< const SkImage > atlas
Definition: SkRecords.h:331
PODArray< SkColor > colors
Definition: SkRecords.h:276
SkSamplingOptions sampling
Definition: SkRecords.h:337
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

◆ drawCircle()

void flutter::DlSkCanvasDispatcher::drawCircle ( const SkPoint center,
SkScalar  radius 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 171 of file dl_sk_dispatcher.cc.

171 {
172 canvas_->drawCircle(center, radius, paint());
173}
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707

◆ drawColor()

void flutter::DlSkCanvasDispatcher::drawColor ( DlColor  color,
DlBlendMode  mode 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 146 of file dl_sk_dispatcher.cc.

146 {
147 // SkCanvas::drawColor(SkColor) does the following conversion anyway
148 // We do it here manually to increase precision on applying opacity
149 SkColor4f color4f = SkColor4f::FromColor(ToSk(color));
150 color4f.fA *= opacity();
151 canvas_->drawColor(color4f, ToSk(mode));
152}
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
DlColor color

◆ drawDashedLine()

void flutter::DlSkCanvasDispatcher::drawDashedLine ( const DlPoint p0,
const DlPoint p1,
DlScalar  on_length,
DlScalar  off_length 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 156 of file dl_sk_dispatcher.cc.

159 {
160 SkPaint dash_paint = paint();
161 SkScalar intervals[] = {on_length, off_length};
162 dash_paint.setPathEffect(SkDashPathEffect::Make(intervals, 2, 0.0f));
163 canvas_->drawLine(ToSkPoint(p0), ToSkPoint(p1), dash_paint);
164}
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
Definition: SkCanvas.cpp:2700
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
void setPathEffect(sk_sp< SkPathEffect > pathEffect)
float SkScalar
Definition: extension.cpp:12
const SkPoint & ToSkPoint(const DlPoint &point)

◆ drawDisplayList()

void flutter::DlSkCanvasDispatcher::drawDisplayList ( const sk_sp< DisplayList display_list,
SkScalar  opacity 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 252 of file dl_sk_dispatcher.cc.

254 {
255 const int restore_count = canvas_->getSaveCount();
256
257 // Compute combined opacity and figure out whether we can apply it
258 // during dispatch or if we need a saveLayer.
260 if (combined_opacity < SK_Scalar1 &&
261 !display_list->can_apply_group_opacity()) {
262 TRACE_EVENT0("flutter", "Canvas::saveLayer");
263 canvas_->saveLayerAlphaf(&display_list->bounds(), combined_opacity);
265 } else {
266 canvas_->save();
267 }
268
269 // Create a new CanvasDispatcher to isolate the actions of the
270 // display_list from the current environment.
271 DlSkCanvasDispatcher dispatcher(canvas_, combined_opacity);
272 if (display_list->rtree()) {
273 display_list->Dispatch(dispatcher, canvas_->getLocalClipBounds());
274 } else {
275 display_list->Dispatch(dispatcher);
276 }
277
278 // Restore canvas state to what it was before dispatching.
279 canvas_->restoreToCount(restore_count);
280}
#define SK_Scalar1
Definition: SkScalar.h:18
SkRect getLocalClipBounds() const
Definition: SkCanvas.cpp:1586
int getSaveCount() const
Definition: SkCanvas.cpp:431
void restoreToCount(int saveCount)
Definition: SkCanvas.cpp:478
int save()
Definition: SkCanvas.cpp:447
int saveLayerAlphaf(const SkRect *bounds, float alpha)
Definition: SkCanvas.cpp:1077
DlSkCanvasDispatcher(SkCanvas *canvas, SkScalar opacity=SK_Scalar1)
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:131

◆ drawDRRect()

void flutter::DlSkCanvasDispatcher::drawDRRect ( const SkRRect outer,
const SkRRect inner 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 177 of file dl_sk_dispatcher.cc.

178 {
179 canvas_->drawDRRect(outer, inner, paint());
180}
void drawDRRect(const SkRRect &outer, const SkRRect &inner, const SkPaint &paint)
Definition: SkCanvas.cpp:1645

◆ drawImage()

void flutter::DlSkCanvasDispatcher::drawImage ( const sk_sp< DlImage image,
const SkPoint  point,
DlImageSampling  sampling,
bool  render_with_attributes 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 199 of file dl_sk_dispatcher.cc.

202 {
203 canvas_->drawImage(image ? image->skia_image() : nullptr, point.fX, point.fY,
204 ToSk(sampling), safe_paint(render_with_attributes));
205}
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
sk_sp< const SkImage > image
Definition: SkRecords.h:269
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165

◆ drawImageNine()

void flutter::DlSkCanvasDispatcher::drawImageNine ( const sk_sp< DlImage image,
const SkIRect center,
const SkRect dst,
DlFilterMode  filter,
bool  render_with_attributes 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 216 of file dl_sk_dispatcher.cc.

220 {
221 if (!image) {
222 return;
223 }
224 auto skia_image = image->skia_image();
225 if (!skia_image) {
226 return;
227 }
228 canvas_->drawImageNine(skia_image.get(), center, dst, ToSk(filter),
229 safe_paint(render_with_attributes));
230}
void drawImageNine(const SkImage *image, const SkIRect &center, const SkRect &dst, SkFilterMode filter, const SkPaint *paint=nullptr)
Definition: SkCanvas.cpp:1769
dst
Definition: cp.py:12

◆ drawImageRect()

void flutter::DlSkCanvasDispatcher::drawImageRect ( const sk_sp< DlImage image,
const SkRect src,
const SkRect dst,
DlImageSampling  sampling,
bool  render_with_attributes,
SrcRectConstraint  constraint 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 206 of file dl_sk_dispatcher.cc.

211 {
212 canvas_->drawImageRect(image ? image->skia_image() : nullptr, src, dst,
213 ToSk(sampling), safe_paint(render_with_attributes),
214 ToSk(constraint));
215}
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333

◆ drawLine()

void flutter::DlSkCanvasDispatcher::drawLine ( const SkPoint p0,
const SkPoint p1 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 153 of file dl_sk_dispatcher.cc.

153 {
154 canvas_->drawLine(p0, p1, paint());
155}

◆ drawOval()

void flutter::DlSkCanvasDispatcher::drawOval ( const SkRect bounds)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 168 of file dl_sk_dispatcher.cc.

168 {
169 canvas_->drawOval(bounds, paint());
170}
void drawOval(const SkRect &oval, const SkPaint &paint)
Definition: SkCanvas.cpp:1698

◆ drawPaint()

void flutter::DlSkCanvasDispatcher::drawPaint ( )
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 136 of file dl_sk_dispatcher.cc.

136 {
137 const SkPaint& sk_paint = paint();
138 SkImageFilter* filter = sk_paint.getImageFilter();
139 if (filter && !filter->asColorFilter(nullptr)) {
140 // drawPaint does an implicit saveLayer if an SkImageFilter is
141 // present that cannot be replaced by an SkColorFilter.
142 TRACE_EVENT0("flutter", "Canvas::saveLayer");
143 }
144 canvas_->drawPaint(sk_paint);
145}
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668
bool asColorFilter(SkColorFilter **filterPtr) const
Definition: SkImageFilter.h:67
SkImageFilter * getImageFilter() const
Definition: SkPaint.h:564

◆ drawPath()

void flutter::DlSkCanvasDispatcher::drawPath ( const SkPath path)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 181 of file dl_sk_dispatcher.cc.

181 {
182 canvas_->drawPath(path, paint());
183}
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747

◆ drawPoints()

void flutter::DlSkCanvasDispatcher::drawPoints ( PointMode  mode,
uint32_t  count,
const SkPoint  pts[] 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 190 of file dl_sk_dispatcher.cc.

192 {
193 canvas_->drawPoints(ToSk(mode), count, pts, paint());
194}
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
Definition: SkCanvas.cpp:1710

◆ drawRect()

void flutter::DlSkCanvasDispatcher::drawRect ( const SkRect rect)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 165 of file dl_sk_dispatcher.cc.

165 {
166 canvas_->drawRect(rect, paint());
167}
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673

◆ drawRRect()

void flutter::DlSkCanvasDispatcher::drawRRect ( const SkRRect rrect)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 174 of file dl_sk_dispatcher.cc.

174 {
175 canvas_->drawRRect(rrect, paint());
176}
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
Definition: SkCanvas.cpp:1705

◆ drawShadow()

void flutter::DlSkCanvasDispatcher::drawShadow ( const SkPath path,
const DlColor  color,
const SkScalar  elevation,
bool  transparent_occluder,
SkScalar  dpr 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 320 of file dl_sk_dispatcher.cc.

324 {
325 DrawShadow(canvas_, path, color, elevation, transparent_occluder, dpr);
326}
static void DrawShadow(SkCanvas *canvas, const SkPath &path, DlColor color, float elevation, bool transparentOccluder, SkScalar dpr)

◆ DrawShadow()

void flutter::DlSkCanvasDispatcher::DrawShadow ( SkCanvas canvas,
const SkPath path,
DlColor  color,
float  elevation,
bool  transparentOccluder,
SkScalar  dpr 
)
static

Definition at line 294 of file dl_sk_dispatcher.cc.

299 {
300 const SkScalar kAmbientAlpha = 0.039f;
301 const SkScalar kSpotAlpha = 0.25f;
302
303 uint32_t flags = transparentOccluder
307 SkColor in_ambient =
308 SkColorSetA(ToSk(color), kAmbientAlpha * color.getAlpha());
309 SkColor in_spot = SkColorSetA(ToSk(color), kSpotAlpha * color.getAlpha());
310 SkColor ambient_color, spot_color;
311 SkShadowUtils::ComputeTonalColors(in_ambient, in_spot, &ambient_color,
312 &spot_color);
314 canvas, path, SkPoint3::Make(0, 0, dpr * elevation),
315 SkPoint3::Make(0, -1, 1),
317 ambient_color, spot_color, flags);
318}
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
Definition: SkColor.h:82
@ kDirectionalLight_ShadowFlag
Definition: SkShadowUtils.h:31
@ kTransparentOccluder_ShadowFlag
Definition: SkShadowUtils.h:27
@ kNone_ShadowFlag
Definition: SkShadowUtils.h:24
static void DrawShadow(SkCanvas *canvas, const SkPath &path, const SkPoint3 &zPlaneParams, const SkPoint3 &lightPos, SkScalar lightRadius, SkColor ambientColor, SkColor spotColor, uint32_t flags=SkShadowFlags::kNone_ShadowFlag)
static void ComputeTonalColors(SkColor inAmbientColor, SkColor inSpotColor, SkColor *outAmbientColor, SkColor *outSpotColor)
static constexpr SkScalar kShadowLightRadius
Definition: dl_canvas.h:231
static constexpr SkScalar kShadowLightHeight
Definition: dl_canvas.h:230
FlutterSemanticsFlag flags
static SkPoint3 Make(SkScalar x, SkScalar y, SkScalar z)
Definition: SkPoint3.h:18

◆ drawTextBlob()

void flutter::DlSkCanvasDispatcher::drawTextBlob ( const sk_sp< SkTextBlob blob,
SkScalar  x,
SkScalar  y 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 281 of file dl_sk_dispatcher.cc.

283 {
284 canvas_->drawTextBlob(blob, x, y, paint());
285}
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
Definition: SkCanvas.cpp:2484
double y
double x

◆ drawTextFrame()

void flutter::DlSkCanvasDispatcher::drawTextFrame ( const std::shared_ptr< impeller::TextFrame > &  text_frame,
SkScalar  x,
SkScalar  y 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 287 of file dl_sk_dispatcher.cc.

290 {
291 FML_CHECK(false);
292}
#define FML_CHECK(condition)
Definition: logging.h:85

◆ drawVertices()

void flutter::DlSkCanvasDispatcher::drawVertices ( const DlVertices vertices,
DlBlendMode  mode 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 195 of file dl_sk_dispatcher.cc.

196 {
197 canvas_->drawVertices(ToSk(vertices), ToSk(mode), paint());
198}
void drawVertices(const SkVertices *vertices, SkBlendMode mode, const SkPaint &paint)
Definition: SkCanvas.cpp:1720

◆ restore()

void flutter::DlSkCanvasDispatcher::restore ( )
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 43 of file dl_sk_dispatcher.cc.

43 {
44 canvas_->restore();
46}
void restore()
Definition: SkCanvas.cpp:461

◆ rotate()

void flutter::DlSkCanvasDispatcher::rotate ( SkScalar  degrees)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 86 of file dl_sk_dispatcher.cc.

86 {
87 canvas_->rotate(degrees);
88}
void rotate(SkScalar degrees)
Definition: SkCanvas.cpp:1300

◆ safe_paint()

const SkPaint * flutter::DlSkCanvasDispatcher::safe_paint ( bool  use_attributes)

Definition at line 17 of file dl_sk_dispatcher.cc.

17 {
18 if (use_attributes) {
19 // The accumulated SkPaint object will already have incorporated
20 // any attribute overrides.
21 // Any rendering operation that uses an optional paint will ignore
22 // the shader in the paint so we inform that |paint()| method so
23 // that it can set the dither flag appropriately.
24 return &paint(false);
25 } else if (has_opacity()) {
26 temp_paint_.setAlphaf(opacity());
27 return &temp_paint_;
28 } else {
29 return nullptr;
30 }
31}
void setAlphaf(float a)
Definition: SkPaint.cpp:130

◆ save()

void flutter::DlSkCanvasDispatcher::save ( )
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 33 of file dl_sk_dispatcher.cc.

33 {
34 canvas_->save();
35 // save has no impact on attributes, but it needs to register a record
36 // on the restore stack so that the eventual call to restore() will
37 // know what to do at that time. We could annotate the restore record
38 // with a flag that the record came from a save call, but it is simpler
39 // to just pass in the current opacity value as the value to be used by
40 // the children and let the utility calls notice that it didn't change.
42}
void save_opacity(SkScalar opacity_for_children)

◆ saveLayer()

void flutter::DlSkCanvasDispatcher::saveLayer ( const SkRect bounds,
const SaveLayerOptions  options,
const DlImageFilter backdrop 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 47 of file dl_sk_dispatcher.cc.

49 {
50 if (!options.content_is_clipped() && options.can_distribute_opacity() &&
51 backdrop == nullptr) {
52 // We know that:
53 // - no bounds is needed for clipping here
54 // - no backdrop filter is used to initialize the layer
55 // - the current attributes only have an alpha
56 // - the children are compatible with individually rendering with
57 // an inherited opacity
58 // Therefore we can just use a save instead of a saveLayer and pass the
59 // intended opacity to the children.
60 canvas_->save();
61 // If the saveLayer does not use attributes, the children should continue
62 // to render with the inherited opacity unmodified. If attributes are to
63 // be applied, the children should render with the combination of the
64 // inherited opacity combined with the alpha from the current color.
65 save_opacity(options.renders_with_attributes() ? combined_opacity()
66 : opacity());
67 } else {
68 TRACE_EVENT0("flutter", "Canvas::saveLayer");
69 const SkPaint* paint = safe_paint(options.renders_with_attributes());
70 const sk_sp<SkImageFilter> sk_backdrop = ToSk(backdrop);
71 const SkRect* sl_bounds = options.bounds_from_caller() ? &bounds : nullptr;
72 canvas_->saveLayer(
73 SkCanvas::SaveLayerRec(sl_bounds, paint, sk_backdrop.get(), 0));
74 // saveLayer will apply the current opacity on behalf of the children
75 // so they will inherit an opaque opacity.
77 }
78}
const char * options
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496
T * get() const
Definition: SkRefCnt.h:303
sk_sp< const SkImageFilter > backdrop
Definition: SkRecords.h:191

◆ scale()

void flutter::DlSkCanvasDispatcher::scale ( SkScalar  sx,
SkScalar  sy 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 83 of file dl_sk_dispatcher.cc.

83 {
84 canvas_->scale(sx, sy);
85}
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289

◆ skew()

void flutter::DlSkCanvasDispatcher::skew ( SkScalar  sx,
SkScalar  sy 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 89 of file dl_sk_dispatcher.cc.

89 {
90 canvas_->skew(sx, sy);
91}
void skew(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1312

◆ transform2DAffine()

void flutter::DlSkCanvasDispatcher::transform2DAffine ( SkScalar  mxx,
SkScalar  mxy,
SkScalar  mxt,
SkScalar  myx,
SkScalar  myy,
SkScalar  myt 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 94 of file dl_sk_dispatcher.cc.

96 {
97 // Internally concat(SkMatrix) gets redirected to concat(SkM44)
98 // so we just jump directly to the SkM44 version
99 canvas_->concat(SkM44(mxx, mxy, 0, mxt,
100 myx, myy, 0, myt,
101 0, 0, 1, 0,
102 0, 0, 0, 1));
103}
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
Definition: SkM44.h:150

◆ transformFullPerspective()

void flutter::DlSkCanvasDispatcher::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 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 105 of file dl_sk_dispatcher.cc.

109 {
110 canvas_->concat(SkM44(mxx, mxy, mxz, mxt,
111 myx, myy, myz, myt,
112 mzx, mzy, mzz, mzt,
113 mwx, mwy, mwz, mwt));
114}

◆ transformReset()

void flutter::DlSkCanvasDispatcher::transformReset ( )
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 116 of file dl_sk_dispatcher.cc.

116 {
117 canvas_->setMatrix(original_transform_);
118}
void setMatrix(const SkM44 &matrix)
Definition: SkCanvas.cpp:1349

◆ translate()

void flutter::DlSkCanvasDispatcher::translate ( SkScalar  tx,
SkScalar  ty 
)
overridevirtual

Implements flutter::DlOpReceiver.

Definition at line 80 of file dl_sk_dispatcher.cc.

80 {
81 canvas_->translate(tx, ty);
82}
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278

The documentation for this class was generated from the following files: