Flutter Engine
The Flutter Engine
dl_sk_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_DISPLAY_LIST_SKIA_DL_SK_DISPATCHER_H_
6#define FLUTTER_DISPLAY_LIST_SKIA_DL_SK_DISPATCHER_H_
7
8#include "flutter/display_list/display_list.h"
9#include "flutter/display_list/dl_op_receiver.h"
10#include "flutter/display_list/skia/dl_sk_paint_dispatcher.h"
11#include "flutter/display_list/skia/dl_sk_types.h"
12#include "flutter/fml/macros.h"
13
14namespace flutter {
15
16//------------------------------------------------------------------------------
17/// @brief Backend implementation of |DlOpReceiver| for |SkCanvas|.
18///
19/// @see DlOpReceiver
20class DlSkCanvasDispatcher : public virtual DlOpReceiver,
22 public:
25 canvas_(canvas),
26 original_transform_(canvas->getLocalToDevice()) {}
27
28 const SkPaint* safe_paint(bool use_attributes);
29
30 void save() override;
31 void restore() override;
32 void saveLayer(const SkRect& bounds,
34 const DlImageFilter* backdrop) override;
35
36 void translate(SkScalar tx, SkScalar ty) override;
37 void scale(SkScalar sx, SkScalar sy) override;
38 void rotate(SkScalar degrees) override;
39 void skew(SkScalar sx, SkScalar sy) override;
40 // clang-format off
41 // 2x3 2D affine subset of a 4x4 transform in row major order
43 SkScalar myx, SkScalar myy, SkScalar myt) override;
44 // full 4x4 transform in row major order
46 SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt,
47 SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt,
48 SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt,
49 SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override;
50 // clang-format on
51 void transformReset() override;
52
53 void clipRect(const SkRect& rect, ClipOp clip_op, bool is_aa) override;
54 void clipRRect(const SkRRect& rrect, ClipOp clip_op, bool is_aa) override;
55 void clipPath(const SkPath& path, ClipOp clip_op, bool is_aa) override;
56
57 void drawPaint() override;
58 void drawColor(DlColor color, DlBlendMode mode) override;
59 void drawLine(const SkPoint& p0, const SkPoint& p1) override;
60 void drawDashedLine(const DlPoint& p0,
61 const DlPoint& p1,
62 DlScalar on_length,
63 DlScalar off_length) override;
64 void drawRect(const SkRect& rect) override;
65 void drawOval(const SkRect& bounds) override;
66 void drawCircle(const SkPoint& center, SkScalar radius) override;
67 void drawRRect(const SkRRect& rrect) override;
68 void drawDRRect(const SkRRect& outer, const SkRRect& inner) override;
69 void drawPath(const SkPath& path) override;
70 void drawArc(const SkRect& bounds,
71 SkScalar start,
72 SkScalar sweep,
73 bool useCenter) override;
74 void drawPoints(PointMode mode, uint32_t count, const SkPoint pts[]) override;
75 void drawVertices(const DlVertices* vertices, DlBlendMode mode) override;
77 const SkPoint point,
79 bool render_with_attributes) override;
81 const SkRect& src,
82 const SkRect& dst,
84 bool render_with_attributes,
85 SrcRectConstraint constraint) override;
87 const SkIRect& center,
88 const SkRect& dst,
89 DlFilterMode filter,
90 bool render_with_attributes) override;
92 const SkRSXform xform[],
93 const SkRect tex[],
94 const DlColor colors[],
95 int count,
98 const SkRect* cullRect,
99 bool render_with_attributes) override;
100 void drawDisplayList(const sk_sp<DisplayList> display_list,
101 SkScalar opacity) override;
102 void drawTextBlob(const sk_sp<SkTextBlob> blob,
103 SkScalar x,
104 SkScalar y) override;
105 void drawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
106 SkScalar x,
107 SkScalar y) override;
108 void drawShadow(const SkPath& path,
109 const DlColor color,
110 const SkScalar elevation,
111 bool transparent_occluder,
112 SkScalar dpr) override;
113
114 static void DrawShadow(SkCanvas* canvas,
115 const SkPath& path,
117 float elevation,
118 bool transparentOccluder,
119 SkScalar dpr);
120
121 private:
122 SkCanvas* canvas_;
123 const SkM44 original_transform_;
124 SkPaint temp_paint_;
125};
126
127} // namespace flutter
128
129#endif // FLUTTER_DISPLAY_LIST_SKIA_DL_SK_DISPATCHER_H_
const char * options
int count
Definition: FontMgrTest.cpp:50
#define SK_Scalar1
Definition: SkScalar.h:18
Definition: SkM44.h:150
Definition: SkPath.h:59
Internal API for rendering recorded display lists to backends.
DlCanvas::SrcRectConstraint SrcRectConstraint
DlCanvas::ClipOp ClipOp
DlCanvas::PointMode PointMode
Backend implementation of |DlOpReceiver| for |SkCanvas|.
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 transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
void drawPoints(PointMode mode, uint32_t count, const SkPoint pts[]) override
void drawImageNine(const sk_sp< DlImage > image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, bool render_with_attributes) override
void drawDashedLine(const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length) override
const SkPaint * safe_paint(bool use_attributes)
void drawRRect(const SkRRect &rrect) override
void drawCircle(const SkPoint &center, SkScalar radius) override
void drawPath(const SkPath &path) override
void drawArc(const SkRect &bounds, SkScalar start, SkScalar sweep, bool useCenter) override
void drawShadow(const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
void drawImage(const sk_sp< DlImage > image, const SkPoint point, DlImageSampling sampling, bool render_with_attributes) override
void drawOval(const SkRect &bounds) override
void clipRect(const SkRect &rect, ClipOp clip_op, bool is_aa) override
void rotate(SkScalar degrees) override
void translate(SkScalar tx, SkScalar ty) override
void drawColor(DlColor color, DlBlendMode mode) override
void drawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity) override
static void DrawShadow(SkCanvas *canvas, const SkPath &path, DlColor color, float elevation, bool transparentOccluder, SkScalar dpr)
void drawLine(const SkPoint &p0, const SkPoint &p1) override
void drawVertices(const DlVertices *vertices, DlBlendMode mode) override
void skew(SkScalar sx, SkScalar sy) override
void drawRect(const SkRect &rect) 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 clipPath(const SkPath &path, ClipOp clip_op, bool is_aa) 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 saveLayer(const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop) override
void clipRRect(const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
void scale(SkScalar sx, SkScalar sy) override
DlSkCanvasDispatcher(SkCanvas *canvas, SkScalar opacity=SK_Scalar1)
void drawDRRect(const SkRRect &outer, const SkRRect &inner) override
void drawImageRect(const sk_sp< DlImage > image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
Definition: dl_vertices.h:71
DlColor color
float SkScalar
Definition: extension.cpp:12
double y
double x
sk_sp< const SkImage > atlas
Definition: SkRecords.h:331
Optional< SkRect > bounds
Definition: SkRecords.h:189
sk_sp< const SkImage > image
Definition: SkRecords.h:269
sk_sp< const SkImageFilter > backdrop
Definition: SkRecords.h:191
SkRRect rrect
Definition: SkRecords.h:232
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
PODArray< SkColor > colors
Definition: SkRecords.h:276
SkSamplingOptions sampling
Definition: SkRecords.h:337
impeller::Scalar DlScalar
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
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
dst
Definition: cp.py:12
Definition: SkRect.h:32