17DisplayListGLComplexityCalculator*
18 DisplayListGLComplexityCalculator::instance_ =
nullptr;
20DisplayListGLComplexityCalculator*
22 if (instance_ ==
nullptr) {
28unsigned int DisplayListGLComplexityCalculator::GLHelper::BatchedComplexity() {
30 unsigned int save_layer_complexity;
31 if (save_layer_count_ == 0) {
32 save_layer_complexity = 0;
36 save_layer_complexity = (save_layer_count_ + 50) * 40000;
39 unsigned int draw_text_blob_complexity;
40 if (draw_text_count_ == 0) {
41 draw_text_blob_complexity = 0;
45 draw_text_blob_complexity = (draw_text_count_ + 60) * 2500 / 3;
48 return save_layer_complexity + draw_text_blob_complexity;
51void DisplayListGLComplexityCalculator::GLHelper::saveLayer(
53 const SaveLayerOptions options,
54 const DlImageFilter* backdrop,
55 std::optional<int64_t> backdrop_id) {
63 AccumulateComplexity(Ceiling());
68void DisplayListGLComplexityCalculator::GLHelper::drawLine(
const DlPoint& p0,
80 float non_hairline_penalty = 1.0f;
81 unsigned int aa_penalty = 1;
84 if (!IsHairline() && !IsAntiAliased()) {
85 non_hairline_penalty = 1.15f;
87 if (IsAntiAliased()) {
98 unsigned int complexity =
99 ((
distance + 520) / 2) * non_hairline_penalty * aa_penalty;
101 AccumulateComplexity(complexity);
104void DisplayListGLComplexityCalculator::GLHelper::drawDashedLine(
114void DisplayListGLComplexityCalculator::GLHelper::drawRect(
const DlRect& rect) {
119 unsigned int complexity;
130 unsigned int area = rect.GetWidth() * rect.GetHeight();
134 complexity = area * 2 / 175;
137 unsigned int length = (rect.GetWidth() + rect.GetHeight()) / 2;
139 if (IsAntiAliased()) {
142 complexity =
length * 4 / 3;
156 complexity = std::min(
length, 1000u) * 2;
160 AccumulateComplexity(complexity);
163void DisplayListGLComplexityCalculator::GLHelper::drawOval(
173 unsigned int area = bounds.GetWidth() * bounds.GetHeight();
175 unsigned int complexity;
183 complexity = area / 30;
185 if (IsAntiAliased()) {
188 complexity = area / 20;
191 unsigned int length = (bounds.GetWidth() + bounds.GetHeight()) / 2;
195 complexity =
length * 8 / 3;
199 AccumulateComplexity(complexity);
202void DisplayListGLComplexityCalculator::GLHelper::drawCircle(
209 unsigned int complexity;
215 unsigned int area = radius * radius;
218 complexity = (area + 26250) * 8 / 105;
221 if (!IsAntiAliased()) {
226 if (IsAntiAliased()) {
229 complexity = (radius + 30) * 40 / 3;
233 complexity = (radius + 200) * 4;
237 AccumulateComplexity(complexity);
240void DisplayListGLComplexityCalculator::GLHelper::drawRoundRect(
254 unsigned int complexity;
260 ((rrect.GetRadii().AreAllCornersSame()) && IsAntiAliased())) {
261 unsigned int area = rrect.GetBounds().Area();
264 complexity = (area + 1600) / 80;
268 (rrect.GetBounds().GetWidth() + rrect.GetBounds().GetHeight()) / 2;
272 if (IsAntiAliased()) {
275 complexity = (
length + 25) * 8 / 5;
279 complexity = ((
length * 2) + 75) * 2 / 5;
283 AccumulateComplexity(complexity);
286void DisplayListGLComplexityCalculator::GLHelper::drawDiffRoundRect(
302 unsigned int complexity;
311 unsigned int area = outer.GetBounds().Area();
312 if (!outer.GetRadii().AreAllCornersSame()) {
315 complexity = (area + 250) / 5;
319 complexity = (area + 3200) / 16;
323 (outer.GetBounds().GetWidth() + outer.GetBounds().GetHeight()) / 2;
324 if (IsAntiAliased()) {
327 complexity = (
length + 15) * 20 / 3;
331 complexity = ((
length * 2) + 27) * 50 / 27;
335 AccumulateComplexity(complexity);
338void DisplayListGLComplexityCalculator::GLHelper::drawRoundSuperellipse(
341 drawRoundRect(rse.ToApproximateRoundRect());
344void DisplayListGLComplexityCalculator::GLHelper::drawPath(
const DlPath&
path) {
354 unsigned int line_verb_cost, quad_verb_cost, conic_verb_cost, cubic_verb_cost;
355 unsigned int complexity;
357 if (IsAntiAliased()) {
362 line_verb_cost = 235;
363 quad_verb_cost = 365;
364 conic_verb_cost = 365;
365 cubic_verb_cost = 725;
371 line_verb_cost = 135;
372 quad_verb_cost = 150;
373 conic_verb_cost = 200;
374 cubic_verb_cost = 235;
377 complexity += CalculatePathComplexity(
path, line_verb_cost, quad_verb_cost,
378 conic_verb_cost, cubic_verb_cost);
380 AccumulateComplexity(complexity);
383void DisplayListGLComplexityCalculator::GLHelper::drawArc(
384 const DlRect& oval_bounds,
395 unsigned int area = oval_bounds.GetWidth() * oval_bounds.GetHeight();
396 unsigned int complexity;
405 if (IsAntiAliased()) {
408 complexity = (area + 45600) / 171;
410 unsigned int diameter =
411 (oval_bounds.GetWidth() + oval_bounds.GetHeight()) / 2;
418 unsigned int log_diameter = 15 * log(diameter);
419 complexity = (log_diameter - std::max(log_diameter, 100u)) * 200 / 9;
422 if (IsAntiAliased()) {
425 complexity = (area + 10000) / 45;
429 complexity = (area + 52000) * 2 / 585;
433 AccumulateComplexity(complexity);
436void DisplayListGLComplexityCalculator::GLHelper::drawPoints(
443 unsigned int complexity;
445 if (IsAntiAliased()) {
451 complexity = count * 400 / 9;
455 complexity = count * 400;
461 complexity = count * 800 / 3;
465 complexity = count * 400;
471 complexity = count * 4000 / 7;
475 complexity = count * 800;
483 complexity = (count + 4500) * 100 / 9;
488 complexity = (count + 2125) * 400 / 17;
492 complexity = (count + 2250) * 200 / 9;
499 complexity = (count + 1875) * 80 / 3;
503 AccumulateComplexity(complexity);
506void DisplayListGLComplexityCalculator::GLHelper::drawVertices(
507 const std::shared_ptr<DlVertices>& vertices,
520 unsigned int complexity = (vertices->vertex_count() + 1600) * 250 / 2;
522 AccumulateComplexity(complexity);
525void DisplayListGLComplexityCalculator::GLHelper::drawImage(
526 const sk_sp<DlImage>
image,
529 bool render_with_attributes) {
541 unsigned int length = (dimensions.width + dimensions.height) / 2;
542 unsigned int area = dimensions.Area();
546 unsigned int complexity =
length * 400 / 13;
548 if (!
image->isTextureBacked()) {
557 if (IsAntiAliased()) {
558 multiplier = area / 60000.0f;
559 complexity = complexity * multiplier + 4000;
561 multiplier = area / 19000.0f;
562 complexity = complexity * multiplier;
566 AccumulateComplexity(complexity);
569void DisplayListGLComplexityCalculator::GLHelper::ImageRect(
572 bool render_with_attributes,
573 bool enforce_src_edges) {
585 unsigned int complexity;
586 if (!texture_backed || (texture_backed && render_with_attributes &&
587 enforce_src_edges && IsAntiAliased())) {
588 unsigned int area =
size.Area();
591 complexity = (area + 20000) / 10;
599 complexity =
length * 200 / 11;
602 AccumulateComplexity(complexity);
605void DisplayListGLComplexityCalculator::GLHelper::drawImageNine(
606 const sk_sp<DlImage>
image,
610 bool render_with_attributes) {
616 unsigned int area = dimensions.Area();
620 unsigned int complexity = (area + 10800) / 9;
623 if (!
image->isTextureBacked()) {
627 AccumulateComplexity(complexity);
630void DisplayListGLComplexityCalculator::GLHelper::drawDisplayList(
631 const sk_sp<DisplayList> display_list,
636 GLHelper helper(Ceiling() - CurrentComplexityScore());
637 if (opacity < SK_Scalar1 && !display_list->can_apply_group_opacity()) {
638 auto bounds = display_list->GetBounds();
642 display_list->Dispatch(helper);
643 AccumulateComplexity(helper.ComplexityScore());
646void DisplayListGLComplexityCalculator::GLHelper::drawText(
647 const std::shared_ptr<DlText>&
text,
662void DisplayListGLComplexityCalculator::GLHelper::drawShadow(
666 bool transparent_occluder,
677 float occluder_penalty = 1.0f;
678 if (transparent_occluder) {
679 occluder_penalty = 1.20f;
690 unsigned int line_verb_cost = 17000;
691 unsigned int quad_verb_cost = 20000;
692 unsigned int conic_verb_cost = 20000;
693 unsigned int cubic_verb_cost = 120000;
695 unsigned int complexity = CalculatePathComplexity(
696 path, line_verb_cost, quad_verb_cost, conic_verb_cost, cubic_verb_cost);
698 AccumulateComplexity(complexity * occluder_penalty);
static DisplayListGLComplexityCalculator * GetInstance()
static const SaveLayerOptions kWithAttributes
FlutterVulkanImage * image
impeller::Scalar DlScalar
impeller::RoundRect DlRoundRect
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
@ kLines
draw each separate pair of points as a line segment
@ kPoints
draw each point separately
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
@ kStroke
strokes boundary of shapes
@ kFill
fills interior of shapes
impeller::IRect32 DlIRect
impeller::BlendMode DlBlendMode
std::vector< Point > points