From 2481632b3cbfde0948cf8984b2d625dbe836c0df Mon Sep 17 00:00:00 2001 From: Jakub Marcowski Date: Sat, 7 Dec 2024 13:11:37 +0100 Subject: [PATCH] thorvg: Regenerate and apply patches --- thirdparty/README.md | 2 + .../pr2740-renderer-crash-hotfix.patch | 45 ------------------- ...ert-tvgLines-bezier-precision-change.patch | 10 ++--- thirdparty/thorvg/src/common/tvgMath.cpp | 2 +- 4 files changed, 8 insertions(+), 51 deletions(-) delete mode 100644 thirdparty/thorvg/patches/pr2740-renderer-crash-hotfix.patch diff --git a/thirdparty/README.md b/thirdparty/README.md index 144ca870a4e..021ba79fb57 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -924,6 +924,8 @@ Files extracted from upstream source: See `thorvg/update-thorvg.sh` for extraction instructions. Set the version number and run the script. +Patches in the `patches/` directory should be re-applied after updating. + ## ufbx diff --git a/thirdparty/thorvg/patches/pr2740-renderer-crash-hotfix.patch b/thirdparty/thorvg/patches/pr2740-renderer-crash-hotfix.patch deleted file mode 100644 index 50b1e1e4a77..00000000000 --- a/thirdparty/thorvg/patches/pr2740-renderer-crash-hotfix.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 8009c75465e5b35da2d5f53532bc65f6df202a3a Mon Sep 17 00:00:00 2001 -From: Hermet Park -Date: Tue, 17 Sep 2024 11:35:48 +0900 -Subject: [PATCH] renderer: hotfix a crash - -prevent a nullptr memory access -regression by f5337015e971d24379d2ee664895503ab8945e13 - -issue: https://github.com/godotengine/godot/issues/97078 ---- - src/renderer/tvgShape.h | 6 ++++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/src/renderer/tvgShape.h b/src/renderer/tvgShape.h -index 221931dee..e120a85c6 100644 ---- a/src/renderer/tvgShape.h -+++ b/src/renderer/tvgShape.h -@@ -51,8 +51,9 @@ struct Shape::Impl - - bool render(RenderMethod* renderer) - { -+ if (!rd) return false; -+ - Compositor* cmp = nullptr; -- bool ret; - - renderer->blend(shape->blend()); - -@@ -61,7 +62,7 @@ struct Shape::Impl - renderer->beginComposite(cmp, CompositeMethod::None, opacity); - } - -- ret = renderer->renderShape(rd); -+ auto ret = renderer->renderShape(rd); - if (cmp) renderer->endComposite(cmp); - return ret; - } -@@ -117,6 +118,7 @@ struct Shape::Impl - - RenderRegion bounds(RenderMethod* renderer) - { -+ if (!rd) return {0, 0, 0, 0}; - return renderer->region(rd); - } - diff --git a/thirdparty/thorvg/patches/revert-tvgLines-bezier-precision-change.patch b/thirdparty/thorvg/patches/revert-tvgLines-bezier-precision-change.patch index dd6c8ba5e70..c36836eadc1 100644 --- a/thirdparty/thorvg/patches/revert-tvgLines-bezier-precision-change.patch +++ b/thirdparty/thorvg/patches/revert-tvgLines-bezier-precision-change.patch @@ -1,10 +1,10 @@ -diff --git a/thirdparty/thorvg/src/common/tvgLines.cpp b/thirdparty/thorvg/src/common/tvgLines.cpp -index 49d992f127..9d704900a5 100644 ---- a/thirdparty/thorvg/src/common/tvgLines.cpp -+++ b/thirdparty/thorvg/src/common/tvgLines.cpp +diff --git a/thirdparty/thorvg/src/common/tvgMath.cpp b/thirdparty/thorvg/src/common/tvgMath.cpp +index cb7f24ff40..f27f69faeb 100644 +--- a/thirdparty/thorvg/src/common/tvgMath.cpp ++++ b/thirdparty/thorvg/src/common/tvgMath.cpp @@ -79,7 +79,7 @@ float _bezAt(const Bezier& bz, float at, float length, LengthFunc lineLengthFunc Bezier left; - bezSplitLeft(right, t, left); + right.split(t, left); length = _bezLength(left, lineLengthFunc); - if (fabsf(length - at) < BEZIER_EPSILON || fabsf(smallest - biggest) < 1e-3f) { + if (fabsf(length - at) < BEZIER_EPSILON || fabsf(smallest - biggest) < BEZIER_EPSILON) { diff --git a/thirdparty/thorvg/src/common/tvgMath.cpp b/thirdparty/thorvg/src/common/tvgMath.cpp index cb7f24ff403..f27f69faebb 100644 --- a/thirdparty/thorvg/src/common/tvgMath.cpp +++ b/thirdparty/thorvg/src/common/tvgMath.cpp @@ -79,7 +79,7 @@ float _bezAt(const Bezier& bz, float at, float length, LengthFunc lineLengthFunc Bezier left; right.split(t, left); length = _bezLength(left, lineLengthFunc); - if (fabsf(length - at) < BEZIER_EPSILON || fabsf(smallest - biggest) < 1e-3f) { + if (fabsf(length - at) < BEZIER_EPSILON || fabsf(smallest - biggest) < BEZIER_EPSILON) { break; } if (length < at) {