Flutter Engine
The 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
5#include "flutter/shell/common/dl_op_spy.h"
6
7namespace flutter {
8
10 return did_draw_;
11}
12
14 if (color.isTransparent()) {
15 will_draw_ = false;
16 } else {
17 will_draw_ = true;
18 }
19}
21 if (!source) {
22 return;
23 }
24 const DlColorColorSource* color_source = source->asColor();
25 if (color_source && color_source->color().isTransparent()) {
26 will_draw_ = false;
27 return;
28 }
29 will_draw_ = true;
30}
32void DlOpSpy::saveLayer(const SkRect& bounds,
34 const DlImageFilter* backdrop) {}
37 did_draw_ |= !color.isTransparent();
38}
40 did_draw_ |= will_draw_;
41}
42// TODO(cyanglaz): check whether the shape (line, rect, oval, etc) needs to be
43// evaluated. https://github.com/flutter/flutter/issues/123803
44void DlOpSpy::drawLine(const SkPoint& p0, const SkPoint& p1) {
45 did_draw_ |= will_draw_;
46}
47void DlOpSpy::drawRect(const SkRect& rect) {
48 did_draw_ |= will_draw_;
49}
50void DlOpSpy::drawOval(const SkRect& bounds) {
51 did_draw_ |= will_draw_;
52}
54 did_draw_ |= will_draw_;
55}
56void DlOpSpy::drawRRect(const SkRRect& rrect) {
57 did_draw_ |= will_draw_;
58}
59void DlOpSpy::drawDRRect(const SkRRect& outer, const SkRRect& inner) {
60 did_draw_ |= will_draw_;
61}
63 did_draw_ |= will_draw_;
64}
65void DlOpSpy::drawArc(const SkRect& oval_bounds,
66 SkScalar start_degrees,
67 SkScalar sweep_degrees,
68 bool use_center) {
69 did_draw_ |= will_draw_;
70}
72 uint32_t count,
73 const SkPoint points[]) {
74 did_draw_ |= will_draw_;
75}
77 did_draw_ |= will_draw_;
78}
79// In theory, below drawImage methods can produce a transparent screen when a
80// transparent image is provided. The operation of determine whether an image is
81// transparent needs examine all the pixels in the image object, which is slow.
82// Drawing a completely transparent image is not a valid use case, thus, such
83// case is ignored.
85 const SkPoint point,
86 DlImageSampling sampling,
87 bool render_with_attributes) {
88 did_draw_ = true;
89}
91 const SkRect& src,
92 const SkRect& dst,
93 DlImageSampling sampling,
94 bool render_with_attributes,
95 SrcRectConstraint constraint) {
96 did_draw_ = true;
97}
99 const SkIRect& center,
100 const SkRect& dst,
101 DlFilterMode filter,
102 bool render_with_attributes) {
103 did_draw_ = true;
104}
106 const SkRSXform xform[],
107 const SkRect tex[],
108 const DlColor colors[],
109 int count,
111 DlImageSampling sampling,
112 const SkRect* cull_rect,
113 bool render_with_attributes) {
114 did_draw_ = true;
115}
117 SkScalar opacity) {
118 if (did_draw_ || opacity == 0) {
119 return;
120 }
121 DlOpSpy receiver;
122 display_list->Dispatch(receiver);
123 did_draw_ |= receiver.did_draw();
124}
126 SkScalar x,
127 SkScalar y) {
128 did_draw_ |= will_draw_;
129}
130
132 const std::shared_ptr<impeller::TextFrame>& text_frame,
133 SkScalar x,
134 SkScalar y) {
135 did_draw_ |= will_draw_;
136}
137
139 const DlColor color,
140 const SkScalar elevation,
141 bool transparent_occluder,
142 SkScalar dpr) {
143 did_draw_ |= !color.isTransparent();
144}
145
146} // namespace flutter
const char * options
int count
static const int points[]
SkColor4f color
static SkScalar center(float pos0, float pos1)
void drawImageNine(const sk_sp< DlImage > image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, bool render_with_attributes) override
Definition dl_op_spy.cc:98
void drawImageRect(const sk_sp< DlImage > image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint=SrcRectConstraint::kFast) override
Definition dl_op_spy.cc:90
void restore() override
Definition dl_op_spy.cc:35
void drawPoints(PointMode mode, uint32_t count, const SkPoint points[]) override
Definition dl_op_spy.cc:71
void drawShadow(const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
Definition dl_op_spy.cc:138
void drawArc(const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
Definition dl_op_spy.cc:65
void saveLayer(const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop) override
Definition dl_op_spy.cc:32
void drawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
Definition dl_op_spy.cc:131
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
Definition dl_op_spy.cc:105
void drawVertices(const DlVertices *vertices, DlBlendMode mode) override
Definition dl_op_spy.cc:76
void drawRect(const SkRect &rect) override
Definition dl_op_spy.cc:47
void drawPaint() override
Definition dl_op_spy.cc:39
void setColorSource(const DlColorSource *source) override
Definition dl_op_spy.cc:20
void save() override
Definition dl_op_spy.cc:31
void drawLine(const SkPoint &p0, const SkPoint &p1) override
Definition dl_op_spy.cc:44
void drawOval(const SkRect &bounds) override
Definition dl_op_spy.cc:50
void drawTextBlob(const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
Definition dl_op_spy.cc:125
void drawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1) override
Definition dl_op_spy.cc:116
void drawCircle(const SkPoint &center, SkScalar radius) override
Definition dl_op_spy.cc:53
void drawDRRect(const SkRRect &outer, const SkRRect &inner) override
Definition dl_op_spy.cc:59
void drawPath(const SkPath &path) override
Definition dl_op_spy.cc:62
void drawColor(DlColor color, DlBlendMode mode) override
Definition dl_op_spy.cc:36
void setColor(DlColor color) override
Definition dl_op_spy.cc:13
bool did_draw()
Returns true if any non transparent content has been drawn.
Definition dl_op_spy.cc:9
void drawImage(const sk_sp< DlImage > image, const SkPoint point, DlImageSampling sampling, bool render_with_attributes) override
Definition dl_op_spy.cc:84
void drawRRect(const SkRRect &rrect) override
Definition dl_op_spy.cc:56
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
Definition dl_vertices.h:71
sk_sp< SkImage > image
Definition examples.cpp:29
SkBitmap source
Definition examples.cpp:28
float SkScalar
Definition extension.cpp:12
double y
double x
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
constexpr bool isTransparent() const
Definition dl_color.h:36