Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix too slow rendering of SVG with clip masks

Dmitry Kazakovd01ed5efaab6
diff --git a/libs/flake/KoShapeManager.cpp b/libs/flake/KoShapeManager.cpp
index bcd5397556..509935a295 100644
--- a/libs/flake/KoShapeManager.cpp
+++ b/libs/flake/KoShapeManager.cpp
@@ -210,9 +210,13 @@ void renderShapes(typename KisForest<KoShape*>::child_iterator beginIt,
KoClipMask *clipMask = shape->clipMask();
if (clipMask) {
- const QRectF bounds = painter.transform().mapRect(shape->outlineRect());
+ /**
+ * We should clip on both, the shape and the global clipping rect.
+ * Otherwise filling huge shapes will go into almost infinite loop.
+ */
+ const QRectF bounds = painter.transform().mapRect(shape->outlineRect() & painter.clipBoundingRect());
- clipMaskPainter.reset(new KoClipMaskPainter(&painter, bounds/*shape->boundingRect())*/));
+ clipMaskPainter.reset(new KoClipMaskPainter(&painter, bounds));
shapePainter = clipMaskPainter->shapePainter();
}