Flutter Engine
The 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
8#include "flutter/display_list/benchmarking/dl_complexity_helper.h"
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 SkRect& bounds,
39 const SaveLayerOptions options,
40 const DlImageFilter* backdrop) override;
41
42 void drawLine(const SkPoint& p0, const SkPoint& p1) override;
43 void drawRect(const SkRect& rect) override;
44 void drawOval(const SkRect& bounds) override;
45 void drawCircle(const SkPoint& center, SkScalar radius) override;
46 void drawRRect(const SkRRect& rrect) override;
47 void drawDRRect(const SkRRect& outer, const SkRRect& inner) override;
48 void drawPath(const SkPath& path) override;
49 void drawArc(const SkRect& oval_bounds,
50 SkScalar start_degrees,
51 SkScalar sweep_degrees,
52 bool use_center) override;
53 void drawPoints(DlCanvas::PointMode mode,
54 uint32_t count,
55 const SkPoint points[]) override;
56 void drawVertices(const DlVertices* vertices, DlBlendMode mode) override;
57 void drawImage(const sk_sp<DlImage> image,
58 const SkPoint point,
59 DlImageSampling sampling,
60 bool render_with_attributes) override;
61 void drawImageNine(const sk_sp<DlImage> image,
62 const SkIRect& center,
63 const SkRect& dst,
64 DlFilterMode filter,
65 bool render_with_attributes) override;
66 void drawDisplayList(const sk_sp<DisplayList> display_list,
67 SkScalar opacity) override;
68 void drawTextBlob(const sk_sp<SkTextBlob> blob,
69 SkScalar x,
70 SkScalar y) override;
71 void drawTextFrame(const std::shared_ptr<impeller::TextFrame>& text_frame,
72 SkScalar x,
73 SkScalar y) override;
74 void drawShadow(const SkPath& path,
75 const DlColor color,
76 const SkScalar elevation,
77 bool transparent_occluder,
78 SkScalar dpr) override;
79
80 protected:
81 void ImageRect(const SkISize& size,
82 bool texture_backed,
83 bool render_with_attributes,
84 bool enforce_src_edges) override;
85
86 unsigned int BatchedComplexity() override;
87
88 private:
89 unsigned int save_layer_count_ = 0;
90 unsigned int draw_text_blob_count_ = 0;
91 };
92
93 DisplayListGLComplexityCalculator()
94 : ceiling_(std::numeric_limits<unsigned int>::max()) {}
95 static DisplayListGLComplexityCalculator* instance_;
96
97 unsigned int ceiling_;
98};
99
100} // namespace flutter
101
102#endif // FLUTTER_DISPLAY_LIST_BENCHMARKING_DL_COMPLEXITY_GL_H_
const char * options
int count
static const int points[]
SkColor4f color
static SkScalar center(float pos0, float pos1)
Type::kYUV Type::kRGBA() int(0.7 *637)
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
sk_sp< SkImage > image
Definition examples.cpp:29
float SkScalar
Definition extension.cpp:12
static float max(float r, float g, float b)
Definition hsl.cpp:49
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
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 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
Definition switches.h:259
Definition ref_ptr.h:256