Skip to content

[web]: PathRef.getRRect() could be simpler, faster, and more precise #76885

@yjbanov

Description

@yjbanov

Current PathRef.getRRect() reconstructs the RRect from the verbs. However, at the time the path is constructed we already have the RRect object, and we record that the path is an RRect using the fIsRRect field. We destroy this information and rebuild it again later in _getRRect(). Instead, we could store the original RRect and use it both as the "path is rrect" signal and as a fast way to get the RRect object. Pseudo-code (the devil's in the detail):

BEFORE:

  // Field
  bool fIsRRect = false;

  // Check if RRect
  if (fIsRRect)

  // Declare that the path is no a simple RRect
  fIsRRect = false;

  // Declare the the path is a simple RRect
  fIsRRect = true;

AFTER:

// Field
RRect? asRRect;

// Check if RRect
if (asRRect != null)

// Declare that the path is no a simple RRect
asRRect = null;

// Declare the the path is a simple RRect
asRRect = rrectPassedToPathAddRRect;

Then PathRef._getRRect() can be removed entirely, or used for detection of RRects created using lower-level path operations rather than addRRect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: performanceRelates to speed or footprint issues (see "perf:" labels)e: web_htmlHTML rendering backend for Webengineflutter/engine related. See also e: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions