qt: fix SelectClipRgn which is uses device coordinates and Qt uses logical

git-svn-id: trunk@24166 -
This commit is contained in:
paul 2010-03-22 08:23:33 +00:00
parent df57e9f69f
commit 518fc97931
2 changed files with 11 additions and 0 deletions

View File

@ -290,6 +290,7 @@ type
function GetRegionType: integer;
function getBoundingRect: TRect;
function numRects: Integer;
procedure translate(dx, dy: Integer);
property IsPolyRegion: Boolean read GetIsPolyRegion;
end;
@ -1798,6 +1799,11 @@ begin
Result := QRegion_numRects(Widget);
end;
procedure TQtRegion.translate(dx, dy: Integer);
begin
QRegion_translate(Widget, dx, dy);
end;
{ TQtDeviceContext }
{------------------------------------------------------------------------------

View File

@ -4312,6 +4312,7 @@ function TQtWidgetSet.SelectClipRGN(DC: hDC; RGN: HRGN): Longint;
var
QtDC: TQtDeviceContext;
EmptyRegion: QRegionH;
P: TPoint;
begin
Result := ERROR;
if IsValidDC(DC) then
@ -4320,6 +4321,10 @@ begin
if IsValidGDIObject(RGN) then
begin
Result := TQtRegion(Rgn).GetRegionType;
// RGN is in Device coordinates. Qt expects logical coordinates
// so we need to convert RGN coords
GetWindowOrgEx(DC, @P);
TQtRegion(Rgn).translate(P.X, P.Y);
QtDC.setClipRegion(TQtRegion(Rgn).Widget);
end else
begin