Flutter Engine
 
Loading...
Searching...
No Matches
dl_op_spy.cc
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
6
7namespace flutter {
8
10 return did_draw_;
11}
12
13void DlOpSpy::setColor(DlColor color) {
14 color_ = color;
15 if (color.isTransparent()) {
16 will_draw_ = false;
17 } else {
18 will_draw_ = true;
19 }
20}
21void DlOpSpy::setColorSource(const DlColorSource* source) {
22 if (!source) {
23 // Restore settings based on previously set color
24 setColor(color_);
25 return;
26 }
27 will_draw_ = true;
28}
29void DlOpSpy::save() {}
30void DlOpSpy::saveLayer(const DlRect& bounds,
31 const SaveLayerOptions options,
32 const DlImageFilter* backdrop,
33 std::optional<int64_t> backdrop_id) {}
34void DlOpSpy::restore() {}
35void DlOpSpy::drawColor(DlColor color, DlBlendMode mode) {
36 did_draw_ |= !color.isTransparent();
37}
38void DlOpSpy::drawPaint() {
39 did_draw_ |= will_draw_;
40}
41// TODO(cyanglaz): check whether the shape (line, rect, oval, etc) needs to be
42// evaluated. https://github.com/flutter/flutter/issues/123803
43void DlOpSpy::drawLine(const DlPoint& p0, const DlPoint& p1) {
44 did_draw_ |= will_draw_;
45}
46void DlOpSpy::drawDashedLine(const DlPoint& p0,
47 const DlPoint& p1,
48 DlScalar on_length,
49 DlScalar off_length) {
50 did_draw_ |= will_draw_;
51}
52void DlOpSpy::drawRect(const DlRect& rect) {
53 did_draw_ |= will_draw_;
54}
55void DlOpSpy::drawOval(const DlRect& bounds) {
56 did_draw_ |= will_draw_;
57}
58void DlOpSpy::drawCircle(const DlPoint& center, DlScalar radius) {
59 did_draw_ |= will_draw_;
60}
61void DlOpSpy::drawRoundRect(const DlRoundRect& rrect) {
62 did_draw_ |= will_draw_;
63}
64void DlOpSpy::drawDiffRoundRect(const DlRoundRect& outer,
65 const DlRoundRect& inner) {
66 did_draw_ |= will_draw_;
67}
68void DlOpSpy::drawRoundSuperellipse(const DlRoundSuperellipse& rse) {
69 did_draw_ |= will_draw_;
70}
71void DlOpSpy::drawPath(const DlPath& path) {
72 did_draw_ |= will_draw_;
73}
74void DlOpSpy::drawArc(const DlRect& oval_bounds,
75 DlScalar start_degrees,
76 DlScalar sweep_degrees,
77 bool use_center) {
78 did_draw_ |= will_draw_;
79}
80void DlOpSpy::drawPoints(DlPointMode mode,
81 uint32_t count,
82 const DlPoint points[]) {
83 did_draw_ |= will_draw_;
84}
85void DlOpSpy::drawVertices(const std::shared_ptr<DlVertices>& vertices,
86 DlBlendMode mode) {
87 did_draw_ |= will_draw_;
88}
89// In theory, below drawImage methods can produce a transparent screen when a
90// transparent image is provided. The operation of determine whether an image is
91// transparent needs examine all the pixels in the image object, which is slow.
92// Drawing a completely transparent image is not a valid use case, thus, such
93// case is ignored.
94void DlOpSpy::drawImage(const sk_sp<DlImage> image,
95 const DlPoint& point,
96 DlImageSampling sampling,
97 bool render_with_attributes) {
98 did_draw_ = true;
99}
100void DlOpSpy::drawImageRect(const sk_sp<DlImage> image,
101 const DlRect& src,
102 const DlRect& dst,
103 DlImageSampling sampling,
104 bool render_with_attributes,
105 DlSrcRectConstraint constraint) {
106 did_draw_ = true;
107}
108void DlOpSpy::drawImageNine(const sk_sp<DlImage> image,
109 const DlIRect& center,
110 const DlRect& dst,
111 DlFilterMode filter,
112 bool render_with_attributes) {
113 did_draw_ = true;
114}
115void DlOpSpy::drawAtlas(const sk_sp<DlImage> atlas,
116 const DlRSTransform xform[],
117 const DlRect tex[],
118 const DlColor colors[],
119 int count,
120 DlBlendMode mode,
121 DlImageSampling sampling,
122 const DlRect* cull_rect,
123 bool render_with_attributes) {
124 did_draw_ = true;
125}
126void DlOpSpy::drawDisplayList(const sk_sp<DisplayList> display_list,
127 DlScalar opacity) {
128 if (did_draw_ || opacity == 0) {
129 return;
130 }
131 DlOpSpy receiver;
132 display_list->Dispatch(receiver);
133 did_draw_ |= receiver.did_draw();
134}
135
136void DlOpSpy::drawText(const std::shared_ptr<flutter::DlText>& text_frame,
137 DlScalar x,
138 DlScalar y) {
139 did_draw_ |= will_draw_;
140}
141
142void DlOpSpy::drawShadow(const DlPath& path,
143 const DlColor color,
144 const DlScalar elevation,
145 bool transparent_occluder,
146 DlScalar dpr) {
147 did_draw_ |= !color.isTransparent();
148}
149
150} // namespace flutter
bool did_draw()
Returns true if any non transparent content has been drawn.
Definition dl_op_spy.cc:9
int32_t x
FlutterVulkanImage * image
double y
impeller::Scalar DlScalar
impeller::RoundRect DlRoundRect
impeller::RSTransform DlRSTransform
impeller::Rect DlRect
impeller::RoundSuperellipse DlRoundSuperellipse
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
impeller::IRect32 DlIRect
impeller::BlendMode DlBlendMode
impeller::Point DlPoint
DlSrcRectConstraint
Definition dl_types.h:21
constexpr bool isTransparent() const
Definition dl_color.h:98
std::vector< Point > points