Flutter Engine
The 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
8#include "flutter/display_list/dl_op_receiver.h"
9#include "flutter/display_list/utils/dl_receiver_utils.h"
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 SkRect& bounds,
44 const DlImageFilter* backdrop) override;
45 void restore() override;
46 void drawColor(DlColor color, DlBlendMode mode) override;
47 void drawPaint() override;
48 void drawLine(const SkPoint& p0, const SkPoint& p1) override;
49 void drawRect(const SkRect& rect) override;
50 void drawOval(const SkRect& bounds) override;
51 void drawCircle(const SkPoint& center, SkScalar radius) override;
52 void drawRRect(const SkRRect& rrect) override;
53 void drawDRRect(const SkRRect& outer, const SkRRect& inner) override;
54 void drawPath(const SkPath& path) override;
55 void drawArc(const SkRect& oval_bounds,
56 SkScalar start_degrees,
57 SkScalar sweep_degrees,
58 bool use_center) override;
60 uint32_t count,
61 const SkPoint points[]) override;
62 void drawVertices(const DlVertices* vertices, DlBlendMode mode) override;
64 const SkPoint point,
65 DlImageSampling sampling,
66 bool render_with_attributes) override;
67 void drawImageRect(
69 const SkRect& src,
70 const SkRect& dst,
71 DlImageSampling sampling,
72 bool render_with_attributes,
73 SrcRectConstraint constraint = SrcRectConstraint::kFast) override;
75 const SkIRect& center,
76 const SkRect& dst,
77 DlFilterMode filter,
78 bool render_with_attributes) override;
79 void drawAtlas(const sk_sp<DlImage> atlas,
80 const SkRSXform xform[],
81 const SkRect tex[],
82 const DlColor colors[],
83 int count,
85 DlImageSampling sampling,
86 const SkRect* cull_rect,
87 bool render_with_attributes) override;
88 void drawDisplayList(const sk_sp<DisplayList> display_list,
89 SkScalar opacity = SK_Scalar1) override;
90 void drawTextBlob(const sk_sp<SkTextBlob> blob,
91 SkScalar x,
92 SkScalar y) override;
93 void drawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
94 SkScalar x,
95 SkScalar y) override;
96 void drawShadow(const SkPath& path,
97 const DlColor color,
98 const SkScalar elevation,
99 bool transparent_occluder,
100 SkScalar dpr) override;
101
102 // Indicates if the attributes are set to values that will modify the
103 // destination. For now, the test only checks if there is a non-transparent
104 // color set.
105 bool will_draw_ = true;
106
107 bool did_draw_ = false;
108};
109
110} // namespace flutter
111
112#endif // FLUTTER_SHELL_COMMON_DL_OP_SPY_H_
const char * options
int count
static const int points[]
SkColor4f color
#define SK_Scalar1
Definition SkScalar.h:18
static SkScalar center(float pos0, float pos1)
Internal API for rendering recorded display lists to backends.
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