Flutter Engine
The Flutter Engine
dl_receiver_utils.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_UTILS_DL_RECEIVER_UTILS_H_
6#define FLUTTER_DISPLAY_LIST_UTILS_DL_RECEIVER_UTILS_H_
7
8#include "flutter/display_list/dl_op_receiver.h"
9#include "flutter/fml/logging.h"
10
11// This file contains various utility classes to ease implementing
12// a Flutter DisplayList DlOpReceiver, including:
13//
14// IgnoreAttributeDispatchHelper:
15// IgnoreClipDispatchHelper:
16// IgnoreTransformDispatchHelper
17// Empty overrides of all of the associated methods of DlOpReceiver
18// for receivers that only track some of the rendering operations
19
20namespace flutter {
21
22// A utility class that will ignore all DlOpReceiver methods relating
23// to the setting of attributes.
25 public:
26 void setAntiAlias(bool aa) override {}
27 void setInvertColors(bool invert) override {}
28 void setStrokeCap(DlStrokeCap cap) override {}
30 void setDrawStyle(DlDrawStyle style) override {}
31 void setStrokeWidth(float width) override {}
32 void setStrokeMiter(float limit) override {}
33 void setColor(DlColor color) override {}
34 void setBlendMode(DlBlendMode mode) override {}
35 void setColorSource(const DlColorSource* source) override {}
36 void setImageFilter(const DlImageFilter* filter) override {}
37 void setColorFilter(const DlColorFilter* filter) override {}
38 void setMaskFilter(const DlMaskFilter* filter) override {}
39};
40
41// A utility class that will ignore all DlOpReceiver methods relating
42// to setting a clip.
43class IgnoreClipDispatchHelper : public virtual DlOpReceiver {
44 void clipRect(const SkRect& rect,
45 DlCanvas::ClipOp clip_op,
46 bool is_aa) override {}
47 void clipRRect(const SkRRect& rrect,
48 DlCanvas::ClipOp clip_op,
49 bool is_aa) override {}
50 void clipPath(const SkPath& path,
51 DlCanvas::ClipOp clip_op,
52 bool is_aa) override {}
53};
54
55// A utility class that will ignore all DlOpReceiver methods relating
56// to modifying the transform.
58 public:
59 void translate(SkScalar tx, SkScalar ty) override {}
60 void scale(SkScalar sx, SkScalar sy) override {}
61 void rotate(SkScalar degrees) override {}
62 void skew(SkScalar sx, SkScalar sy) override {}
63 // clang-format off
64 // 2x3 2D affine subset of a 4x4 transform in row major order
66 SkScalar myx, SkScalar myy, SkScalar myt) override {}
67 // full 4x4 transform in row major order
69 SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt,
70 SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt,
71 SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt,
72 SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override {}
73 // clang-format on
74 void transformReset() override {}
75};
76
77class IgnoreDrawDispatchHelper : public virtual DlOpReceiver {
78 public:
79 void save() override {}
80 void saveLayer(const SkRect& bounds,
82 const DlImageFilter* backdrop) override {}
83 void restore() override {}
85 void drawPaint() override {}
86 void drawLine(const SkPoint& p0, const SkPoint& p1) override {}
87 void drawDashedLine(const DlPoint& p0,
88 const DlPoint& p1,
89 DlScalar on_length,
90 DlScalar off_length) override {}
91 void drawRect(const SkRect& rect) override {}
92 void drawOval(const SkRect& bounds) override {}
93 void drawCircle(const SkPoint& center, SkScalar radius) override {}
94 void drawRRect(const SkRRect& rrect) override {}
95 void drawDRRect(const SkRRect& outer, const SkRRect& inner) override {}
96 void drawPath(const SkPath& path) override {}
97 void drawArc(const SkRect& oval_bounds,
98 SkScalar start_degrees,
99 SkScalar sweep_degrees,
100 bool use_center) override {}
102 uint32_t count,
103 const SkPoint points[]) override {}
104 void drawVertices(const DlVertices* vertices, DlBlendMode mode) override {}
106 const SkPoint point,
108 bool render_with_attributes) override {}
110 const SkRect& src,
111 const SkRect& dst,
113 bool render_with_attributes,
114 SrcRectConstraint constraint) override {}
116 const SkIRect& center,
117 const SkRect& dst,
118 DlFilterMode filter,
119 bool render_with_attributes) override {}
121 const SkRSXform xform[],
122 const SkRect tex[],
123 const DlColor colors[],
124 int count,
127 const SkRect* cull_rect,
128 bool render_with_attributes) override {}
129 void drawDisplayList(const sk_sp<DisplayList> display_list,
130 SkScalar opacity) override {}
132 SkScalar x,
133 SkScalar y) override {}
134 void drawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
135 SkScalar x,
136 SkScalar y) override {}
137 void drawShadow(const SkPath& path,
138 const DlColor color,
139 const SkScalar elevation,
140 bool transparent_occluder,
141 SkScalar dpr) override {}
142};
143
144} // namespace flutter
145
146#endif // FLUTTER_DISPLAY_LIST_UTILS_DL_RECEIVER_UTILS_H_
const char * options
int count
Definition: FontMgrTest.cpp:50
static const int points[]
Definition: SkPath.h:59
Internal API for rendering recorded display lists to backends.
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
Definition: dl_vertices.h:71
void setDrawStyle(DlDrawStyle style) override
void setColorSource(const DlColorSource *source) override
void setMaskFilter(const DlMaskFilter *filter) override
void setColorFilter(const DlColorFilter *filter) override
void setColor(DlColor color) override
void setStrokeJoin(DlStrokeJoin join) override
void setStrokeMiter(float limit) override
void setInvertColors(bool invert) override
void setStrokeCap(DlStrokeCap cap) override
void setBlendMode(DlBlendMode mode) override
void setStrokeWidth(float width) override
void setImageFilter(const DlImageFilter *filter) override
void drawColor(DlColor color, DlBlendMode mode) override
void drawImageRect(const sk_sp< DlImage > image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
void drawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity) override
void drawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
void drawPoints(DlCanvas::PointMode mode, uint32_t count, const SkPoint points[]) override
void drawPath(const SkPath &path) override
void drawRRect(const SkRRect &rrect) override
void saveLayer(const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop) override
void drawImageNine(const sk_sp< DlImage > image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, bool render_with_attributes) 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 drawCircle(const SkPoint &center, SkScalar radius) override
void drawOval(const SkRect &bounds) 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 drawDRRect(const SkRRect &outer, const SkRRect &inner) override
void drawRect(const SkRect &rect) override
void drawArc(const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) 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 *cull_rect, bool render_with_attributes) override
void drawTextBlob(const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
void drawShadow(const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
void transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
void rotate(SkScalar degrees) 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 scale(SkScalar sx, SkScalar sy) override
void translate(SkScalar tx, SkScalar ty) override
void skew(SkScalar sx, SkScalar sy) override
DlColor color
SkBitmap source
Definition: examples.cpp:28
float SkScalar
Definition: extension.cpp:12
gboolean invert
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
DlStrokeJoin
Definition: dl_paint.h:37
DlStrokeCap
Definition: dl_paint.h:28
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
DlDrawStyle
Definition: dl_paint.h:19
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
int32_t width
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741
Definition: SkRect.h:32