mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 14:19:22 +02:00
(Qt): StretchMaskBlt understands Source sizes more than they are in real (with help of Marc)
git-svn-id: trunk@11671 -
This commit is contained in:
parent
2ed9da3c37
commit
720bafd7c4
@ -4420,6 +4420,7 @@ function TQtWidgetSet.StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer;
|
|||||||
XMask, YMask: Integer; Rop: DWORD): Boolean;
|
XMask, YMask: Integer; Rop: DWORD): Boolean;
|
||||||
var
|
var
|
||||||
SrcRect, DstRect: TRect;
|
SrcRect, DstRect: TRect;
|
||||||
|
SrcWidthOrig, SrcHeightOrig: Integer;
|
||||||
Image: QImageH;
|
Image: QImageH;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQtWinAPI}
|
{$ifdef VerboseQtWinAPI}
|
||||||
@ -4433,16 +4434,26 @@ begin
|
|||||||
' WSrc:', dbgs(SrcWidth), ' HSrc:', dbgs(SrcHeight));
|
' WSrc:', dbgs(SrcWidth), ' HSrc:', dbgs(SrcHeight));
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DstRect := Bounds(X, Y, Width, Height);
|
|
||||||
|
|
||||||
SrcRect := Bounds(XSrc, YSrc, SrcWidth, SrcHeight);
|
|
||||||
|
|
||||||
Image := TQtDeviceContext(SrcDC).vImage;
|
Image := TQtDeviceContext(SrcDC).vImage;
|
||||||
|
SrcWidthOrig := QImage_width(Image);
|
||||||
|
SrcHeightOrig := QImage_height(Image);
|
||||||
|
|
||||||
|
// if passed source Width/Height is more than original then
|
||||||
|
// qt skip that, so for that case we should transform size here
|
||||||
|
//
|
||||||
|
// stretch_factor := Width / SrcWidth;
|
||||||
|
// Width := stretch_factor * (SrcWidthOrig - XSrc);
|
||||||
|
if (SrcWidth - XSrc > SrcWidthOrig) then
|
||||||
|
Width := Width * (SrcWidthOrig - XSrc) div SrcWidth;
|
||||||
|
|
||||||
|
if (SrcHeight - YSrc > SrcHeightOrig) then
|
||||||
|
Height := Height * (SrcHeightOrig - YSrc) div SrcHeight;
|
||||||
|
|
||||||
|
DstRect := Bounds(X, Y, Width, Height);
|
||||||
|
SrcRect := Bounds(XSrc, YSrc, SrcWidth, SrcHeight);
|
||||||
|
|
||||||
TQtDeviceContext(DestDC).CorrectCoordinates(DstRect);
|
TQtDeviceContext(DestDC).CorrectCoordinates(DstRect);
|
||||||
|
|
||||||
TQtDeviceContext(DestDC).CorrectCoordinates(SrcRect);
|
TQtDeviceContext(DestDC).CorrectCoordinates(SrcRect);
|
||||||
|
|
||||||
TQtDeviceContext(DestDC).drawImage(@DstRect, Image, @SrcRect);
|
TQtDeviceContext(DestDC).drawImage(@DstRect, Image, @SrcRect);
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
|
Loading…
Reference in New Issue
Block a user