Flutter Engine
 
Loading...
Searching...
No Matches
dl_op_spy.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_SHELL_COMMON_DL_OP_SPY_H_
6#define FLUTTER_SHELL_COMMON_DL_OP_SPY_H_
7
10
11namespace flutter {
12
13//------------------------------------------------------------------------------
14/// Receives to drawing commands of a DisplayListBuilder.
15///
16/// This is used to determine whether any non-transparent pixels will be drawn
17/// on the canvas.
18/// All the drawImage operations are considered drawing non-transparent pixels.
19///
20/// To use this class, dispatch the operations from DisplayList to a concrete
21/// DlOpSpy object, and check the result of `did_draw` method.
22///
23/// ```
24/// DlOpSpy dl_op_spy;
25/// display_list.Dispatch(dl_op_spy);
26/// bool did_draw = dl_op_spy.did_draw()
27/// ```
28///
29class DlOpSpy final : public virtual DlOpReceiver,
33 public:
34 //----------------------------------------------------------------------------
35 /// @brief Returns true if any non transparent content has been drawn.
36 bool did_draw();
37
38 private:
39 void setColor(DlColor color) override;
40 void setColorSource(const DlColorSource* source) override;
41 void save() override;
42 void saveLayer(const DlRect& bounds,
43 const SaveLayerOptions options,
44 const DlImageFilter* backdrop,
45 std::optional<int64_t> backdrop_id) override;
46 void restore() override;
47 void drawColor(DlColor color, DlBlendMode mode) override;
48 void drawPaint() override;
49 void drawLine(const DlPoint& p0, const DlPoint& p1) override;
50 void drawDashedLine(const DlPoint& p0,
51 const DlPoint& p1,
52 DlScalar on_length,
53 DlScalar off_length) override;
54 void drawRect(const DlRect& rect) override;
55 void drawOval(const DlRect& bounds) override;
56 void drawCircle(const DlPoint& center, DlScalar radius) override;
57 void drawRoundRect(const DlRoundRect& rrect) override;
58 void drawDiffRoundRect(const DlRoundRect& outer,
59 const DlRoundRect& inner) override;
60 void drawRoundSuperellipse(const DlRoundSuperellipse& rse) override;
61 void drawPath(const DlPath& path) override;
62 void drawArc(const DlRect& oval_bounds,
63 DlScalar start_degrees,
64 DlScalar sweep_degrees,
65 bool use_center) override;
66 void drawPoints(DlPointMode mode,
67 uint32_t count,
68 const DlPoint points[]) override;
69 void drawVertices(const std::shared_ptr<DlVertices>& vertices,
70 DlBlendMode mode) override;
71 void drawImage(const sk_sp<DlImage> image,
72 const DlPoint& point,
73 DlImageSampling sampling,
74 bool render_with_attributes) override;
75 void drawImageRect(
76 const sk_sp<DlImage> image,
77 const DlRect& src,
78 const DlRect& dst,
79 DlImageSampling sampling,
80 bool render_with_attributes,
82 void drawImageNine(const sk_sp<DlImage> image,
83 const DlIRect& center,
84 const DlRect& dst,
85 DlFilterMode filter,
86 bool render_with_attributes) override;
87 void drawAtlas(const sk_sp<DlImage> atlas,
88 const DlRSTransform xform[],
89 const DlRect tex[],
90 const DlColor colors[],
91 int count,
93 DlImageSampling sampling,
94 const DlRect* cull_rect,
95 bool render_with_attributes) override;
96 void drawDisplayList(const sk_sp<DisplayList> display_list,
97 DlScalar opacity = SK_Scalar1) override;
98 void drawText(const std::shared_ptr<DlText>& text,
99 DlScalar x,
100 DlScalar y) override;
101 void drawShadow(const DlPath& path,
102 const DlColor color,
103 const DlScalar elevation,
104 bool transparent_occluder,
105 DlScalar dpr) override;
106
107 // Most recently set color, used when color_source goes to null
108 DlColor color_;
109
110 // Indicates if the attributes are set to values that will modify the
111 // destination. For now, the test only checks if there is a non-transparent
112 // color set.
113 bool will_draw_ = true;
114
115 bool did_draw_ = false;
116};
117
118} // namespace flutter
119
120#endif // FLUTTER_SHELL_COMMON_DL_OP_SPY_H_
Internal API for rendering recorded display lists to backends.
bool did_draw()
Returns true if any non transparent content has been drawn.
Definition dl_op_spy.cc:9
int32_t x
FlutterVulkanImage * image
std::u16string text
double y
impeller::Scalar DlScalar
DlPointMode
Definition dl_types.h:15
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 switch_defs.h:52
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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
DlSrcRectConstraint
Definition dl_types.h:21
BlendMode
Definition color.h:58
std::vector< Point > points