mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 23:00:37 +01:00
Qt,Qt5: copy proper mask size in StretchMaskBlt
git-svn-id: trunk@62877 -
This commit is contained in:
parent
14d2b6e153
commit
d78f0bd224
@ -6873,30 +6873,26 @@ 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 then
|
if AMaskImg <> nil then
|
||||||
begin
|
begin
|
||||||
// apply mask to pixmap
|
// apply mask to pixmap
|
||||||
AScaledPix := nil;
|
AScaledPix := QPixmap_create();
|
||||||
AMaskPix := QPixmap_create();
|
AMaskPix := QPixmap_create();
|
||||||
QPixmap_fromImage(AMaskPix, AMaskImg);
|
QPixmap_fromImage(AMaskPix, AMaskImg);
|
||||||
try
|
try
|
||||||
if NeedScaling(DstRect, SrcRect) then
|
|
||||||
begin
|
if IsRectEmpty(MaskRect) then
|
||||||
AScaledPix := QPixmap_create();
|
QPixmap_copy(AMaskPix, AScaledPix, 0, 0, Min(Width, QPixmap_Width(AMaskPix)), Min(Height, QPixmap_Height(AMaskPix)) )
|
||||||
QPixmap_scaled(AMaskPix, AScaledPix, Width, Height);
|
else
|
||||||
ABitmap := QBitmap_Create(AScaledPix);
|
QPixmap_copy(AMaskPix, AScaledPix, MaskRect.Left, MaskRect.Top,
|
||||||
end else
|
MaskRect.Right - MaskRect.Left, MaskRect.Bottom - MaskRect.Top);
|
||||||
if (Width <> SrcWidth) or (Height <> SrcHeight) then
|
|
||||||
begin
|
ABitmap := QBitmap_Create(AScaledPix);
|
||||||
AScaledPix := QPixmap_create();
|
|
||||||
QPixmap_copy(AMaskPix, AScaledPix, 0, 0, Width, Height);
|
|
||||||
ABitmap := QBitmap_Create(AScaledPix);
|
|
||||||
end else
|
|
||||||
ABitmap := QBitmap_Create(AMaskPix);
|
|
||||||
QPixmap_setMask(ATempPixmap, ABitmap);
|
QPixmap_setMask(ATempPixmap, ABitmap);
|
||||||
QBitmap_Destroy(ABitmap);
|
QBitmap_Destroy(ABitmap);
|
||||||
if AScaledPix <> nil then
|
QPixmap_destroy(AScaledPix);
|
||||||
QPixmap_destroy(AScaledPix);
|
|
||||||
finally
|
finally
|
||||||
QPixmap_destroy(AMaskPix);
|
QPixmap_destroy(AMaskPix);
|
||||||
end;
|
end;
|
||||||
@ -6978,7 +6974,7 @@ begin
|
|||||||
QImage_copy(SrcQDC.vImage.Handle, TmpImage, XSrc, YSrc, SrcWidth, SrcHeight);
|
QImage_copy(SrcQDC.vImage.Handle, TmpImage, XSrc, YSrc, SrcWidth, SrcHeight);
|
||||||
|
|
||||||
// #11713, #25590
|
// #11713, #25590
|
||||||
if (QMask = nil) and (QImage_format(TmpImage) = QImageFormat_RGB32) then
|
if (QImage_format(TmpImage) = QImageFormat_RGB32) then
|
||||||
begin
|
begin
|
||||||
Image := QImage_create();
|
Image := QImage_create();
|
||||||
QImage_convertToFormat(TmpImage, Image, QImageFormat_ARGB32);
|
QImage_convertToFormat(TmpImage, Image, QImageFormat_ARGB32);
|
||||||
|
|||||||
@ -6821,27 +6821,22 @@ var
|
|||||||
if AMaskImg <> nil then
|
if AMaskImg <> nil then
|
||||||
begin
|
begin
|
||||||
// apply mask to pixmap
|
// apply mask to pixmap
|
||||||
AScaledPix := nil;
|
AScaledPix := QPixmap_create();
|
||||||
AMaskPix := QPixmap_create();
|
AMaskPix := QPixmap_create();
|
||||||
QPixmap_fromImage(AMaskPix, AMaskImg);
|
QPixmap_fromImage(AMaskPix, AMaskImg);
|
||||||
try
|
try
|
||||||
if NeedScaling(DstRect, SrcRect) then
|
|
||||||
begin
|
if IsRectEmpty(MaskRect) then
|
||||||
AScaledPix := QPixmap_create();
|
QPixmap_copy(AMaskPix, AScaledPix, 0, 0, Min(Width, QPixmap_Width(AMaskPix)), Min(Height, QPixmap_Height(AMaskPix)) )
|
||||||
QPixmap_scaled(AMaskPix, AScaledPix, Width, Height);
|
else
|
||||||
ABitmap := QBitmap_Create(AScaledPix);
|
QPixmap_copy(AMaskPix, AScaledPix, MaskRect.Left, MaskRect.Top,
|
||||||
end else
|
MaskRect.Right - MaskRect.Left, MaskRect.Bottom - MaskRect.Top);
|
||||||
if (Width <> SrcWidth) or (Height <> SrcHeight) then
|
|
||||||
begin
|
ABitmap := QBitmap_Create(AScaledPix);
|
||||||
AScaledPix := QPixmap_create();
|
|
||||||
QPixmap_copy(AMaskPix, AScaledPix, 0, 0, Width, Height);
|
|
||||||
ABitmap := QBitmap_Create(AScaledPix);
|
|
||||||
end else
|
|
||||||
ABitmap := QBitmap_Create(AMaskPix);
|
|
||||||
QPixmap_setMask(ATempPixmap, ABitmap);
|
QPixmap_setMask(ATempPixmap, ABitmap);
|
||||||
QBitmap_Destroy(ABitmap);
|
QBitmap_Destroy(ABitmap);
|
||||||
if AScaledPix <> nil then
|
QPixmap_destroy(AScaledPix);
|
||||||
QPixmap_destroy(AScaledPix);
|
|
||||||
finally
|
finally
|
||||||
QPixmap_destroy(AMaskPix);
|
QPixmap_destroy(AMaskPix);
|
||||||
end;
|
end;
|
||||||
@ -6923,7 +6918,7 @@ begin
|
|||||||
QImage_copy(SrcQDC.vImage.Handle, TmpImage, XSrc, YSrc, SrcWidth, SrcHeight);
|
QImage_copy(SrcQDC.vImage.Handle, TmpImage, XSrc, YSrc, SrcWidth, SrcHeight);
|
||||||
|
|
||||||
// #11713, #25590
|
// #11713, #25590
|
||||||
if (QMask = nil) and (QImage_format(TmpImage) = QImageFormat_RGB32) then
|
if (QImage_format(TmpImage) = QImageFormat_RGB32) then
|
||||||
begin
|
begin
|
||||||
Image := QImage_create();
|
Image := QImage_create();
|
||||||
QImage_convertToFormat(TmpImage, Image, QImageFormat_ARGB32);
|
QImage_convertToFormat(TmpImage, Image, QImageFormat_ARGB32);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user