Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0ce0d22

Browse files
author
Jonah Williams
authored
[Impeller] Pack impeller:Path into 2 vecs instead of 3. (#55028)
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).
1 parent dc47d6d commit 0ce0d22

File tree

8 files changed

+370
-386
lines changed

8 files changed

+370
-386
lines changed

display_list/geometry/dl_path.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "flutter/display_list/geometry/dl_geometry_types.h"
88
#include "flutter/impeller/geometry/path_builder.h"
9+
#include "impeller/geometry/path.h"
910

1011
namespace flutter {
1112

@@ -81,6 +82,9 @@ using FillType = impeller::FillType;
8182
using Convexity = impeller::Convexity;
8283

8384
Path DlPath::ConvertToImpellerPath(const SkPath& path, const DlPoint& shift) {
85+
if (path.isEmpty()) {
86+
return impeller::Path{};
87+
}
8488
auto iterator = SkPath::Iter(path, false);
8589

8690
struct PathData {

0 commit comments

Comments
 (0)