From ff42ab75693872d70494db06d75ff9744fee3d57 Mon Sep 17 00:00:00 2001 From: Martin Capitanio Date: Fri, 12 Jan 2024 08:49:57 +0100 Subject: [PATCH] ThorVG: update from v0.12.0 to v0.12.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/thorvg/thorvg/releases/tag/v0.12.1 Godot-related SVG bug fixes: + [SVG] XML parser workaround for quote checks within quotes. thorvg/thorvg#1892 Fixes »dancing errors« with such SVG images inside the project folder. (cherry picked from commit 0650e72f873957f4325fde5d8a15d5d20ccfc7c4) --- thirdparty/README.md | 2 +- thirdparty/thorvg/inc/config.h | 2 +- thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp | 4 +--- thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp | 7 ++++--- thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp | 2 +- .../thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h | 7 +++---- thirdparty/thorvg/src/renderer/tvgShape.cpp | 4 ++-- thirdparty/thorvg/update-thorvg.sh | 2 +- 8 files changed, 14 insertions(+), 16 deletions(-) diff --git a/thirdparty/README.md b/thirdparty/README.md index 9a3faa08477..a578b8f194e 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -825,7 +825,7 @@ instead of `miniz.h` as an external dependency. ## thorvg - Upstream: https://github.com/thorvg/thorvg -- Version: 0.12.0 (25ea242d3867ed66807714f5a52d080984d3c8cc, 2024) +- Version: 0.12.1 (d761e3c5622c0ffba2e5bb40da05751e2451e495, 2024) - License: MIT Files extracted from upstream source: diff --git a/thirdparty/thorvg/inc/config.h b/thirdparty/thorvg/inc/config.h index d1abc5a2901..73e72c74a79 100644 --- a/thirdparty/thorvg/inc/config.h +++ b/thirdparty/thorvg/inc/config.h @@ -9,5 +9,5 @@ // For internal debugging: //#define THORVG_LOG_ENABLED -#define THORVG_VERSION_STRING "0.12.0" +#define THORVG_VERSION_STRING "0.12.1" #endif diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp index 6e524766257..74f9871a082 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp +++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp @@ -3732,10 +3732,8 @@ bool SvgLoader::read() { if (!content || size == 0) return false; - if (!LoadModule::read()) return true; - //the loading has been already completed in header() - if (root) return true; + if (root || !LoadModule::read()) return true; TaskScheduler::request(this); diff --git a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp index aec30d2384c..6530d52259f 100644 --- a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp +++ b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp @@ -171,10 +171,11 @@ static const char* _simpleXmlFindStartTag(const char* itr, const char* itrEnd) static const char* _simpleXmlFindEndTag(const char* itr, const char* itrEnd) { - bool insideQuote = false; + bool insideQuote[2] = {false, false}; // 0: ", 1: ' for (; itr < itrEnd; itr++) { - if (*itr == '"') insideQuote = !insideQuote; - if (!insideQuote) { + if (*itr == '"' && !insideQuote[1]) insideQuote[0] = !insideQuote[0]; + if (*itr == '\'' && !insideQuote[0]) insideQuote[1] = !insideQuote[1]; + if (!insideQuote[0] && !insideQuote[1]) { if ((*itr == '>') || (*itr == '<')) return itr; } diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp index 68eb7a5a6fe..b85d9438732 100644 --- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp +++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp @@ -77,7 +77,7 @@ void mpoolRetDashOutline(SwMpool* mpool, unsigned idx) } -SwMpool* mpoolInit(unsigned threads) +SwMpool* mpoolInit(uint32_t threads) { auto allocSize = threads + 1; diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h index 04e382b842a..8d604a3c9d7 100644 --- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h +++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h @@ -821,8 +821,8 @@ static void _rasterPolygonImage(SwSurface* surface, const SwImage* image, const static AASpans* _AASpans(float ymin, float ymax, const SwImage* image, const SwBBox* region) { - auto yStart = static_cast(ymin); - auto yEnd = static_cast(ymax); + auto yStart = static_cast(ymin); + auto yEnd = static_cast(ymax); if (!_arrange(image, region, yStart, yEnd)) return nullptr; @@ -1108,8 +1108,7 @@ static bool _rasterTexmapPolygon(SwSurface* surface, const SwImage* image, const float ys = FLT_MAX, ye = -1.0f; for (int i = 0; i < 4; i++) { - mathMultiply(&vertices[i].pt, transform); - + if (transform) mathMultiply(&vertices[i].pt, transform); if (vertices[i].pt.y < ys) ys = vertices[i].pt.y; if (vertices[i].pt.y > ye) ye = vertices[i].pt.y; } diff --git a/thirdparty/thorvg/src/renderer/tvgShape.cpp b/thirdparty/thorvg/src/renderer/tvgShape.cpp index 23b8006dd99..d083c8aa2c7 100644 --- a/thirdparty/thorvg/src/renderer/tvgShape.cpp +++ b/thirdparty/thorvg/src/renderer/tvgShape.cpp @@ -130,11 +130,11 @@ Result Shape::appendCircle(float cx, float cy, float rx, float ry) noexcept auto ryKappa = ry * PATH_KAPPA; pImpl->grow(6, 13); - pImpl->moveTo(cx, cy - ry); - pImpl->cubicTo(cx + rxKappa, cy - ry, cx + rx, cy - ryKappa, cx + rx, cy); + pImpl->moveTo(cx + rx, cy); pImpl->cubicTo(cx + rx, cy + ryKappa, cx + rxKappa, cy + ry, cx, cy + ry); pImpl->cubicTo(cx - rxKappa, cy + ry, cx - rx, cy + ryKappa, cx - rx, cy); pImpl->cubicTo(cx - rx, cy - ryKappa, cx - rxKappa, cy - ry, cx, cy - ry); + pImpl->cubicTo(cx + rxKappa, cy - ry, cx + rx, cy - ryKappa, cx + rx, cy); pImpl->close(); return Result::Success; diff --git a/thirdparty/thorvg/update-thorvg.sh b/thirdparty/thorvg/update-thorvg.sh index a1732d5157b..7e7fd0591c4 100755 --- a/thirdparty/thorvg/update-thorvg.sh +++ b/thirdparty/thorvg/update-thorvg.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -VERSION=0.12.0 +VERSION=0.12.1 cd thirdparty/thorvg/ || true rm -rf AUTHORS LICENSE inc/ src/ *.zip *.tar.gz tmp/