mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-24 07:59:52 +01:00
gtk2: fix GetClipRGN
git-svn-id: trunk@38744 -
This commit is contained in:
parent
f997ff974d
commit
c236cc35fc
@ -4582,22 +4582,21 @@ begin
|
|||||||
CurRegionObject := ClipRegion^.GDIRegionObject;
|
CurRegionObject := ClipRegion^.GDIRegionObject;
|
||||||
ARect := Rect(0, 0, 0, 0);
|
ARect := Rect(0, 0, 0, 0);
|
||||||
if Assigned(CurRegionObject) then
|
if Assigned(CurRegionObject) then
|
||||||
begin
|
|
||||||
// create a copy of the current clipregion
|
// create a copy of the current clipregion
|
||||||
ClipRegionWithDCOffset := gdk_region_copy(CurRegionObject);
|
ClipRegionWithDCOffset := gdk_region_copy(CurRegionObject)
|
||||||
// move it to the DC offset
|
|
||||||
// Example: if the ClipRegion is at 10,10 and the DCOrigin is at 10,10,
|
|
||||||
// then the ClipRegion must be moved to 0,0
|
|
||||||
DCOrigin := Offset;
|
|
||||||
//debugln('TGtk2WidgetSet.GetClipRGN DCOrigin=',dbgs(DCOrigin),' CurRegionObject=',dbgs(CurRegionObject),' ',dbgs(ARect));
|
|
||||||
gdk_region_offset(ClipRegionWithDCOffset, -DCOrigin.x, -DCOrigin.Y);
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// create a default clipregion
|
// create a default clipregion
|
||||||
GetClipBox(DC, @ARect);
|
GetClipBox(DC, @ARect);
|
||||||
|
LPtoDP(DC, ARect, 2);
|
||||||
ClipRegionWithDCOffset := CreateRectGDKRegion(ARect);
|
ClipRegionWithDCOffset := CreateRectGDKRegion(ARect);
|
||||||
end;
|
end;
|
||||||
|
// move it to the DC offset
|
||||||
|
// Example: if the ClipRegion is at 10,10 and the DCOrigin is at 10,10,
|
||||||
|
// then the ClipRegion must be moved to 0,0
|
||||||
|
DCOrigin := Offset;
|
||||||
|
gdk_region_offset(ClipRegionWithDCOffset, -DCOrigin.x, -DCOrigin.Y);
|
||||||
|
|
||||||
// free the old region in RGN
|
// free the old region in RGN
|
||||||
if Assigned({%H-}PGdiObject(RGN)^.GDIRegionObject) then
|
if Assigned({%H-}PGdiObject(RGN)^.GDIRegionObject) then
|
||||||
gdk_region_destroy({%H-}PGdiObject(RGN)^.GDIRegionObject);
|
gdk_region_destroy({%H-}PGdiObject(RGN)^.GDIRegionObject);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user