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 bounding rect when there's a textPath.

Wolthera van Hövell tot Westerflier8ee40ea45ff8
diff --git a/libs/flake/text/KoSvgTextShape.cpp b/libs/flake/text/KoSvgTextShape.cpp
index 12dd34774d..7a559075c4 100644
--- a/libs/flake/text/KoSvgTextShape.cpp
+++ b/libs/flake/text/KoSvgTextShape.cpp
@@ -1935,7 +1935,6 @@ void KoSvgTextShape::paintStroke(QPainter &painter) const
QPainterPath KoSvgTextShape::outline() const {
QPainterPath result;
if (!d->internalShapes().isEmpty()) {
- // TODO: Cache the computed wrapping shapes and draw their outlines instead.
Q_FOREACH(KoShape *shape, d->internalShapes()) {
result.addPath(shape->transformation().map(shape->outline()));
}
@@ -1958,13 +1957,14 @@ QRectF KoSvgTextShape::outlineRect() const
QRectF KoSvgTextShape::boundingRect() const
{
- QRectF result;
+ QRectF shapesRect;
if (d->internalShapesPainter->contentRect().isValid()) {
- result |= d->internalShapesPainter->contentRect();
+ shapesRect = d->internalShapesPainter->contentRect();
if (!(d->shapesInside.isEmpty() && d->shapesSubtract.isEmpty())) {
- return result;
+ return shapesRect;
}
}
+ QRectF result;
QList<KoShapeStrokeModelSP> parentStrokes;
for (auto it = d->textData.compositionBegin(); it != d->textData.compositionEnd(); it++) {
@@ -1995,7 +1995,7 @@ QRectF KoSvgTextShape::boundingRect() const
}
}
- return this->absoluteTransformation().mapRect(result);
+ return (this->absoluteTransformation().mapRect(result) | shapesRect);
}
QSizeF KoSvgTextShape::size() const