Commit 2988fd1c authored by Volker Krause's avatar Volker Krause
Browse files

Include the pen width in computing vector bounding boxes

Rendering a stroke on the edge would otherwise be cut off potentially.
parent 380d868e
...@@ -59,10 +59,15 @@ QRectF PdfVectorPicture::boundingRect() const ...@@ -59,10 +59,15 @@ QRectF PdfVectorPicture::boundingRect() const
if (d->strokes.empty()) { if (d->strokes.empty()) {
return {}; return {};
} }
double maxPenWidth = 0.0;
if (d->boundingRect.isEmpty()) { if (d->boundingRect.isEmpty()) {
for (const auto &stroke : d->strokes) { for (const auto &stroke : d->strokes) {
d->boundingRect = d->boundingRect.united(stroke.path.boundingRect()); d->boundingRect = d->boundingRect.united(stroke.path.boundingRect());
maxPenWidth = std::max(maxPenWidth, stroke.pen.widthF());
} }
// include the pen width, for strokes drawn on the boundary
d->boundingRect.adjust(-maxPenWidth, -maxPenWidth, maxPenWidth, maxPenWidth);
} }
return d->boundingRect; return d->boundingRect;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment