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

Thorsten Behrens thb at libreoffice.org
Mon Nov 4 16:34:21 UTC 2019


(re-sent due to odd fdo bounces)

Hey Luboš,

Luboš Luňák wrote:
> 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?
>
Yes, essentially all graphics systems fill polygons like that
(including 3D ones). The reason is that otherwise you cannot render
pixel-perfect adjacent polygons without occasional overlap (especially
for non-straight connecting lines).

So really drawRect() is the odd one out, as Caolan suggested.

...and now you know why the code is so littered with this +1/-1
corrections for rectangles. The (now gone) software renderer in
basebmp had some comments about those subtleties, and some explicit
adjustments in the svp backend layer above.

Cheers,

-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1032 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20191104/f5ef309f/attachment.sig>


More information about the LibreOffice mailing list