Skip to content

Commit 8e2b05e

Browse files
committed
thorvg: Update to 0.15.11
1 parent 28102e6 commit 8e2b05e

12 files changed

+43
-31
lines changed

thirdparty/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ Patches:
944944
## thorvg
945945

946946
- Upstream: https://github.com/thorvg/thorvg
947-
- Version: 0.15.10 (bca94d244c67f573c6eddc27d783d9a6b1ef2f1b, 2025)
947+
- Version: 0.15.11 (61360cf6db0a05a8dd2ebdcc44d4cbbc315692ec, 2025)
948948
- License: MIT
949949

950950
Files extracted from upstream source:

thirdparty/thorvg/inc/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
// For internal debugging:
1616
//#define THORVG_LOG_ENABLED
1717

18-
#define THORVG_VERSION_STRING "0.15.10"
18+
#define THORVG_VERSION_STRING "0.15.11"
1919
#endif

thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -3382,6 +3382,7 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
33823382
if (node->type != SvgNodeType::Defs || !empty) {
33833383
loader->stack.push(node);
33843384
}
3385+
loader->latestGradient = nullptr;
33853386
} else if ((method = _findGraphicsFactory(tagName))) {
33863387
if (loader->stack.count > 0) parent = loader->stack.last();
33873388
else parent = loader->doc;
@@ -3392,6 +3393,7 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
33923393
loader->stack.push(defs);
33933394
loader->currentGraphicsNode = node;
33943395
}
3396+
loader->latestGradient = nullptr;
33953397
} else if ((gradientMethod = _findGradientFactory(tagName))) {
33963398
SvgStyleGradient* gradient;
33973399
gradient = gradientMethod(loader, attrs, attrsLength);
@@ -3417,8 +3419,9 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
34173419
loader->svgParse->flags = SvgStopStyleFlags::StopDefault;
34183420
simpleXmlParseAttributes(attrs, attrsLength, _attrParseStops, loader);
34193421
loader->latestGradient->stops.push(loader->svgParse->gradStop);
3420-
} else if (!isIgnoreUnsupportedLogElements(tagName)) {
3421-
TVGLOG("SVG", "Unsupported elements used [Elements: %s]", tagName);
3422+
} else {
3423+
loader->latestGradient = nullptr;
3424+
if (!isIgnoreUnsupportedLogElements(tagName)) TVGLOG("SVG", "Unsupported elements used [Elements: %s]", tagName);
34223425
}
34233426
}
34243427

