mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:19:22 +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;
|
function numRects: Integer;
|
||||||
procedure translate(dx, dy: Integer);
|
procedure translate(dx, dy: Integer);
|
||||||
property IsPolyRegion: Boolean read GetIsPolyRegion;
|
property IsPolyRegion: Boolean read GetIsPolyRegion;
|
||||||
|
property Polygon: QPolygonH read FPolygon;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// NOTE: PQtDCData was a pointer to a structure with QPainter information
|
// NOTE: PQtDCData was a pointer to a structure with QPainter information
|
||||||
|
@ -2332,6 +2332,8 @@ var
|
|||||||
R: TRect;
|
R: TRect;
|
||||||
hasClipping: Boolean;
|
hasClipping: Boolean;
|
||||||
QtDC: TQtDeviceContext;
|
QtDC: TQtDeviceContext;
|
||||||
|
APath: QPainterPathH;
|
||||||
|
APolyFH: QPolygonFH;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQtWinAPI}
|
{$ifdef VerboseQtWinAPI}
|
||||||
DebugLn('[WinAPI FillRgn Rgn=', dbgs(RegionHnd),' Brush=', dbghex(hbr));
|
DebugLn('[WinAPI FillRgn Rgn=', dbgs(RegionHnd),' Brush=', dbghex(hbr));
|
||||||
@ -2345,15 +2347,33 @@ begin
|
|||||||
|
|
||||||
HasClipping := QtDC.getClipping;
|
HasClipping := QtDC.getClipping;
|
||||||
QtDC.save;
|
QtDC.save;
|
||||||
|
|
||||||
if HasClipping then
|
if HasClipping then
|
||||||
OldRgn := TQtRegion.Create(True);
|
OldRgn := TQtRegion.Create(True)
|
||||||
|
else
|
||||||
|
OldRgn := nil;
|
||||||
try
|
try
|
||||||
if HasClipping then
|
if HasClipping then
|
||||||
QPainter_clipRegion(QtDC.Widget, OldRgn.FHandle);
|
QPainter_clipRegion(QtDC.Widget, OldRgn.FHandle);
|
||||||
|
|
||||||
if SelectClipRgn(DC, RegionHnd) <> ERROR then
|
if SelectClipRgn(DC, RegionHnd) <> ERROR then
|
||||||
begin
|
begin
|
||||||
R := TQtRegion(RegionHnd).getBoundingRect;
|
if TQtRegion(RegionHnd).IsPolyRegion then
|
||||||
QtDC.fillRect(@R, TQtBrush(hbr).FHandle);
|
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
|
if HasClipping then
|
||||||
SelectClipRgn(DC, HRGN(OldRgn));
|
SelectClipRgn(DC, HRGN(OldRgn));
|
||||||
Result := True;
|
Result := True;
|
||||||
@ -2363,7 +2383,6 @@ begin
|
|||||||
OldRgn.Free;
|
OldRgn.Free;
|
||||||
QtDC.restore;
|
QtDC.restore;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user