mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 14:29:31 +02:00
Qt: use QPolygonH to draw poly regions in FillRgn()
git-svn-id: trunk@40954 -
This commit is contained in:
parent
20be8a3fc1
commit
1c729ef89c
@ -347,6 +347,7 @@ type
|
||||
function numRects: Integer;
|
||||
procedure translate(dx, dy: Integer);
|
||||
property IsPolyRegion: Boolean read GetIsPolyRegion;
|
||||
property Polygon: QPolygonH read FPolygon;
|
||||
end;
|
||||
|
||||
// NOTE: PQtDCData was a pointer to a structure with QPainter information
|
||||
|
@ -2332,6 +2332,8 @@ var
|
||||
R: TRect;
|
||||
hasClipping: Boolean;
|
||||
QtDC: TQtDeviceContext;
|
||||
APath: QPainterPathH;
|
||||
APolyFH: QPolygonFH;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
DebugLn('[WinAPI FillRgn Rgn=', dbgs(RegionHnd),' Brush=', dbghex(hbr));
|
||||
@ -2345,15 +2347,33 @@ begin
|
||||
|
||||
HasClipping := QtDC.getClipping;
|
||||
QtDC.save;
|
||||
|
||||
if HasClipping then
|
||||
OldRgn := TQtRegion.Create(True);
|
||||
OldRgn := TQtRegion.Create(True)
|
||||
else
|
||||
OldRgn := nil;
|
||||
try
|
||||
if HasClipping then
|
||||
QPainter_clipRegion(QtDC.Widget, OldRgn.FHandle);
|
||||
|
||||
if SelectClipRgn(DC, RegionHnd) <> ERROR then
|
||||
begin
|
||||
R := TQtRegion(RegionHnd).getBoundingRect;
|
||||
QtDC.fillRect(@R, TQtBrush(hbr).FHandle);
|
||||
if TQtRegion(RegionHnd).IsPolyRegion then
|
||||
begin
|
||||
APath := QPainterPath_create();
|
||||
APolyFH := QPolygonF_create(TQtRegion(RegionHnd).Polygon);
|
||||
try
|
||||
QPainterPath_addPolygon(APath, APolyFH);
|
||||
QPainter_fillPath(QtDC.Widget, APath, TQtBrush(hbr).FHandle);
|
||||
finally
|
||||
QPainterPath_destroy(APath);
|
||||
QPolygonF_destroy(APolyFH);
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
R := TQtRegion(RegionHnd).getBoundingRect;
|
||||
QtDC.fillRect(@R, TQtBrush(hbr).FHandle);
|
||||
end;
|
||||
if HasClipping then
|
||||
SelectClipRgn(DC, HRGN(OldRgn));
|
||||
Result := True;
|
||||
@ -2363,7 +2383,6 @@ begin
|
||||
OldRgn.Free;
|
||||
QtDC.restore;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user