17DisplayListMetalComplexityCalculator*
18 DisplayListMetalComplexityCalculator::instance_ =
nullptr;
20DisplayListMetalComplexityCalculator*
22 if (instance_ ==
nullptr) {
29DisplayListMetalComplexityCalculator::MetalHelper::BatchedComplexity() {
31 unsigned int save_layer_complexity;
32 if (save_layer_count_ == 0) {
33 save_layer_complexity = 0;
50 save_layer_complexity = (save_layer_count_ + 2) * 100000;
53 unsigned int draw_text_blob_complexity;
54 if (draw_text_count_ == 0) {
55 draw_text_blob_complexity = 0;
59 draw_text_blob_complexity = (draw_text_count_ + 180) * 2500 / 3;
62 return save_layer_complexity + draw_text_blob_complexity;
65void DisplayListMetalComplexityCalculator::MetalHelper::saveLayer(
67 const SaveLayerOptions options,
68 const DlImageFilter* backdrop,
69 std::optional<int64_t> backdrop_id) {
77 AccumulateComplexity(Ceiling());
82void DisplayListMetalComplexityCalculator::MetalHelper::drawLine(
92 float non_hairline_penalty = 1.0f;
93 float aa_penalty = 1.0f;
96 non_hairline_penalty = 1.15f;
98 if (IsAntiAliased()) {
109 unsigned int complexity =
110 ((
distance + 225) * 4 / 9) * non_hairline_penalty * aa_penalty;
112 AccumulateComplexity(complexity);
115void DisplayListMetalComplexityCalculator::MetalHelper::drawDashedLine(
125void DisplayListMetalComplexityCalculator::MetalHelper::drawRect(
131 unsigned int complexity;
144 unsigned int area = rect.GetWidth() * rect.GetHeight();
148 complexity = area / 225;
151 unsigned int length = (rect.GetWidth() + rect.GetHeight()) / 2;
154 if (IsAntiAliased()) {
157 complexity =
length * 8 / 13;
161 complexity =
length * 8 / 7;
165 AccumulateComplexity(complexity);
168void DisplayListMetalComplexityCalculator::MetalHelper::drawOval(
178 unsigned int area = bounds.GetWidth() * bounds.GetHeight();
180 unsigned int complexity;
188 complexity = area / 80;
190 if (IsAntiAliased()) {
193 complexity = area * 2 / 75;
196 unsigned int length = (bounds.GetWidth() + bounds.GetHeight()) / 2;
200 complexity =
length * 5 / 2;
204 AccumulateComplexity(complexity);
207void DisplayListMetalComplexityCalculator::MetalHelper::drawCircle(
214 unsigned int complexity;
220 unsigned int area = radius * radius;
223 complexity = (area + 6500) * 2 / 65;
226 if (!IsAntiAliased()) {
231 if (IsAntiAliased()) {
234 complexity = (radius + 49) * 40 / 7;
238 complexity = (radius + 128) * 5 / 2;
242 AccumulateComplexity(complexity);
245void DisplayListMetalComplexityCalculator::MetalHelper::drawRoundRect(
251 unsigned int area = rrect.GetBounds().Area();
258 (rrect.GetRadii().AreAllCornersSame() && IsAntiAliased());
260 unsigned int complexity;
269 complexity = (area + 10500) / 175;
274 complexity = (area + 50000) / 625;
277 AccumulateComplexity(complexity);
280void DisplayListMetalComplexityCalculator::MetalHelper::drawDiffRoundRect(
296 (outer.GetBounds().GetWidth() + outer.GetBounds().GetHeight()) / 2;
298 unsigned int complexity;
307 unsigned int area = outer.GetBounds().Area();
308 if (!outer.GetRadii().AreAllCornersSame()) {
311 complexity = (area + 1000) / 10;
313 if (IsAntiAliased()) {
316 complexity = (area + 5250) / 35;
320 complexity = (300 + (10 *
length)) / 3;
326 complexity = ((10 *
length) + 1050) / 6;
329 AccumulateComplexity(complexity);
332void DisplayListMetalComplexityCalculator::MetalHelper::drawRoundSuperellipse(
335 drawRoundRect(rse.ToApproximateRoundRect());
338void DisplayListMetalComplexityCalculator::MetalHelper::drawPath(
339 const DlPath&
path) {
349 unsigned int line_verb_cost, quad_verb_cost, conic_verb_cost, cubic_verb_cost;
351 if (IsAntiAliased()) {
353 quad_verb_cost = 100;
354 conic_verb_cost = 160;
355 cubic_verb_cost = 210;
359 conic_verb_cost = 140;
360 cubic_verb_cost = 210;
364 unsigned int complexity =
365 200000 + CalculatePathComplexity(
path, line_verb_cost, quad_verb_cost,
366 conic_verb_cost, cubic_verb_cost);
368 AccumulateComplexity(complexity);
371void DisplayListMetalComplexityCalculator::MetalHelper::drawArc(
372 const DlRect& oval_bounds,
383 unsigned int diameter =
384 (oval_bounds.GetWidth() + oval_bounds.GetHeight()) / 2;
385 unsigned int area = oval_bounds.GetWidth() * oval_bounds.GetHeight();
387 unsigned int complexity;
396 if (IsAntiAliased()) {
399 complexity = (area + 136000) * 2 / 765;
403 complexity = (diameter + 180) * 10 / 27;
406 if (IsAntiAliased()) {
409 complexity = (area + 400000) / 900;
413 complexity = (area + 16800) * 2 / 189;
417 AccumulateComplexity(complexity);
420void DisplayListMetalComplexityCalculator::MetalHelper::drawPoints(
427 unsigned int complexity;
431 if (!IsAntiAliased()) {
434 complexity = (count + 12000) * 25 / 2;
439 complexity = (count + 1250) * 160;
445 complexity = count * 400 / 29;
449 complexity = (count + 1650) * 1000 / 11;
453 AccumulateComplexity(complexity);
456void DisplayListMetalComplexityCalculator::MetalHelper::drawVertices(
457 const std::shared_ptr<DlVertices>& vertices,
470 unsigned int complexity = (vertices->vertex_count() + 4000) * 50;
472 AccumulateComplexity(complexity);
475void DisplayListMetalComplexityCalculator::MetalHelper::drawImage(
476 const sk_sp<DlImage>
image,
479 bool render_with_attributes) {
491 unsigned int area = dimensions.Area();
495 unsigned int complexity = (area + 51000) * 4 / 170;
497 if (!
image->isTextureBacked()) {
503 float multiplier = area / 35000.0f;
504 complexity = complexity * multiplier + 1200;
507 AccumulateComplexity(complexity);
510void DisplayListMetalComplexityCalculator::MetalHelper::ImageRect(
513 bool render_with_attributes,
514 bool enforce_src_edges) {
522 unsigned int area =
size.Area();
527 unsigned int complexity;
528 if (texture_backed) {
532 complexity = (area + 52900) * 2 / 115;
533 if (render_with_attributes && enforce_src_edges && IsAntiAliased()) {
538 if (render_with_attributes && enforce_src_edges && IsAntiAliased()) {
541 complexity = (area + 33550) * 2 / 61;
545 complexity = (area + 36250) * 4 / 145;
549 AccumulateComplexity(complexity);
552void DisplayListMetalComplexityCalculator::MetalHelper::drawImageNine(
553 const sk_sp<DlImage>
image,
557 bool render_with_attributes) {
564 unsigned int area = dimensions.Area();
568 unsigned int complexity = (area + 24000) / 20;
569 AccumulateComplexity(complexity);
572void DisplayListMetalComplexityCalculator::MetalHelper::drawDisplayList(
573 const sk_sp<DisplayList> display_list,
578 MetalHelper helper(Ceiling() - CurrentComplexityScore());
579 if (opacity < SK_Scalar1 && !display_list->can_apply_group_opacity()) {
580 auto bounds = display_list->GetBounds();
584 display_list->Dispatch(helper);
585 AccumulateComplexity(helper.ComplexityScore());
588void DisplayListMetalComplexityCalculator::MetalHelper::drawText(
589 const std::shared_ptr<DlText>&
text,
604void DisplayListMetalComplexityCalculator::MetalHelper::drawShadow(
608 bool transparent_occluder,
619 float occluder_penalty = 1.0f;
620 if (transparent_occluder) {
621 occluder_penalty = 1.05f;
632 unsigned int line_verb_cost = 20000;
633 unsigned int quad_verb_cost = 20000;
634 unsigned int conic_verb_cost = 20000;
635 unsigned int cubic_verb_cost = 80000;
637 unsigned int complexity =
638 0 + CalculatePathComplexity(
path, line_verb_cost, quad_verb_cost,
639 conic_verb_cost, cubic_verb_cost);
641 AccumulateComplexity(complexity * occluder_penalty);
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
@ kPolygon
draw each pair of overlapping 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
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 mode
impeller::BlendMode DlBlendMode
std::vector< Point > points