mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 00:09:17 +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
|
else
|
||||||
QPixmap_copy(APixmap, ATempPixmap, 0, 0, QPixmap_width(APixmap), QPixmap_height(APixmap));
|
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
|
if AMaskImg <> nil then
|
||||||
begin
|
begin
|
||||||
// apply mask to pixmap
|
// apply mask to pixmap
|
||||||
@ -6794,8 +6800,8 @@ var
|
|||||||
|
|
||||||
if IsRectEmpty(MaskRect) or (MaskRect.Size <> DstRect.Size) then
|
if IsRectEmpty(MaskRect) or (MaskRect.Size <> DstRect.Size) then
|
||||||
begin
|
begin
|
||||||
if (QPixmap_width(ATempPixmap) < (DstRect.Right - DstRect.Left)) or
|
if not QPixmap_isNull(ATempPixmap) and ((QPixmap_width(ATempPixmap) < (DstRect.Right - DstRect.Left)) or
|
||||||
(QPixmap_Height(ATempPixmap) < (DstRect.Bottom - DstRect.Top)) then
|
(QPixmap_Height(ATempPixmap) < (DstRect.Bottom - DstRect.Top))) then
|
||||||
QPixmap_scaled(AMaskPix, AScaledPix, QPixmap_width(ATempPixmap), QPixmap_height(ATempPixmap))
|
QPixmap_scaled(AMaskPix, AScaledPix, QPixmap_width(ATempPixmap), QPixmap_height(ATempPixmap))
|
||||||
else
|
else
|
||||||
QPixmap_scaled(AMaskPix, AScaledPix, Width, Height);
|
QPixmap_scaled(AMaskPix, AScaledPix, Width, Height);
|
||||||
@ -6813,13 +6819,20 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ARenderHint then
|
if not QPixmap_isNull(ATempPixmap) then
|
||||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, True);
|
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
|
if ARenderHint then
|
||||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, not ARenderHint);
|
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, not ARenderHint);
|
||||||
|
end;
|
||||||
|
|
||||||
QPixmap_destroy(ATempPixmap);
|
QPixmap_destroy(ATempPixmap);
|
||||||
end;
|
end;
|
||||||
|
@ -6845,6 +6845,12 @@ var
|
|||||||
else
|
else
|
||||||
QPixmap_copy(APixmap, ATempPixmap, 0, 0, QPixmap_width(APixmap), QPixmap_height(APixmap));
|
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
|
if AMaskImg <> nil then
|
||||||
begin
|
begin
|
||||||
// apply mask to pixmap
|
// apply mask to pixmap
|
||||||
@ -6855,8 +6861,8 @@ var
|
|||||||
|
|
||||||
if IsRectEmpty(MaskRect) or (MaskRect.Size <> DstRect.Size) then
|
if IsRectEmpty(MaskRect) or (MaskRect.Size <> DstRect.Size) then
|
||||||
begin
|
begin
|
||||||
if (QPixmap_width(ATempPixmap) < (DstRect.Right - DstRect.Left)) or
|
if not QPixmap_isNull(ATempPixmap) and ((QPixmap_width(ATempPixmap) < (DstRect.Right - DstRect.Left)) or
|
||||||
(QPixmap_Height(ATempPixmap) < (DstRect.Bottom - DstRect.Top)) then
|
(QPixmap_Height(ATempPixmap) < (DstRect.Bottom - DstRect.Top))) then
|
||||||
QPixmap_scaled(AMaskPix, AScaledPix, QPixmap_width(ATempPixmap), QPixmap_height(ATempPixmap))
|
QPixmap_scaled(AMaskPix, AScaledPix, QPixmap_width(ATempPixmap), QPixmap_height(ATempPixmap))
|
||||||
else
|
else
|
||||||
QPixmap_scaled(AMaskPix, AScaledPix, Width, Height);
|
QPixmap_scaled(AMaskPix, AScaledPix, Width, Height);
|
||||||
@ -6874,13 +6880,20 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ARenderHint then
|
if not QPixmap_isNull(ATempPixmap) then
|
||||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, True);
|
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
|
if ARenderHint then
|
||||||
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, not ARenderHint);
|
QPainter_setRenderHint(DstQDC.Widget, QPainterSmoothPixmapTransform, not ARenderHint);
|
||||||
|
end;
|
||||||
|
|
||||||
QPixmap_destroy(ATempPixmap);
|
QPixmap_destroy(ATempPixmap);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user