Qt: Fixed regression in TQtDeviceContext.drawImage().

git-svn-id: trunk@16651 -
This commit is contained in:
zeljko 2008-09-19 16:01:42 +00:00
parent 66a35795ab
commit f03215b59b

View File

@ -2426,26 +2426,17 @@ begin
end; end;
end else end else
begin begin
{$note possible qt4 bug with RGB32 images.} {$note workaround - possible qt4 bug with QPainter & RGB32 images.}
{we must scale image , since we can get strange results with RGB32 images. {Workaround: we must convert image to ARGB32 , since we can get strange
Look at #11713 linux & win screenshoots. results with RGB32 images on Linux and Win32 if DstRect <> sourceRect.
This is better and faster then conversion to pixmap or to ARGB32} Explanation: Look at #11713 linux & win screenshoots.
if not EqualRect(LocalRect, sourceRect^) then Note: This is slower operation than QImage_scaled() we used before.}
begin
ScaledImage := QImage_create(); if not EqualRect(LocalRect, sourceRect^) and
try (QImage_format(Image) = QImageFormat_RGB32) then
W := LocalRect.Right - LocalRect.Left; QImage_convertToFormat(Image, Image, QImageFormat_ARGB32);
H := LocalRect.Bottom - LocalRect.Top;
QImage_scaled(Image, ScaledImage, W, H); QPainter_drawImage(Widget, PRect(@LocalRect), image, sourceRect, flags);
{if w & h <= 0 then copy = null image - avoid asserts from qpainter}
if not QImage_isNull(ScaledImage) then
QPainter_drawImage(Widget, LocalRect.Left, LocalRect.Top,
ScaledImage, 0, 0, W, H);
finally
QImage_destroy(ScaledImage);
end;
end else
QPainter_drawImage(Widget, PRect(@LocalRect), image, sourceRect, flags);
end; end;
end; end;