diff options
author | hailey <me@haileyok.com> | 2025-06-12 10:46:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-12 10:46:22 -0700 |
commit | 477e5f4ecfaa0007aeed90b51274c78a730c1a9e (patch) | |
tree | 45cd5cfff9eab1bd52b5ade6c60efebe3cc5e6b6 /patches/react-native-svg+15.12.0.patch | |
parent | a26b20b56cd0ac80f625a5eb5136b805b9341e8d (diff) | |
download | voidsky-477e5f4ecfaa0007aeed90b51274c78a730c1a9e.tar.zst |
new arch (#8295)
Co-authored-by: Samuel Newman <mozzius@protonmail.com> Co-authored-by: Charlotte Som <charlotte@som.codes> Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'patches/react-native-svg+15.12.0.patch')
-rw-r--r-- | patches/react-native-svg+15.12.0.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/patches/react-native-svg+15.12.0.patch b/patches/react-native-svg+15.12.0.patch new file mode 100644 index 000000000..54540023f --- /dev/null +++ b/patches/react-native-svg+15.12.0.patch @@ -0,0 +1,57 @@ +diff --git a/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java b/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java +index 06829bd..1b15818 100644 +--- a/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java ++++ b/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java +@@ -14,17 +14,33 @@ import android.graphics.Paint; + import android.graphics.Path; + import com.facebook.react.bridge.ReactContext; + ++import java.util.ArrayList; ++import java.util.HashMap; ++ ++class ParsedPath { ++ final Path path; ++ final ArrayList<PathElement> elements; ++ ++ ParsedPath(Path path, ArrayList<PathElement> elements) { ++ this.path = path; ++ this.elements = elements; ++ } ++} ++ + @SuppressLint("ViewConstructor") + class PathView extends RenderableView { + private Path mPath; + ++ // This grows forever but for our use case (static icons) it's ok. ++ private static final HashMap<String, ParsedPath> sPathCache = new HashMap<>(); ++ + public PathView(ReactContext reactContext) { + super(reactContext); + PathParser.mScale = mScale; + mPath = new Path(); + } + +- public void setD(String d) { ++ void setDByParsing(String d) { + mPath = PathParser.parse(d); + elements = PathParser.elements; + for (PathElement elem : elements) { +@@ -33,6 +49,17 @@ class PathView extends RenderableView { + point.y *= mScale; + } + } ++ } ++ ++ public void setD(String d) { ++ ParsedPath cached = sPathCache.get(d); ++ if (cached != null) { ++ mPath = cached.path; ++ elements = cached.elements; ++ } else { ++ setDByParsing(d); ++ sPathCache.put(d, new ParsedPath(mPath, elements)); ++ } + invalidate(); + } + |