Skip to content

Commit

Permalink
ThorVG: update from v0.12.0 to v0.12.1
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
capnm committed Jan 12, 2024
1 parent 26b1fd0 commit 0650e72
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,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:
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/thorvg/inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 1 addition & 3 deletions thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
7 changes: 4 additions & 3 deletions thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void mpoolRetDashOutline(SwMpool* mpool, unsigned idx)
}


SwMpool* mpoolInit(unsigned threads)
SwMpool* mpoolInit(uint32_t threads)
{
auto allocSize = threads + 1;

Expand Down
7 changes: 3 additions & 4 deletions thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int32_t>(ymin);
auto yEnd = static_cast<int32_t>(ymax);
auto yStart = static_cast<int>(ymin);
auto yEnd = static_cast<int>(ymax);

if (!_arrange(image, region, yStart, yEnd)) return nullptr;

Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions thirdparty/thorvg/src/renderer/tvgShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/thorvg/update-thorvg.sh
Original file line number Diff line number Diff line change
@@ -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/
Expand Down

0 comments on commit 0650e72

Please sign in to comment.