diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-05-10 14:47:31 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2016-05-11 07:21:02 +0000 |
commit | e64b2234e829cc47872225debcf80d6c06db18f0 (patch) | |
tree | 66cabac4cb055837dab17adfe7017e3223ec33fa /src/gui | |
parent | 361564dacf75019f8436ac42fa44c95ceac9e1db (diff) |
QImage::setPixelColor: warn about invalid colors
Task-number: QTBUG-52142
Change-Id: I9f390bd332f8edabaece75a6b36830c691ff4b9e
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qimage.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 64a53b4c0e..2911477d28 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2455,10 +2455,16 @@ QColor QImage::pixelColor(int x, int y) const */ void QImage::setPixelColor(int x, int y, const QColor &color) { - if (!d || x < 0 || x >= width() || y < 0 || y >= height() || !color.isValid()) { + if (!d || x < 0 || x >= width() || y < 0 || y >= height()) { qWarning("QImage::setPixelColor: coordinate (%d,%d) out of range", x, y); return; } + + if (!color.isValid()) { + qWarning("QImage::setPixelColor: color is invalid"); + return; + } + // QColor is always unpremultiplied QRgba64 c = color.rgba64(); if (!hasAlphaChannel()) |