From c236cc35fc1e156768d66793dd8c6083bb0c127f Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 19 Sep 2012 06:27:39 +0000 Subject: [PATCH] gtk2: fix GetClipRGN git-svn-id: trunk@38744 - --- lcl/interfaces/gtk2/gtk2winapi.inc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lcl/interfaces/gtk2/gtk2winapi.inc b/lcl/interfaces/gtk2/gtk2winapi.inc index 0536d9af7c..75571ee3fd 100644 --- a/lcl/interfaces/gtk2/gtk2winapi.inc +++ b/lcl/interfaces/gtk2/gtk2winapi.inc @@ -4582,22 +4582,21 @@ begin CurRegionObject := ClipRegion^.GDIRegionObject; ARect := Rect(0, 0, 0, 0); if Assigned(CurRegionObject) then - begin // create a copy of the current clipregion - 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 + ClipRegionWithDCOffset := gdk_region_copy(CurRegionObject) else begin // create a default clipregion GetClipBox(DC, @ARect); + LPtoDP(DC, ARect, 2); ClipRegionWithDCOffset := CreateRectGDKRegion(ARect); 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 if Assigned({%H-}PGdiObject(RGN)^.GDIRegionObject) then gdk_region_destroy({%H-}PGdiObject(RGN)^.GDIRegionObject);