Merged revision(s) 52054 #fce82bdea5, 52085-52086 #780ef75887-#780ef75887 from trunk:

Qt: fixed crash with TPreviewFileDialog. issue #29896
........
Qt: do smooth transformation on argb32 image format. issue #29883
........
Qt: use smooth transformation when scaling an QImage. issue #29883
........

git-svn-id: branches/fixes_1_6@52122 -
This commit is contained in:
maxim 2016-04-06 21:50:51 +00:00
parent 3075271a0a
commit 506b91adf2
2 changed files with 16 additions and 3 deletions

View File

@ -3412,6 +3412,7 @@ var
ScaledImage: QImageH;
ScaledMask: QImageH;
NewRect: TRect;
ARenderHint: Boolean;
function NeedScaling: boolean;
var
@ -3546,8 +3547,9 @@ begin
ScaledImage := QImage_create();
try
QImage_copy(Image, ScaledImage, 0, 0, QImage_width(Image), QImage_height(Image));
// use smooth transformation when scaling image. issue #29883
QImage_scaled(ScaledImage, ScaledImage, LocalRect.Right - LocalRect.Left,
LocalRect.Bottom - LocalRect.Top);
LocalRect.Bottom - LocalRect.Top, QtIgnoreAspectRatio, QtSmoothTransformation);
NewRect := sourceRect^;
NewRect.Right := (LocalRect.Right - LocalRect.Left) + sourceRect^.Left;
NewRect.Bottom := (LocalRect.Bottom - LocalRect.Top) + sourceRect^.Top;
@ -3556,7 +3558,15 @@ begin
QImage_destroy(ScaledImage);
end;
end else
begin
// smooth a bit. issue #29883
ARenderHint := QPainter_testRenderHint(Widget, QPainterSmoothPixmapTransform);
if (QImage_format(image) = QImageFormat_ARGB32) and (flags = QtAutoColor) and
not EqualRect(LocalRect, sourceRect^) then
QPainter_setRenderHint(Widget, QPainterSmoothPixmapTransform, True);
QPainter_drawImage(Widget, PRect(@LocalRect), image, sourceRect, flags);
QPainter_setRenderHint(Widget, QPainterSmoothPixmapTransform, ARenderHint);
end;
end;
end;
end;

View File

@ -18555,8 +18555,11 @@ begin
W := QWidget_width(Widget) div 5;
H := W;
APreviewControl.Width := W;
APreviewControl.Height := H;
if Assigned(APreviewControl) then
begin
APreviewControl.Width := W;
APreviewControl.Height := H;
end;
QWidget_setGeometry(FTextWidget, 0, 0, W, 32);
QWidget_setMaximumHeight(FTextWidget, 32);