summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-07-24 14:51:47 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-29 16:10:53 +0200
commitde8567991fa2cece930b05a2ae3c8bb3b723f1b1 (patch)
treec01a448e8172f5cac698ebcba732bcccd9ec8f52 /src/gui/painting
parent5b9006bbdba7dcab01b8e640554a7d7a4b64f76b (diff)
Fix fillRect on RGBA8888 images
The fill color was not correctly converted before being filled into RGBA8888 images. This patch adds a function with convertion and adds tests for it to tst_qpainter. Change-Id: If8b0e6db38b2794a60301842e25f377eb7216796 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qdrawhelper.cpp40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index b2108ef67e..a037545dc2 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5901,9 +5901,9 @@ static void qt_alphargbblit_quint32(QRasterBuffer *rasterBuffer,
}
}
-static void qt_rectfill_quint32(QRasterBuffer *rasterBuffer,
- int x, int y, int width, int height,
- quint32 color)
+static void qt_rectfill_argb32(QRasterBuffer *rasterBuffer,
+ int x, int y, int width, int height,
+ quint32 color)
{
qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()),
color, x, y, width, height, rasterBuffer->bytesPerLine());
@@ -5917,14 +5917,30 @@ static void qt_rectfill_quint16(QRasterBuffer *rasterBuffer,
qConvertRgb32To16(color), x, y, width, height, rasterBuffer->bytesPerLine());
}
-static void qt_rectfill_nonpremul_quint32(QRasterBuffer *rasterBuffer,
- int x, int y, int width, int height,
- quint32 color)
+static void qt_rectfill_nonpremul_argb32(QRasterBuffer *rasterBuffer,
+ int x, int y, int width, int height,
+ quint32 color)
{
qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()),
INV_PREMUL(color), x, y, width, height, rasterBuffer->bytesPerLine());
}
+static void qt_rectfill_rgba(QRasterBuffer *rasterBuffer,
+ int x, int y, int width, int height,
+ quint32 color)
+{
+ qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()),
+ ARGB2RGBA(color), x, y, width, height, rasterBuffer->bytesPerLine());
+}
+
+static void qt_rectfill_nonpremul_rgba(QRasterBuffer *rasterBuffer,
+ int x, int y, int width, int height,
+ quint32 color)
+{
+ qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()),
+ ARGB2RGBA(INV_PREMUL(color)), x, y, width, height, rasterBuffer->bytesPerLine());
+}
+
// Map table for destination image format. Contains function pointers
// for blends of various types unto the destination
@@ -5958,7 +5974,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
qt_bitmapblit_quint32,
qt_alphamapblit_quint32,
qt_alphargbblit_quint32,
- qt_rectfill_quint32
+ qt_rectfill_argb32
},
// Format_ARGB32,
{
@@ -5967,7 +5983,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
qt_bitmapblit_quint32,
qt_alphamapblit_quint32,
qt_alphargbblit_quint32,
- qt_rectfill_nonpremul_quint32
+ qt_rectfill_nonpremul_argb32
},
// Format_ARGB32_Premultiplied
{
@@ -5976,7 +5992,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
qt_bitmapblit_quint32,
qt_alphamapblit_quint32,
qt_alphargbblit_quint32,
- qt_rectfill_quint32
+ qt_rectfill_argb32
},
// Format_RGB16
{
@@ -6047,7 +6063,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
0,
0,
#endif
- qt_rectfill_quint32
+ qt_rectfill_rgba
},
// Format_RGBA8888
{
@@ -6061,7 +6077,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
0,
0,
#endif
- qt_rectfill_quint32
+ qt_rectfill_nonpremul_rgba
},
// Format_RGB8888_Premultiplied
{
@@ -6075,7 +6091,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
0,
0,
#endif
- qt_rectfill_quint32
+ qt_rectfill_rgba
}
};