VCL drawPolygon() off-by-one without line color

Caolán McNamara caolanm at redhat.com
Fri Nov 1 20:48:09 UTC 2019


On Fri, 2019-11-01 at 13:40 +0100, Luboš Luňák wrote:
> , the second and third rectangles miss their right and bottom edges.
> The first one is correct, and it is because that one uses drawRect()

There are so many rectangles there that I'm not sure I see the
difference, but I know that the various ::drawRect implementations are
all hacked to pull in the bottom right by a pixel for the line draw so
drawRect is the "odd" case and drawPolyPolygon is the "normal" one.

vcl/headless/svpgdi.cxx's drawRect just calls drawPolyPolygon with a
-1,-1 for the line case. While X11SalGraphicsImpl::drawRect calls
XDrawRectangle with a -1,-1, AquaSalGraphics::drawRect likewise and so
on. So if they were left to their own "natural" behaviour the drawRect
would presumably give the same results as drawPolyPolygon.

> Also, does anyone see a problem if I fixed this by forcing line color
> to the fill color if unset? The rectangles then would have the
> expected size, but that's assuming that there is not the expectation
> that the border lines would be missing.

Presumably the goal is to get the same results in the skia backend as
the existing ones so if you get the same results I'd call it a job well
done and leave it at that ;-) I imagine any deviation from how it works
currently will just triggers regressions.



More information about the LibreOffice mailing list