Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sammycage committed Jan 31, 2025
1 parent 8ded93c commit 2fed0fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion plutovg
10 changes: 6 additions & 4 deletions source/svgpaintelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,18 @@ 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();
state->setColor(lastStop.color.r, lastStop.color.g, lastStop.color.b, lastStop.color.a);
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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2fed0fc

Please sign in to comment.