mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 09:39:09 +02:00
(Qt): handle null region in SelectClipRgn
git-svn-id: trunk@11715 -
This commit is contained in:
parent
a1a71f0c90
commit
e29b652d4d
@ -3724,41 +3724,35 @@ var
|
|||||||
ARegion: QRegionH;
|
ARegion: QRegionH;
|
||||||
Painter: QPainterH;
|
Painter: QPainterH;
|
||||||
R: TRect;
|
R: TRect;
|
||||||
R1: PRect;
|
|
||||||
begin
|
begin
|
||||||
result := ERROR;
|
Result := ERROR;
|
||||||
if IsValidDC(DC) then
|
if IsValidDC(DC) then
|
||||||
begin
|
begin
|
||||||
Painter := TQtDeviceContext(DC).Widget;
|
Painter := TQtDeviceContext(DC).Widget;
|
||||||
QPainter_setClipRegion(Painter, TQtRegion(Rgn).Widget);
|
if RGN <> 0 then
|
||||||
|
QPainter_setClipRegion(Painter, TQtRegion(Rgn).Widget)
|
||||||
|
else
|
||||||
|
QPainter_setClipRegion(Painter, nil, QtNoClip);
|
||||||
if QPainter_hasClipping(Painter) then
|
if QPainter_hasClipping(Painter) then
|
||||||
begin
|
begin
|
||||||
ARegion := QRegion_Create;
|
ARegion := QRegion_Create;
|
||||||
try
|
try
|
||||||
QPainter_ClipRegion(Painter, ARegion);
|
QPainter_ClipRegion(Painter, ARegion);
|
||||||
if QRegion_isEmpty(ARegion) then
|
if QRegion_isEmpty(ARegion) then
|
||||||
result := NULLREGION
|
Result := NULLREGION
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
QRegion_boundingRect(ARegion, @R);
|
QRegion_boundingRect(ARegion, @R);
|
||||||
New(R1);
|
if QRegion_contains(ARegion, PRect(@R)) then
|
||||||
try
|
Result := SIMPLEREGION
|
||||||
R1^ := R;
|
|
||||||
if QRegion_contains(ARegion, R1)
|
|
||||||
then
|
|
||||||
result := SIMPLEREGION
|
|
||||||
else
|
else
|
||||||
Result := COMPLEXREGION;
|
Result := COMPLEXREGION;
|
||||||
finally
|
|
||||||
Dispose(R1);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
QRegion_Destroy(ARegion);
|
QRegion_Destroy(ARegion);
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else
|
||||||
result := NULLREGION;
|
Result := NULLREGION;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user