diff --git a/CMakeLists.txt b/CMakeLists.txt index ca32d22..19d9c28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,11 @@ set(LUNASVG_VERSION_MICRO 0) project(lunasvg LANGUAGES CXX VERSION ${LUNASVG_VERSION_MAJOR}.${LUNASVG_VERSION_MINOR}.${LUNASVG_VERSION_MICRO}) +find_package(plutovg 0.0.4 QUIET) +if(NOT plutovg_FOUND) + add_subdirectory(plutovg) +endif() + set(lunasvg_sources source/lunasvg.cpp source/graphics.cpp @@ -32,11 +37,6 @@ set(lunasvg_headers source/svgtextelement.h ) -find_package(plutovg 0.0.4 QUIET) -if(NOT plutovg_FOUND) - add_subdirectory(plutovg) -endif() - add_library(lunasvg ${lunasvg_sources} ${lunasvg_headers}) add_library(lunasvg::lunasvg ALIAS lunasvg) diff --git a/plutovg b/plutovg index 5636fe5..3e6f922 160000 --- a/plutovg +++ b/plutovg @@ -1 +1 @@ -Subproject commit 5636fe5954461856dbd27a5c916e93299f33606d +Subproject commit 3e6f922f453da1c9e7d1d7f66cac1d9724a18b47 diff --git a/source/svgpaintelement.cpp b/source/svgpaintelement.cpp index 4f53ab3..16c3e3d 100644 --- a/source/svgpaintelement.cpp +++ b/source/svgpaintelement.cpp @@ -178,10 +178,6 @@ bool SVGRadialGradientElement::applyPaint(SVGRenderState& state, float opacity) if(gradientStops.empty()) return false; LengthContext lengthContext(this, attributes.gradientUnits()); - auto fx = lengthContext.valueForLength(attributes.fx()); - auto fy = lengthContext.valueForLength(attributes.fy()); - auto cx = lengthContext.valueForLength(attributes.cx()); - auto cy = lengthContext.valueForLength(attributes.cy()); auto r = lengthContext.valueForLength(attributes.r()); if(r == 0.f || gradientStops.size() == 1) { const auto& lastStop = gradientStops.back(); @@ -189,6 +185,11 @@ bool SVGRadialGradientElement::applyPaint(SVGRenderState& state, float opacity) return true; } + auto fx = lengthContext.valueForLength(attributes.fx()); + auto fy = lengthContext.valueForLength(attributes.fy()); + auto cx = lengthContext.valueForLength(attributes.cx()); + auto cy = lengthContext.valueForLength(attributes.cy()); + auto spreadMethod = attributes.spreadMethod(); auto gradientUnits = attributes.gradientUnits(); auto gradientTransform = attributes.gradientTransform(); @@ -300,6 +301,7 @@ bool SVGPatternElement::applyPaint(SVGRenderState& state, float opacity) const SVGRenderState newState(this, &state, patternImageTransform, SVGRenderMode::Painting, patternImage); patternContentElement->renderChildren(newState); + auto patternTransform = attributes.patternTransform(); patternTransform.translate(patternRect.x, patternRect.y); patternTransform.scale(1.f / xScale, 1.f / yScale);