Flutter Engine
 
Loading...
Searching...
No Matches
dl_complexity_gl.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_BENCHMARKING_DL_COMPLEXITY_GL_H_
6#define FLUTTER_DISPLAY_LIST_BENCHMARKING_DL_COMPLEXITY_GL_H_
7
9
10namespace flutter {
11
14 public:
16
17 unsigned int Compute(const DisplayList* display_list) override {
18 GLHelper helper(ceiling_);
19 display_list->Dispatch(helper);
20 return helper.ComplexityScore();
21 }
22
23 bool ShouldBeCached(unsigned int complexity_score) override {
24 // Set cache threshold at 1ms
25 return complexity_score > 200000u;
26 }
27
28 void SetComplexityCeiling(unsigned int ceiling) override {
29 ceiling_ = ceiling;
30 }
31
32 private:
33 class GLHelper : public ComplexityCalculatorHelper {
34 public:
35 explicit GLHelper(unsigned int ceiling)
36 : ComplexityCalculatorHelper(ceiling) {}
37
38 void saveLayer(const DlRect& bounds,
39 const SaveLayerOptions options,
40 const DlImageFilter* backdrop,
41 std::optional<int64_t> backdrop_id) override;
42
43 void drawLine(const DlPoint& p0, const DlPoint& p1) override;
44 void drawDashedLine(const DlPoint& p0,
45 const DlPoint& p1,
46 DlScalar on_length,
47 DlScalar off_length) override;
48 void drawRect(const DlRect& rect) override;
49 void drawOval(const DlRect& bounds) override;
50 void drawCircle(const DlPoint& center, DlScalar radius) override;
51 void drawRoundRect(const DlRoundRect& rrect) override;
52 void drawDiffRoundRect(const DlRoundRect& outer,
53 const DlRoundRect& inner) override;
54 void drawRoundSuperellipse(const DlRoundSuperellipse& rse) override;
55 void drawPath(const DlPath& path) override;
56 void drawArc(const DlRect& oval_bounds,
57 DlScalar start_degrees,
58 DlScalar sweep_degrees,
59 bool use_center) override;
60 void drawPoints(DlPointMode mode,
61 uint32_t count,
62 const DlPoint points[]) override;
63 void drawVertices(const std::shared_ptr<DlVertices>& vertices,
64 DlBlendMode mode) override;
65 void drawImage(const sk_sp<DlImage> image,
66 const DlPoint& point,
67 DlImageSampling sampling,
68 bool render_with_attributes) override;
69 void drawImageNine(const sk_sp<DlImage> image,
70 const DlIRect& center,
71 const DlRect& dst,
72 DlFilterMode filter,
73 bool render_with_attributes) override;
74 void drawDisplayList(const sk_sp<DisplayList> display_list,
75 DlScalar opacity) override;
76 void drawText(const std::shared_ptr<DlText>& text,
77 DlScalar x,
78 DlScalar y) override;
79 void drawShadow(const DlPath& path,
80 const DlColor color,
81 const DlScalar elevation,
82 bool transparent_occluder,
83 DlScalar dpr) override;
84
85 protected:
86 void ImageRect(const DlISize& size,
87 bool texture_backed,
88 bool render_with_attributes,
89 bool enforce_src_edges) override;
90
91 unsigned int BatchedComplexity() override;
92
93 private:
94 unsigned int save_layer_count_ = 0;
95 unsigned int draw_text_count_ = 0;
96 };
97
98 DisplayListGLComplexityCalculator()
99 : ceiling_(std::numeric_limits<unsigned int>::max()) {}
100 static DisplayListGLComplexityCalculator* instance_;
101
102 unsigned int ceiling_;
103};
104
105} // namespace flutter
106
107#endif // FLUTTER_DISPLAY_LIST_BENCHMARKING_DL_COMPLEXITY_GL_H_
unsigned int Compute(const DisplayList *display_list) override
void SetComplexityCeiling(unsigned int ceiling) override
bool ShouldBeCached(unsigned int complexity_score) override
static DisplayListGLComplexityCalculator * GetInstance()
void Dispatch(DlOpReceiver &ctx) const
int32_t x
FlutterVulkanImage * image
std::u16string text
double y
impeller::Scalar DlScalar
impeller::RoundRect DlRoundRect
impeller::Rect DlRect
impeller::ISize32 DlISize
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 keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
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
Definition ref_ptr.h:261
std::vector< Point > points