VCL drawPolygon() off-by-one without line color
Luboš Luňák
l.lunak at collabora.com
Fri Nov 1 12:40:54 UTC 2019
Hello,
if I run "SAL_USE_VCLPLUGIN=<plugin> bin/run visualbackendtest" and hit Space
once to get to the screen that shows filled rectangles (and diamonds), the
second and third rectangles miss their right and bottom edges. The first one
is correct, and it is because that one uses drawRect(), while the other two
use draw(Poly)Polygon(). And this happens only if line color is unset, so
that it's only filled with the fill color.
What I find really strange is that this happens with whatever VCL plugin and
drawing system I use, GDI, X11, Cairo, Skia, OpenGL. And I've checked and we
pass the polygons correctly to the underlying drawing system and they all do
not draw the right-most and bottom-most line of pixels.
Is this some kind of a strange rule that I'm not aware of? Does somebody know
a good reason why all graphics libraries would do this?
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. This also means that the left-most and top-most lines of pixels
would be drawn twice, but we already do that if line color is set, so
presumably that's not a problem in practice.
--
Luboš Luňák
l.lunak at collabora.com
More information about the LibreOffice
mailing list