TGraphicControl draws Polygon relative to owner in gtk2 when Pen.style = psClear
Original Reporter info from Mantis: wp @wpam
-
Reporter name:
Original Reporter info from Mantis: wp @wpam
- Reporter name:
Description:
A control derived from TGraphicControl is not drawn correctly in gtk2 when a particular overload of the Polygon method is called with Pen.Style = psClear.
See forum discussion https://forum.lazarus.freepascal.org/index.php/topic,54329.msg404509.html#msg404509.
Steps to reproduce:
The attached project implements a simple descendant of TGraphicControl which draws two red rectangles inside its interior. The first one (left) is drawn by
Canvas.Polygon([Point(20, 20), Point(80, 20), Point(80, 80), Point(20, 80)]);
the second one (right) is drawn by
var
P: Array[0..3] of TPoint;
...
P[0] := Point(80, 20);
P[1] := Point(140, 20);
P[2] := Point(140, 80);
P[3] := Point(80, 80);
Canvas.Polygon(P, 4);
In the demo program the control is right-bottom-anchored to its containing form. When the form size is changed the control thus follows the right/bottom corner of the form and, of course, the inner rectangles are expected to follow the control. But only the second rectangle does this, the first rectangle remains stationary on the form.
It turned out that the state of the Pen.Style is critical for this issue. The error occurs when Pen.Style = psClear when the Polygon is drawn. Swithching Pen.Style to psSolid (by UNDEFining the define SHOW_BUG) also the first rectangle is painted as expected.
Additional information:
The error occurs only on gtk2 widgetset. gtk3, qt5, win32 and cocoa are behaving correctly.
Mantis conversion info:
- Mantis ID: 38852
- Fixed in revision: 65088 (#426f9a53)
- Monitored by: » AntonK (Anton Kavalenka)