Commit 7478ee80 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid
Browse files

Tweak Annot rendering code for when border width is 0

Fixes issue #997
parent 3d69e0de
Pipeline #234273 failed with stages
in 7 minutes and 52 seconds
...@@ -5385,15 +5385,20 @@ void AnnotGeometry::draw(Gfx *gfx, bool printing) ...@@ -5385,15 +5385,20 @@ void AnnotGeometry::draw(Gfx *gfx, bool printing)
if (type == typeSquare) { if (type == typeSquare) {
appearBuilder.appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} re\n", borderWidth / 2.0, borderWidth / 2.0, (rect->x2 - rect->x1) - borderWidth, (rect->y2 - rect->y1) - borderWidth); appearBuilder.appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} re\n", borderWidth / 2.0, borderWidth / 2.0, (rect->x2 - rect->x1) - borderWidth, (rect->y2 - rect->y1) - borderWidth);
if (fill) if (fill) {
appearBuilder.append("b\n"); if (borderWidth > 0) {
else appearBuilder.append("b\n");
} else {
appearBuilder.append("f\n");
}
} else if (borderWidth > 0) {
appearBuilder.append("S\n"); appearBuilder.append("S\n");
}
} else { } else {
const double rx { (rect->x2 - rect->x1) / 2. }; const double rx { (rect->x2 - rect->x1) / 2. };
const double ry { (rect->y2 - rect->y1) / 2. }; const double ry { (rect->y2 - rect->y1) / 2. };
const double bwHalf { borderWidth / 2.0 }; const double bwHalf { borderWidth / 2.0 };
appearBuilder.drawEllipse(rx, ry, rx - bwHalf, ry - bwHalf, fill, true); appearBuilder.drawEllipse(rx, ry, rx - bwHalf, ry - bwHalf, fill, borderWidth > 0);
} }
appearBuilder.append("Q\n"); appearBuilder.append("Q\n");
...@@ -5711,9 +5716,14 @@ void AnnotPolygon::draw(Gfx *gfx, bool printing) ...@@ -5711,9 +5716,14 @@ void AnnotPolygon::draw(Gfx *gfx, bool printing)
appearBBox->extendTo(vertices->getX(i) - rect->x1, vertices->getY(i) - rect->y1); appearBBox->extendTo(vertices->getX(i) - rect->x1, vertices->getY(i) - rect->y1);
} }
const double borderWidth = border->getWidth();
if (interiorColor && interiorColor->getSpace() != AnnotColor::colorTransparent) { if (interiorColor && interiorColor->getSpace() != AnnotColor::colorTransparent) {
appearBuilder.append("b\n"); if (borderWidth > 0) {
} else { appearBuilder.append("b\n");
} else {
appearBuilder.append("f\n");
}
} else if (borderWidth > 0) {
appearBuilder.append("s\n"); appearBuilder.append("s\n");
} }
} }
......
Markdown is supported
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