diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-01-29 10:54:50 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-29 19:41:57 +0100 |
commit | ff70c39ebcc63cf77a457b2af662e6f7de09e6c5 (patch) | |
tree | 59da180ec30f25761f572639911955e023400278 /src/gui/image/qimage.cpp | |
parent | 0226795cf33363a872c777034e0d8934ffaa3819 (diff) |
Ensure QImage::pixel() on RGB32 images returns valid QRgb values
Currently QImage::pixel() returns the raw underlying pixel values for
RGB32. For all other pixel formats the returned value is either valid
ARGB32 or ARGB32PM.
This patch masks the undefined alpha field in RGB32 so that the return
value is well defined QRgb. It also fixes one test that relied on the
previous behavior.
Change-Id: If37463528268b7419733499d1f7bfd0d1097d21e
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 9fa6273e1c..f549a04dfb 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2122,6 +2122,7 @@ QRgb QImage::pixel(int x, int y) const case Format_Indexed8: return d->colortable.at((int)s[x]); case Format_RGB32: + return 0xff000000 | reinterpret_cast<const QRgb *>(s)[x]; case Format_ARGB32: // Keep old behaviour. case Format_ARGB32_Premultiplied: return reinterpret_cast<const QRgb *>(s)[x]; |