mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 03:59:20 +02:00
Qt5, Qt6: fix bitBlt when device is scaled. issue #41299
This commit is contained in:
parent
fc021470b4
commit
645c2a8dda
@ -6784,6 +6784,12 @@ var
|
||||
else
|
||||
QPixmap_copy(APixmap, ATempPixmap, 0, 0, QPixmap_width(APixmap), QPixmap_height(APixmap));
|
||||
|
||||
if (AMaskImg = nil) and QPixmap_isNull(ATempPixmap) then
|
||||
begin
|
||||
QPixmap_destroy(ATempPixmap);
|
||||
exit;
|
||||
end;
|
||||
|
||||
if AMaskImg <> nil then
|
||||
begin
|
||||
// apply mask to pixmap
|
||||
@ -6794,8 +6800,8 @@ var
|
||||
|
||||
if IsRectEmpty(MaskRect) or (MaskRect.Size <> DstRect.Size) then
|
||||
begin
|
||||
if (QPixmap_width(ATempPixmap) < (DstRect.Right - DstRect.Left)) or
|
||||
(QPixmap_Height(ATempPixmap) < (DstRect.Bottom - DstRect.Top)) then
|
||||
if not QPixmap_isNull(ATempPixmap) and ((QPixmap_width(ATempPixmap) < (DstRect.Right - DstRect.Left)) or
|
||||
(QPixmap_Height(ATempPixmap) < (DstRect.Bottom - DstRect.Top))) then
|
||||
QPixmap_scaled(AMaskPix, AScaledPix, QPixmap_width(ATempPixmap), QPixmap_height(ATempPixmap))
|
||||
else
|
||||
QPixmap_scaled(AMaskPix, AScaledPix, Width, Height);
|
||||
@ -6813,13 +6819,20 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
if ARenderHint then
|
||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, True);
|
||||
if not QPixmap_isNull(ATempPixmap) then
|
||||
begin
|
||||
if ARenderHint then
|
||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, True);
|
||||
|
||||
QPainter_drawPixmap(DstQDC.Widget, X, Y, Width, Height, ATempPixmap);
|
||||
if (QPixmap_width(ATempPixmap) = Width) and (QPixmap_height(ATempPixmap) = Height) and (Rop = SRCCOPY) then
|
||||
begin
|
||||
QPainter_drawPixmap(DstQDC.Widget, X, Y, ATempPixmap);
|
||||
end else
|
||||
QPainter_drawPixmap(DstQDC.Widget, X, Y, Width, Height, ATempPixmap);
|
||||
|
||||
if ARenderHint then
|
||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, not ARenderHint);
|
||||
if ARenderHint then
|
||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, not ARenderHint);
|
||||
end;
|
||||
|
||||
QPixmap_destroy(ATempPixmap);
|
||||
end;
|
||||
|
@ -6845,6 +6845,12 @@ var
|
||||
else
|
||||
QPixmap_copy(APixmap, ATempPixmap, 0, 0, QPixmap_width(APixmap), QPixmap_height(APixmap));
|
||||
|
||||
if (AMaskImg = nil) and QPixmap_isNull(ATempPixmap) then
|
||||
begin
|
||||
QPixmap_destroy(ATempPixmap);
|
||||
exit;
|
||||
end;
|
||||
|
||||
if AMaskImg <> nil then
|
||||
begin
|
||||
// apply mask to pixmap
|
||||
@ -6855,8 +6861,8 @@ var
|
||||
|
||||
if IsRectEmpty(MaskRect) or (MaskRect.Size <> DstRect.Size) then
|
||||
begin
|
||||
if (QPixmap_width(ATempPixmap) < (DstRect.Right - DstRect.Left)) or
|
||||
(QPixmap_Height(ATempPixmap) < (DstRect.Bottom - DstRect.Top)) then
|
||||
if not QPixmap_isNull(ATempPixmap) and ((QPixmap_width(ATempPixmap) < (DstRect.Right - DstRect.Left)) or
|
||||
(QPixmap_Height(ATempPixmap) < (DstRect.Bottom - DstRect.Top))) then
|
||||
QPixmap_scaled(AMaskPix, AScaledPix, QPixmap_width(ATempPixmap), QPixmap_height(ATempPixmap))
|
||||
else
|
||||
QPixmap_scaled(AMaskPix, AScaledPix, Width, Height);
|
||||
@ -6874,13 +6880,20 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
if ARenderHint then
|
||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, True);
|
||||
if not QPixmap_isNull(ATempPixmap) then
|
||||
begin
|
||||
if ARenderHint then
|
||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, True);
|
||||
|
||||
QPainter_drawPixmap(DstQDC.Widget, X, Y, Width, Height, ATempPixmap);
|
||||
if (QPixmap_width(ATempPixmap) = Width) and (QPixmap_height(ATempPixmap) = Height) and (Rop = SRCCOPY) then
|
||||
begin
|
||||
QPainter_drawPixmap(DstQDC.Widget, X, Y, ATempPixmap);
|
||||
end else
|
||||
QPainter_drawPixmap(DstQDC.Widget, X, Y, Width, Height, ATempPixmap);
|
||||
|
||||
if ARenderHint then
|
||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, not ARenderHint);
|
||||
if ARenderHint then
|
||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, not ARenderHint);
|
||||
end;
|
||||
|
||||
QPixmap_destroy(ATempPixmap);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user