Skip to content

Commit d925755

Browse files
committed
Revert: Remove minimum scale clamping for pattern rendering #248
This reverts the change that clamped pattern scale values to a minimum of 1.0. While the fix ensured correct rendering for extremely small pattern scales, it caused large intermediate canvas allocations, leading to high memory usage and performance issues in some cases. The visible and practical rendering improvements remain, but the part of the fix that affected tiny sub-pixel scale cases has been reverted to avoid excessive canvas sizes.
1 parent 79e089f commit d925755

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/svgpaintelement.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ bool SVGPatternElement::applyPaint(SVGRenderState& state, float opacity) const
289289
}
290290

291291
auto currentTransform = attributes.patternTransform() * state.currentTransform();
292-
auto xScale = std::max(1.f, currentTransform.xScale());
293-
auto yScale = std::max(1.f, currentTransform.yScale());
292+
auto xScale = currentTransform.xScale();
293+
auto yScale = currentTransform.yScale();
294294

295295
auto patternImage = Canvas::create(0, 0, patternRect.w * xScale, patternRect.h * yScale);
296296
auto patternImageTransform = Transform::scaled(xScale, yScale);
@@ -309,7 +309,7 @@ bool SVGPatternElement::applyPaint(SVGRenderState& state, float opacity) const
309309

310310
auto patternTransform = attributes.patternTransform();
311311
patternTransform.translate(patternRect.x, patternRect.y);
312-
patternTransform.scale(1.f / xScale, 1.f / yScale);
312+
patternTransform.scale(patternRect.w / patternImage->width(), patternRect.h / patternImage->height());
313313
state->setTexture(*patternImage, TextureType::Tiled, opacity, patternTransform);
314314
return true;
315315
}

0 commit comments

Comments
 (0)