Handle allocation failure in QImage rotate 90/180/270 functions
Fixes: QTBUG-108186 Change-Id: I354e75d9f063cdea0340b84e9585a61651a7c70f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 7c4b3648cad7faf990397af0b8a81664658c2d4f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c3fd2da7fb
commit
7f2fecba4f
@ -4674,6 +4674,8 @@ QImage QImage::smoothScaled(int w, int h) const
|
|||||||
static QImage rotated90(const QImage &image)
|
static QImage rotated90(const QImage &image)
|
||||||
{
|
{
|
||||||
QImage out(image.height(), image.width(), image.format());
|
QImage out(image.height(), image.width(), image.format());
|
||||||
|
if (out.isNull())
|
||||||
|
return out;
|
||||||
copyMetadata(&out, image);
|
copyMetadata(&out, image);
|
||||||
if (image.colorCount() > 0)
|
if (image.colorCount() > 0)
|
||||||
out.setColorTable(image.colorTable());
|
out.setColorTable(image.colorTable());
|
||||||
@ -4702,6 +4704,8 @@ static QImage rotated180(const QImage &image)
|
|||||||
return image.mirrored(true, true);
|
return image.mirrored(true, true);
|
||||||
|
|
||||||
QImage out(image.width(), image.height(), image.format());
|
QImage out(image.width(), image.height(), image.format());
|
||||||
|
if (out.isNull())
|
||||||
|
return out;
|
||||||
copyMetadata(&out, image);
|
copyMetadata(&out, image);
|
||||||
if (image.colorCount() > 0)
|
if (image.colorCount() > 0)
|
||||||
out.setColorTable(image.colorTable());
|
out.setColorTable(image.colorTable());
|
||||||
@ -4714,6 +4718,8 @@ static QImage rotated180(const QImage &image)
|
|||||||
static QImage rotated270(const QImage &image)
|
static QImage rotated270(const QImage &image)
|
||||||
{
|
{
|
||||||
QImage out(image.height(), image.width(), image.format());
|
QImage out(image.height(), image.width(), image.format());
|
||||||
|
if (out.isNull())
|
||||||
|
return out;
|
||||||
copyMetadata(&out, image);
|
copyMetadata(&out, image);
|
||||||
if (image.colorCount() > 0)
|
if (image.colorCount() > 0)
|
||||||
out.setColorTable(image.colorTable());
|
out.setColorTable(image.colorTable());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user