thirdparty/thorvg/src/renderer/sw_engine/tvgSwCommon.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -448,19 +448,19 @@ static inline uint32_t opBlendColorDodge(uint32_t s, uint32_t d, TVG_UNUSED uint
448448
{
449449
// d / (1 - s)
450450
s = 0xffffffff - s;
451-
auto c1 = (C1(s) == 0) ? C1(d) : std::min(C1(d) * 255 / C1(s), 255);
452-
auto c2 = (C2(s) == 0) ? C2(d) : std::min(C2(d) * 255 / C2(s), 255);
453-
auto c3 = (C3(s) == 0) ? C3(d) : std::min(C3(d) * 255 / C3(s), 255);
451+
auto c1 = C1(d) == 0 ? 0 : (C1(s) == 0 ? 255 : std::min(C1(d) * 255 / C1(s), 255));
452+
auto c2 = C2(d) == 0 ? 0 : (C2(s) == 0 ? 255 : std::min(C2(d) * 255 / C2(s), 255));
453+
auto c3 = C3(d) == 0 ? 0 : (C3(s) == 0 ? 255 : std::min(C3(d) * 255 / C3(s), 255));
454454
return JOIN(255, c1, c2, c3);
455455
}
456456

457457
static inline uint32_t opBlendColorBurn(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a)
458458
{
459459
// 1 - (1 - d) / s
460460
auto id = 0xffffffff - d;
461-
auto c1 = (C1(s) == 0) ? C1(d) : 255 - std::min(C1(id) * 255 / C1(s), 255);
462-
auto c2 = (C2(s) == 0) ? C2(d) : 255 - std::min(C2(id) * 255 / C2(s), 255);
463-
auto c3 = (C3(s) == 0) ? C3(d) : 255 - std::min(C3(id) * 255 / C3(s), 255);
461+
auto c1 = C1(d) == 255 ? 255 : (C1(s) == 0 ? 0 : 255 - std::min(C1(id) * 255 / C1(s), 255));
462+
auto c2 = C2(d) == 255 ? 255 : (C2(s) == 0 ? 0 : 255 - std::min(C2(id) * 255 / C2(s), 255));
463+
auto c3 = C3(d) == 255 ? 255 : (C3(s) == 0 ? 0 : 255 - std::min(C3(id) * 255 / C3(s), 255));
464464

465465
return JOIN(255, c1, c2, c3);
466466
}

thirdparty/thorvg/src/renderer/sw_engine/tvgSwPostEffect.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ static void _dropShadowFilter(uint32_t* dst, uint32_t* src, int stride, int w, i
266266
}
267267

268268

269-
static void _dropShadowShift(uint32_t* dst, uint32_t* src, int stride, SwBBox& region, SwPoint& offset, uint8_t opacity, bool direct)
269+
static void _dropShadowShift(uint32_t* dst, uint32_t* src, int dstride, int sstride, SwBBox& region, SwPoint& offset, uint8_t opacity, bool direct)
270270
{
271-
src += (region.min.y * stride + region.min.x);
272-
dst += (region.min.y * stride + region.min.x);
271+
src += (region.min.y * sstride + region.min.x);
272+
dst += (region.min.y * dstride + region.min.x);
273273

274274
auto w = region.max.x - region.min.x;
275275
auto h = region.max.y - region.min.y;
@@ -279,14 +279,14 @@ static void _dropShadowShift(uint32_t* dst, uint32_t* src, int stride, SwBBox& r
279279
if (region.min.x + offset.x < 0) src -= offset.x;
280280
else dst += offset.x;
281281

282-
if (region.min.y + offset.y < 0) src -= (offset.y * stride);
283-
else dst += (offset.y * stride);
282+
if (region.min.y + offset.y < 0) src -= (offset.y * sstride);
283+
else dst += (offset.y * dstride);
284284

285285
for (auto y = 0; y < h; ++y) {
286286
if (translucent) rasterTranslucentPixel32(dst, src, w, opacity);
287287
else rasterPixel32(dst, src, w, opacity);
288-
src += stride;
289-
dst += stride;
288+
src += sstride;
289+
dst += dstride;
290290
}
291291
}
292292

@@ -389,14 +389,14 @@ bool effectDropShadow(SwCompositor* cmp, SwSurface* surface[2], const RenderEffe
389389

390390
//draw to the main surface directly
391391
if (direct) {
392-
_dropShadowShift(cmp->recoverSfc->buf32, cmp->image.buf32, stride, bbox, data->offset, opacity, direct);
392+
_dropShadowShift(cmp->recoverSfc->buf32, cmp->image.buf32, cmp->recoverSfc->stride, stride, bbox, data->offset, opacity, direct);
393393
std::swap(cmp->image.buf32, buffer[0]->buf32);
394394
return true;
395395
}
396396

397397
//draw to the intermediate surface
398398
rasterClear(surface[1], bbox.min.x, bbox.min.y, w, h);
399-
_dropShadowShift(buffer[1]->buf32, cmp->image.buf32, stride, bbox, data->offset, opacity, direct);
399+
_dropShadowShift(buffer[1]->buf32, cmp->image.buf32, stride, stride, bbox, data->offset, opacity, direct);
400400
std::swap(cmp->image.buf32, buffer[1]->buf32);
401401

402402
//compositing shadow and body

thirdparty/thorvg/src/renderer/sw_engine/tvgSwRaster.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ bool rasterConvertCS(RenderSurface* surface, ColorSpace to)
18131813
//TODO: SIMD OPTIMIZATION?
18141814
void rasterXYFlip(uint32_t* src, uint32_t* dst, int32_t stride, int32_t w, int32_t h, const SwBBox& bbox, bool flipped)
18151815
{
1816-
constexpr int BLOCK = 8; //experimental decision
1816+
constexpr int32_t BLOCK = 8; //experimental decision
18171817

18181818
if (flipped) {
18191819
src += ((bbox.min.x * stride) + bbox.min.y);
@@ -1824,16 +1824,16 @@ void rasterXYFlip(uint32_t* src, uint32_t* dst, int32_t stride, int32_t w, int32
18241824
}
18251825

18261826
#pragma omp parallel for
1827-
for (int x = 0; x < w; x += BLOCK) {
1827+
for (int32_t x = 0; x < w; x += BLOCK) {
18281828
auto bx = std::min(w, x + BLOCK) - x;
18291829
auto in = &src[x];
18301830
auto out = &dst[x * stride];
1831-
for (int y = 0; y < h; y += BLOCK) {
1831+
for (int32_t y = 0; y < h; y += BLOCK) {
18321832
auto p = &in[y * stride];
18331833
auto q = &out[y];
18341834
auto by = std::min(h, y + BLOCK) - y;
1835-
for (int xx = 0; xx < bx; ++xx) {
1836-
for (int yy = 0; yy < by; ++yy) {
1835+
for (int32_t xx = 0; xx < bx; ++xx) {
1836+
for (int32_t yy = 0; yy < by; ++yy) {
18371837
*q = *p;
18381838
p += stride;
18391839
++q;

thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ struct SwShapeTask : SwTask
121121
auto visibleFill = false;
122122

123123
//This checks also for the case, if the invisible shape turned to visible by alpha.
124-
auto prepareShape = false;
125-
if (!shapePrepared(&shape) && (flags & RenderUpdateFlag::Color)) prepareShape = true;
124+
auto prepareShape = !shapePrepared(&shape) && flags & (RenderUpdateFlag::Color | RenderUpdateFlag::Gradient);
126125

127126
//Shape
128127
if (flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform) || prepareShape) {
@@ -186,6 +185,7 @@ struct SwShapeTask : SwTask
186185
err:
187186
bbox.reset();
188187
shapeReset(&shape);
188+
rleReset(shape.strokeRle);
189189
shapeDelOutline(&shape, mpool, tid);
190190
}
191191

thirdparty/thorvg/src/renderer/sw_engine/tvgSwRle.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ static bool _setCell(RleWorker& rw, SwPoint pos)
482482
static bool _startCell(RleWorker& rw, SwPoint pos)
483483
{
484484
if (pos.x > rw.cellMax.x) pos.x = rw.cellMax.x;
485-
if (pos.x < rw.cellMin.x) pos.x = rw.cellMin.x;
485+
if (pos.x < rw.cellMin.x) pos.x = rw.cellMin.x - 1;
486486

487487
rw.area = 0;
488488
rw.cover = 0;
@@ -866,6 +866,8 @@ void _replaceClipSpan(SwRle *rle, SwSpan* clippedSpans, uint32_t size)
866866

867867
SwRle* rleRender(SwRle* rle, const SwOutline* outline, const SwBBox& renderRegion, bool antiAlias)
868868
{
869+
if (!outline) return nullptr;
870+
869871
constexpr auto RENDER_POOL_SIZE = 16384L;
870872
constexpr auto BAND_SIZE = 40;
871873

thirdparty/thorvg/src/renderer/sw_engine/tvgSwShape.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,6 @@ void shapeDelOutline(SwShape* shape, SwMpool* mpool, uint32_t tid)
543543
void shapeReset(SwShape* shape)
544544
{
545545
rleReset(shape->rle);
546-
rleReset(shape->strokeRle);
547546
shape->fastTrack = false;
548547
shape->bbox.reset();
549548
}

thirdparty/thorvg/src/renderer/tvgLoader.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,11 @@ bool LoaderMgr::term()
267267
auto loader = _activeLoaders.head;
268268

269269
//clean up the remained font loaders which is globally used.
270-
while (loader && loader->type == FileType::Ttf) {
270+
while (loader) {
271+
if (loader->type != FileType::Ttf) {
272+
loader = loader->next;
273+
continue;
274+
}
271275
auto ret = loader->close();
272276
auto tmp = loader;
273277
loader = loader->next;

thirdparty/thorvg/src/renderer/tvgText.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ Result Text::load(const std::string& path) noexcept
6262
{
6363
#ifdef THORVG_FILE_IO_SUPPORT
6464
bool invalid; //invalid path
65-
if (!LoaderMgr::loader(path, &invalid)) {
65+
auto loader = LoaderMgr::loader(path, &invalid);
66+
if (loader) {
67+
if (loader->sharing > 0) --loader->sharing; //font loading doesn't mean sharing.
68+
return Result::Success;
69+
} else {
6670
if (invalid) return Result::InvalidArguments;
6771
else return Result::NonSupport;
6872
}

thirdparty/thorvg/update-thorvg.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22

3-
VERSION=0.15.10
3+
VERSION=0.15.11
44
# Uncomment and set a git hash to use specific commit instead of tag.
55
#GIT_COMMIT=
66

0 commit comments

Comments
 (0)