summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-02-14 10:39:30 +0100
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-09-17 14:48:48 +0200
commitd84a6eab5129ba29951a7ba6d82820b21cc9872e (patch)
tree1d794ecd3f37363a286f3eeda8e571c36ec4006c /src/gui/painting
parentbce19cb9063003af5924c643f6fc1416146b4242 (diff)
Add Grayscale8 and Alpha8 formats to QImage and drawing
Extend the QImage format with two 8-bit grayscale and alpha formats. These formats have the advantage over Indexed8 that they have simpler conversion and can be rendered to by the raster engine. [ChangeLog][QtGui][QImage] Added support grayscale and alpha 8-bit formats which can also be rendered to. Change-Id: I4343c80a92a3dda196aa38d0c3ea251b094fc274 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qblendfunctions.cpp426
-rw-r--r--src/gui/painting/qdrawhelper.cpp103
-rw-r--r--src/gui/painting/qmemrotate.cpp17
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp8
5 files changed, 482 insertions, 74 deletions
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 438eb6f34f..4f83fb4fb6 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -772,7 +772,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGRs30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_Mono
0, // Format_Invalid,
@@ -797,7 +799,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_MonoLSB
0, // Format_Invalid,
@@ -822,7 +826,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_Indexed8
0, // Format_Invalid,
@@ -847,7 +853,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB32
0, // Format_Invalid,
@@ -872,7 +880,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB32
0, // Format_Invalid,
@@ -897,7 +907,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB32_Premultiplied
0, // Format_Invalid,
@@ -922,7 +934,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB16
0, // Format_Invalid,
@@ -947,7 +961,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB8565_Premultiplied
0, // Format_Invalid,
@@ -972,7 +988,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB666
0, // Format_Invalid,
@@ -997,7 +1015,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB6666_Premultiplied
0, // Format_Invalid,
@@ -1022,7 +1042,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB555
0, // Format_Invalid,
@@ -1047,7 +1069,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB8555_Premultiplied
0, // Format_Invalid,
@@ -1072,7 +1096,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB888
0, // Format_Invalid,
@@ -1097,7 +1123,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB444
0, // Format_Invalid,
@@ -1122,7 +1150,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB4444_Premultiplied
0, // Format_Invalid,
@@ -1147,7 +1177,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBX8888
0, // Format_Invalid,
@@ -1178,7 +1210,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBA8888
0, // Format_Invalid,
@@ -1203,7 +1237,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBA8888_Premultiplied
0, // Format_Invalid,
@@ -1234,7 +1270,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_BGR30
0, // Format_Invalid,
@@ -1259,7 +1297,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_A2BGR30_Premultiplied
0, // Format_Invalid,
@@ -1284,7 +1324,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB30
0, // Format_Invalid,
@@ -1309,7 +1351,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_A2RGB30_Premultiplied
0, // Format_Invalid,
@@ -1334,8 +1378,64 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
+ },
+ { // Format_Alpha8
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0, // Format_ARGB4444_Premultiplied,
+ 0, // Format_RGBX8888,
+ 0, // Format_RGBA8888,
+ 0, // Format_RGBA8888_Premultiplied,
+ 0, // Format_BGR30,
+ 0, // Format_A2BGR30_Premultiplied,
+ 0, // Format_RGB30,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
+ { // Format_Grayscale8
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0, // Format_ARGB4444_Premultiplied,
+ 0, // Format_RGBX8888,
+ 0, // Format_RGBA8888,
+ 0, // Format_RGBA8888_Premultiplied,
+ 0, // Format_BGR30,
+ 0, // Format_A2BGR30_Premultiplied,
+ 0, // Format_RGB30,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
+ }
};
@@ -1363,7 +1463,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_Mono
0, // Format_Invalid,
@@ -1388,7 +1490,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_MonoLSB
0, // Format_Invalid,
@@ -1413,7 +1517,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_Indexed8
0, // Format_Invalid,
@@ -1438,7 +1544,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB32
0, // Format_Invalid,
@@ -1463,7 +1571,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB32
0, // Format_Invalid,
@@ -1488,7 +1598,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB32_Premultiplied
0, // Format_Invalid,
@@ -1513,7 +1625,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB16
0, // Format_Invalid,
@@ -1538,7 +1652,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB8565_Premultiplied
0, // Format_Invalid,
@@ -1563,7 +1679,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB666
0, // Format_Invalid,
@@ -1588,7 +1706,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB6666_Premultiplied
0, // Format_Invalid,
@@ -1613,7 +1733,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB555
0, // Format_Invalid,
@@ -1638,7 +1760,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB8555_Premultiplied
0, // Format_Invalid,
@@ -1663,7 +1787,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB888
0, // Format_Invalid,
@@ -1688,7 +1814,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB444
0, // Format_Invalid,
@@ -1713,7 +1841,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB4444_Premultiplied
0, // Format_Invalid,
@@ -1738,7 +1868,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBX8888
0, // Format_Invalid,
@@ -1769,7 +1901,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBA8888
0, // Format_Invalid,
@@ -1794,7 +1928,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBA8888_Premultiplied
0, // Format_Invalid,
@@ -1826,6 +1962,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_BGR30
0, // Format_Invalid,
@@ -1851,6 +1989,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied,
qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_RGB30,
qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied,
+ 0, 0,
},
{ // Format_A2BGR30_Premultiplied
0, // Format_Invalid,
@@ -1876,6 +2015,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied,
qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_RGB30,
qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied,
+ 0, 0,
},
{ // Format_RGB30
0, // Format_Invalid,
@@ -1901,6 +2041,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied,
qt_blend_rgb30_on_rgb30, // Format_RGB30,
qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied,
+ 0, 0,
},
{ // Format_A2RGB30_Premultiplied
0, // Format_Invalid,
@@ -1925,8 +2066,63 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_BGR30,
qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied,
qt_blend_rgb30_on_rgb30, // Format_RGB30,
- qt_blend_a2rgb30pm_on_a2rgb30pm // Format_A2RGB30_Premultiplied,
+ qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied,
+ 0, 0,
+ },
+ { // Format_Alpha8
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0, // Format_ARGB4444_Premultiplied,
+ 0, // Format_RGBX8888,
+ 0, // Format_RGBA8888,
+ 0, // Format_RGBA8888_Premultiplied,
+ 0, // Format_BGR30,
+ 0, // Format_A2BGR30_Premultiplied,
+ 0, // Format_RGB30,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
+ { // Format_Grayscale8
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0, // Format_ARGB4444_Premultiplied,
+ 0, // Format_RGBX8888,
+ 0, // Format_RGBA8888,
+ 0, // Format_RGBA8888_Premultiplied,
+ 0, // Format_BGR30,
+ 0, // Format_A2BGR30_Premultiplied,
+ 0, // Format_RGB30,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
+ }
};
SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats] = {
@@ -1953,7 +2149,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_Mono
0, // Format_Invalid,
@@ -1978,7 +2176,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_MonoLSB
0, // Format_Invalid,
@@ -2003,7 +2203,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_Indexed8
0, // Format_Invalid,
@@ -2028,7 +2230,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB32
0, // Format_Invalid,
@@ -2053,7 +2257,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB32
0, // Format_Invalid,
@@ -2078,7 +2284,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB32_Premultiplied
0, // Format_Invalid,
@@ -2103,7 +2311,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB16
0, // Format_Invalid,
@@ -2128,7 +2338,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB8565_Premultiplied
0, // Format_Invalid,
@@ -2153,7 +2365,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB666
0, // Format_Invalid,
@@ -2178,7 +2392,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB6666_Premultiplied
0, // Format_Invalid,
@@ -2203,7 +2419,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB555
0, // Format_Invalid,
@@ -2228,7 +2446,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB8555_Premultiplied
0, // Format_Invalid,
@@ -2253,7 +2473,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB888
0, // Format_Invalid,
@@ -2278,7 +2500,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB444
0, // Format_Invalid,
@@ -2303,7 +2527,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_ARGB4444_Premultiplied
0, // Format_Invalid,
@@ -2328,7 +2554,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBX8888
0, // Format_Invalid,
@@ -2359,7 +2587,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBA8888
0, // Format_Invalid,
@@ -2384,7 +2614,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGBA8888_Premultiplied
0, // Format_Invalid,
@@ -2415,7 +2647,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_BGR30
0, // Format_Invalid,
@@ -2440,7 +2674,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_A2BGR30_Premultiplied
0, // Format_Invalid,
@@ -2465,7 +2701,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_RGB30
0, // Format_Invalid,
@@ -2490,7 +2728,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
{ // Format_A2RGB30_Premultiplied
0, // Format_Invalid,
@@ -2515,7 +2755,63 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
0, // Format_BGR30,
0, // Format_A2BGR30_Premultiplied,
0, // Format_RGB30,
- 0 // Format_A2RGB30_Premultiplied,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
+ },
+ { // Format_Alpha8
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0, // Format_ARGB4444_Premultiplied,
+ 0, // Format_RGBX8888,
+ 0, // Format_RGBA8888,
+ 0, // Format_RGBA8888_Premultiplied,
+ 0, // Format_BGR30,
+ 0, // Format_A2BGR30_Premultiplied,
+ 0, // Format_RGB30,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
+ },
+ { // Format_Grayscale8
+ 0, // Format_Invalid,
+ 0, // Format_Mono,
+ 0, // Format_MonoLSB,
+ 0, // Format_Indexed8,
+ 0, // Format_RGB32,
+ 0, // Format_ARGB32,
+ 0, // Format_ARGB32_Premultiplied,
+ 0, // Format_RGB16,
+ 0, // Format_ARGB8565_Premultiplied,
+ 0, // Format_RGB666,
+ 0, // Format_ARGB6666_Premultiplied,
+ 0, // Format_RGB555,
+ 0, // Format_ARGB8555_Premultiplied,
+ 0, // Format_RGB888,
+ 0, // Format_RGB444,
+ 0, // Format_ARGB4444_Premultiplied,
+ 0, // Format_RGBX8888,
+ 0, // Format_RGBA8888,
+ 0, // Format_RGBA8888_Premultiplied,
+ 0, // Format_BGR30,
+ 0, // Format_A2BGR30_Premultiplied,
+ 0, // Format_RGB30,
+ 0, // Format_A2RGB30_Premultiplied,
+ 0, // Format_Alpha8
+ 0, // Format_Grayscale8
},
};
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 9292eeb4a5..3f30804abf 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -535,6 +535,22 @@ static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uin
return buffer;
}
+static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count,
+ const QPixelLayout *, const QRgb *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qRgba(0, 0, 0, src[i]);
+ return buffer;
+}
+
+static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint *src, int count,
+ const QPixelLayout *, const QRgb *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qRgb(src[i], src[i], src[i]);
+ return buffer;
+}
+
static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count,
const QPixelLayout *, const QRgb *)
{
@@ -611,6 +627,30 @@ static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint
return buffer;
}
+static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uint *src, int count,
+ const QPixelLayout *, const QRgb *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qAlpha(src[i]);
+ return buffer;
+}
+
+static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const uint *src, int count,
+ const QPixelLayout *, const QRgb *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qGray(src[i]);
+ return buffer;
+}
+
+static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const uint *src, int count,
+ const QPixelLayout *, const QRgb *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qGray(qUnpremultiply(src[i]));
+ return buffer;
+}
+
template <QPixelLayout::BPP bpp> static
uint QT_FASTCALL fetchPixel(const uchar *src, int index);
@@ -764,6 +804,8 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = {
{ 10, 20, 10, 10, 10, 0, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderBGR>, convertA2RGB30PMFromARGB32PM<PixelOrderBGR>, 0 }, // Format_A2BGR30_Premultiplied
{ 10, 0, 10, 10, 10, 20, 0, 30, false, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertRGB30FromARGB32PM<PixelOrderRGB>, convertRGB30FromRGB32<PixelOrderRGB> }, // Format_RGB30
{ 10, 0, 10, 10, 10, 20, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertA2RGB30PMFromARGB32PM<PixelOrderRGB>, 0 }, // Format_A2RGB30_Premultiplied
+ { 0, 0, 0, 0, 0, 0, 8, 0, false, QPixelLayout::BPP8, convertAlpha8ToRGB32, convertAlpha8FromARGB32PM, 0 }, // Format_Alpha8
+ { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP8, convertGrayscale8ToRGB32, convertGrayscale8FromARGB32PM, convertGrayscale8FromRGB32 } // Format_Grayscale8
};
FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = {
@@ -875,6 +917,8 @@ static DestFetchProc destFetchProc[QImage::NImageFormats] =
destFetch, // Format_A2BGR30_Premultiplied
destFetch, // Format_RGB30
destFetch, // Format_A2RGB30_Premultiplied
+ destFetch, // Format_Alpha8
+ destFetch, // Format_Grayscale8
};
/*
@@ -1019,6 +1063,8 @@ static DestStoreProc destStoreProc[QImage::NImageFormats] =
destStore, // Format_A2BGR30_Premultiplied
destStore, // Format_RGB30
destStore, // Format_A2RGB30_Premultiplied
+ destStore, // Format_Alpha8
+ destStore, // Format_Grayscale8
};
/*
@@ -2274,6 +2320,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
fetchUntransformed, // Format_A2BGR30_Premultiplied
fetchUntransformed, // Format_RGB30
fetchUntransformed, // Format_A2RGB30_Premultiplied
+ fetchUntransformed, // Alpha8
+ fetchUntransformed, // Grayscale8
},
// Tiled
{
@@ -2299,7 +2347,9 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
fetchUntransformed, // BGR30
fetchUntransformed, // A2BGR30_Premultiplied
fetchUntransformed, // RGB30
- fetchUntransformed // A2RGB30_Premultiplied
+ fetchUntransformed, // A2RGB30_Premultiplied
+ fetchUntransformed, // Alpha8
+ fetchUntransformed, // Grayscale8
},
// Transformed
{
@@ -2326,6 +2376,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
fetchTransformed<BlendTransformed>, // A2BGR30_Premultiplied
fetchTransformed<BlendTransformed>, // RGB30
fetchTransformed<BlendTransformed>, // A2RGB30_Premultiplied
+ fetchTransformed<BlendTransformed>, // Alpah8
+ fetchTransformed<BlendTransformed>, // Grayscale8
},
{
0, // TransformedTiled
@@ -2351,6 +2403,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
fetchTransformed<BlendTransformedTiled>, // A2BGR30_Premultiplied
fetchTransformed<BlendTransformedTiled>, // RGB30
fetchTransformed<BlendTransformedTiled>, // A2RGB30_Premultiplied
+ fetchTransformed<BlendTransformedTiled>, // Alpha8
+ fetchTransformed<BlendTransformedTiled>, // Grayscale8
},
{
0, // Bilinear
@@ -2376,6 +2430,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
fetchTransformedBilinear<BlendTransformedBilinear>, // A2BGR30_Premultiplied
fetchTransformedBilinear<BlendTransformedBilinear>, // RGB30
fetchTransformedBilinear<BlendTransformedBilinear>, // A2RGB30_Premultiplied
+ fetchTransformedBilinear<BlendTransformedBilinear>, // Alpha8
+ fetchTransformedBilinear<BlendTransformedBilinear>, // Grayscale8
},
{
0, // BilinearTiled
@@ -2400,7 +2456,9 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
fetchTransformedBilinear<BlendTransformedBilinearTiled>, // BGR30
fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied
fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB30
- fetchTransformedBilinear<BlendTransformedBilinearTiled> // A2RGB30_Premultiplied
+ fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2RGB30_Premultiplied
+ fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Alpha8
+ fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Grayscale8
},
};
@@ -5825,6 +5883,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_untransformed_generic,
blend_untransformed_generic,
blend_untransformed_generic,
+ blend_untransformed_generic,
+ blend_untransformed_generic,
},
// Tiled
{
@@ -5851,6 +5911,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_tiled_generic,
blend_tiled_generic,
blend_tiled_generic,
+ blend_tiled_generic,
+ blend_tiled_generic,
},
// Transformed
{
@@ -5877,6 +5939,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic,
blend_src_generic,
blend_src_generic,
+ blend_src_generic,
+ blend_src_generic,
},
// TransformedTiled
{
@@ -5902,6 +5966,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic,
blend_src_generic,
blend_src_generic,
+ blend_src_generic,
blend_src_generic
},
// Bilinear
@@ -5929,6 +5994,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic,
blend_src_generic,
blend_src_generic,
+ blend_src_generic,
+ blend_src_generic,
},
// BilinearTiled
{
@@ -5955,6 +6022,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic, // A2BGR30_Premultiplied
blend_src_generic, // RGB30
blend_src_generic, // A2RGB30_Premultiplied
+ blend_src_generic, // Alpha8
+ blend_src_generic, // Grayscale8
}
};
@@ -6475,6 +6544,22 @@ static void qt_rectfill_nonpremul_rgba(QRasterBuffer *rasterBuffer,
ARGB2RGBA(qUnpremultiply(color)), x, y, width, height, rasterBuffer->bytesPerLine());
}
+static void qt_rectfill_alpha(QRasterBuffer *rasterBuffer,
+ int x, int y, int width, int height,
+ quint32 color)
+{
+ qt_rectfill<quint8>(reinterpret_cast<quint8 *>(rasterBuffer->buffer()),
+ qAlpha(color), x, y, width, height, rasterBuffer->bytesPerLine());
+}
+
+static void qt_rectfill_gray(QRasterBuffer *rasterBuffer,
+ int x, int y, int width, int height,
+ quint32 color)
+{
+ qt_rectfill<quint8>(reinterpret_cast<quint8 *>(rasterBuffer->buffer()),
+ qGray(color), x, y, width, height, rasterBuffer->bytesPerLine());
+}
+
// Map table for destination image format. Contains function pointers
// for blends of various types unto the destination
@@ -6659,6 +6744,20 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
0,
0
},
+ // Format_Alpha8
+ {
+ blend_color_generic,
+ blend_src_generic,
+ 0, 0, 0,
+ qt_rectfill_alpha
+ },
+ // Format_Grayscale8
+ {
+ blend_color_generic,
+ blend_src_generic,
+ 0, 0, 0,
+ qt_rectfill_gray
+ },
};
#if defined(Q_CC_MSVC) && !defined(_MIPS_)
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index a5e12da3d1..ed82559187 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -481,6 +481,21 @@ QT_IMPL_MEMROTATE(quint16)
QT_IMPL_MEMROTATE(quint24)
QT_IMPL_MEMROTATE(quint8)
+void qt_memrotate90_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
+{
+ qt_memrotate90(srcPixels, w, h, sbpl, destPixels, dbpl);
+}
+
+void qt_memrotate180_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
+{
+ qt_memrotate180(srcPixels, w, h, sbpl, destPixels, dbpl);
+}
+
+void qt_memrotate270_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
+{
+ qt_memrotate270(srcPixels, w, h, sbpl, destPixels, dbpl);
+}
+
void qt_memrotate90_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
{
qt_memrotate90((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl);
@@ -537,6 +552,8 @@ MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3] =
{ qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_A2BGR30_Premultiplied,
{ qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_RGB30,
{ qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_A2RGB30_Premultiplied,
+ { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 }, // Format_Alpha8,
+ { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 }, // Format_Grayscale8,
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 914691375a..47f7fd493d 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -425,6 +425,7 @@ void QRasterPaintEngine::init()
case QImage::Format_RGBA8888:
case QImage::Format_A2BGR30_Premultiplied:
case QImage::Format_A2RGB30_Premultiplied:
+ case QImage::Format_Alpha8:
gccaps |= PorterDuff;
break;
case QImage::Format_RGB32:
@@ -436,6 +437,7 @@ void QRasterPaintEngine::init()
case QImage::Format_RGBX8888:
case QImage::Format_BGR30:
case QImage::Format_RGB30:
+ case QImage::Format_Grayscale8:
break;
default:
break;
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index fb8c23835d..b39fb3c0e0 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -293,13 +293,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
m_image = QImage(width, height, QImage::Format_Mono);
break;
case QFontEngine::Format_A8: {
- m_image = QImage(width, height, QImage::Format_Indexed8);
- m_image.fill(0);
- QVector<QRgb> colors(256);
- QRgb *it = colors.data();
- for (int i=0; i<256; ++i, ++it)
- *it = 0xff000000 | i | (i<<8) | (i<<16);
- m_image.setColorTable(colors);
+ m_image = QImage(width, height, QImage::Format_Alpha8);
break; }
case QFontEngine::Format_A32:
m_image = QImage(width, height, QImage::Format_RGB32);