Skip to content

Commit

Permalink
[Impeller] Pack impeller:Path into 2 vecs instead of 3. (#55028)
Browse files Browse the repository at this point in the history
This better aligns impeller::Path with how Skia::Path works, and probably gives us a route to a faster Skia path to Impeller::Path conversion (since dart:ui Path will be a Skia path for a long time).

We used 3 vectors to separately store:
1. Path points
2. Path Verbs
3. Path contours (index lookups for contour starts).

This gave us almost O(1) access for path points based on the verb. However, we don't ever actually use the lookup except for in tests. In all real scenarios we iterate through all path verbs, which means this iterators can simply increment the offset into the path points array. Finally, we can store the contour information in the path points array as well by representing the bool is_closed with another Point value :) (for easier alignment).
  • Loading branch information
jonahwilliams authored Sep 24, 2024
1 parent dc47d6d commit 0ce0d22
Show file tree
Hide file tree
Showing 8 changed files with 370 additions and 386 deletions.
4 changes: 4 additions & 0 deletions display_list/geometry/dl_path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "flutter/display_list/geometry/dl_geometry_types.h"
#include "flutter/impeller/geometry/path_builder.h"
#include "impeller/geometry/path.h"

namespace flutter {

Expand Down Expand Up @@ -81,6 +82,9 @@ using FillType = impeller::FillType;
using Convexity = impeller::Convexity;

Path DlPath::ConvertToImpellerPath(const SkPath& path, const DlPoint& shift) {
if (path.isEmpty()) {
return impeller::Path{};
}
auto iterator = SkPath::Iter(path, false);

struct PathData {
Expand Down
Loading

0 comments on commit 0ce0d22

Please sign in to comment.