diff options
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/painting.pri | 1 | ||||
-rw-r--r-- | src/gui/painting/qblendfunctions.cpp | 426 | ||||
-rw-r--r-- | src/gui/painting/qbrush.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qcolor.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 103 | ||||
-rw-r--r-- | src/gui/painting/qmemrotate.cpp | 17 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 14 | ||||
-rw-r--r-- | src/gui/painting/qpdf.cpp | 13 | ||||
-rw-r--r-- | src/gui/painting/qrgb.h | 14 | ||||
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 8 |
10 files changed, 506 insertions, 94 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index a5a395cce2..588a2f0a88 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -41,6 +41,7 @@ HEADERS += \ painting/qrasterdefs_p.h \ painting/qrasterizer_p.h \ painting/qregion.h \ + painting/qrgb.h \ painting/qstroker_p.h \ painting/qtextureglyphcache_p.h \ painting/qtransform.h \ diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 2da5dbb356..e174d1f1cd 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -764,7 +764,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, @@ -789,7 +791,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, @@ -814,7 +818,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, @@ -839,7 +845,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, @@ -864,7 +872,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, @@ -889,7 +899,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, @@ -914,7 +926,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, @@ -939,7 +953,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, @@ -964,7 +980,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, @@ -989,7 +1007,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, @@ -1014,7 +1034,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, @@ -1039,7 +1061,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, @@ -1064,7 +1088,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, @@ -1089,7 +1115,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, @@ -1114,7 +1142,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, @@ -1139,7 +1169,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, @@ -1170,7 +1202,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, @@ -1195,7 +1229,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, @@ -1226,7 +1262,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, @@ -1251,7 +1289,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, @@ -1276,7 +1316,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, @@ -1301,7 +1343,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, @@ -1326,8 +1370,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 + } }; @@ -1355,7 +1455,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, @@ -1380,7 +1482,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, @@ -1405,7 +1509,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, @@ -1430,7 +1536,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, @@ -1455,7 +1563,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, @@ -1480,7 +1590,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, @@ -1505,7 +1617,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, @@ -1530,7 +1644,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, @@ -1555,7 +1671,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, @@ -1580,7 +1698,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, @@ -1605,7 +1725,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, @@ -1630,7 +1752,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, @@ -1655,7 +1779,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, @@ -1680,7 +1806,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, @@ -1705,7 +1833,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, @@ -1730,7 +1860,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, @@ -1761,7 +1893,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, @@ -1786,7 +1920,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, @@ -1818,6 +1954,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, @@ -1843,6 +1981,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, @@ -1868,6 +2007,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, @@ -1893,6 +2033,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, @@ -1917,8 +2058,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] = { @@ -1945,7 +2141,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, @@ -1970,7 +2168,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, @@ -1995,7 +2195,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, @@ -2020,7 +2222,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, @@ -2045,7 +2249,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, @@ -2070,7 +2276,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, @@ -2095,7 +2303,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, @@ -2120,7 +2330,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, @@ -2145,7 +2357,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, @@ -2170,7 +2384,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, @@ -2195,7 +2411,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, @@ -2220,7 +2438,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, @@ -2245,7 +2465,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, @@ -2270,7 +2492,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, @@ -2295,7 +2519,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, @@ -2320,7 +2546,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, @@ -2351,7 +2579,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, @@ -2376,7 +2606,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, @@ -2407,7 +2639,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, @@ -2432,7 +2666,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, @@ -2457,7 +2693,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, @@ -2482,7 +2720,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, @@ -2507,7 +2747,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/qbrush.h b/src/gui/painting/qbrush.h index ff652fe288..3dc2230afc 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -235,7 +235,7 @@ private: qreal cx, cy, angle; } conical; } m_data; - void *dummy; + void *dummy; // ### Qt 6: replace with actual content (CoordinateMode, InterpolationMode, ...) }; inline void QGradient::setSpread(Spread aspread) diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index b68504c865..926d05707e 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -65,7 +65,7 @@ public: QColor(QRgb rgb); QColor(const QString& name); QColor(const char *name); - QColor(const QColor &color); + QColor(const QColor &color); // ### Qt 6: remove, the trivial one is fine. QColor(Spec spec); bool isValid() const; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 6482cc50f7..a991b89f48 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -527,6 +527,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 *) { @@ -603,6 +619,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); @@ -756,6 +796,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] = { @@ -867,6 +909,8 @@ static DestFetchProc destFetchProc[QImage::NImageFormats] = destFetch, // Format_A2BGR30_Premultiplied destFetch, // Format_RGB30 destFetch, // Format_A2RGB30_Premultiplied + destFetch, // Format_Alpha8 + destFetch, // Format_Grayscale8 }; /* @@ -1011,6 +1055,8 @@ static DestStoreProc destStoreProc[QImage::NImageFormats] = destStore, // Format_A2BGR30_Premultiplied destStore, // Format_RGB30 destStore, // Format_A2RGB30_Premultiplied + destStore, // Format_Alpha8 + destStore, // Format_Grayscale8 }; /* @@ -2266,6 +2312,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchUntransformed, // Format_A2BGR30_Premultiplied fetchUntransformed, // Format_RGB30 fetchUntransformed, // Format_A2RGB30_Premultiplied + fetchUntransformed, // Alpha8 + fetchUntransformed, // Grayscale8 }, // Tiled { @@ -2291,7 +2339,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 { @@ -2318,6 +2368,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 @@ -2343,6 +2395,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 @@ -2368,6 +2422,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 @@ -2392,7 +2448,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 }, }; @@ -5815,6 +5873,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_untransformed_generic, blend_untransformed_generic, blend_untransformed_generic, + blend_untransformed_generic, + blend_untransformed_generic, }, // Tiled { @@ -5841,6 +5901,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_tiled_generic, blend_tiled_generic, blend_tiled_generic, + blend_tiled_generic, + blend_tiled_generic, }, // Transformed { @@ -5867,6 +5929,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, + blend_src_generic, }, // TransformedTiled { @@ -5892,6 +5956,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, blend_src_generic }, // Bilinear @@ -5919,6 +5984,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, + blend_src_generic, }, // BilinearTiled { @@ -5945,6 +6012,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 } }; @@ -6465,6 +6534,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 @@ -6649,6 +6734,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 b55f3b0dcc..442eda14ad 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -473,6 +473,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); @@ -529,6 +544,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/qpainter.cpp b/src/gui/painting/qpainter.cpp index 57079a5b21..eeebfde98c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -200,11 +200,8 @@ void QPainterPrivate::checkEmulation() QPainterPrivate::~QPainterPrivate() { delete emulationEngine; - for (int i=0; i<states.size(); ++i) - delete states.at(i); - - if (dummyState) - delete dummyState; + qDeleteAll(states); + delete dummyState; } @@ -456,7 +453,7 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio p.drawPath(originalPath); #ifndef QT_NO_DEBUG - static bool do_fallback_overlay = qgetenv("QT_PAINT_FALLBACK_OVERLAY").size() > 0; + static bool do_fallback_overlay = !qEnvironmentVariableIsEmpty("QT_PAINT_FALLBACK_OVERLAY"); if (do_fallback_overlay) { QImage block(8, 8, QImage::Format_ARGB32_Premultiplied); QPainter pt(&block); @@ -3432,8 +3429,7 @@ void QPainter::drawPath(const QPainterPath &path) \fn void QPainter::drawLine(int x1, int y1, int x2, int y2) \overload - Draws a line from (\a x1, \a y1) to (\a x2, \a y2) and sets the - current pen position to (\a x2, \a y2). + Draws a line from (\a x1, \a y1) to (\a x2, \a y2). */ /*! @@ -7024,7 +7020,7 @@ void QPainter::setRenderHint(RenderHint hint, bool on) #endif #ifndef QT_NO_DEBUG - static const bool antialiasingDisabled = qgetenv("QT_NO_ANTIALIASING").toInt(); + static const bool antialiasingDisabled = qEnvironmentVariableIntValue("QT_NO_ANTIALIASING"); if (hint == QPainter::Antialiasing && antialiasingDisabled) return; #endif diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 46d016de6b..8cf45863b8 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -2319,6 +2319,14 @@ int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor, return patternObj; } +static inline bool is_monochrome(const QVector<QRgb> &colorTable) +{ + return colorTable.size() == 2 + && colorTable.at(0) == QColor(Qt::black).rgba() + && colorTable.at(1) == QColor(Qt::white).rgba() + ; +} + /*! * Adds an image to the pdf and return the pdf-object id. Returns -1 if adding the image failed. */ @@ -2333,10 +2341,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n QImage image = img; QImage::Format format = image.format(); - if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2 - && img.colorTable().at(0) == QColor(Qt::black).rgba() - && img.colorTable().at(1) == QColor(Qt::white).rgba()) - { + if (image.depth() == 1 && *bitmap && is_monochrome(img.colorTable())) { if (format == QImage::Format_MonoLSB) image = image.convertToFormat(QImage::Format_Mono); format = QImage::Format_Mono; diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h index 6b0516e557..e6bda490ff 100644 --- a/src/gui/painting/qrgb.h +++ b/src/gui/painting/qrgb.h @@ -72,9 +72,11 @@ inline Q_DECL_CONSTEXPR int qGray(QRgb rgb) // convert RGB to gra inline Q_DECL_CONSTEXPR bool qIsGray(QRgb rgb) { return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); } +template <int ProcessorWordSize> +inline QRgb qPremultiply_impl(QRgb x); -#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit version -inline QRgb qPremultiply(QRgb x) +template <> // 64-bit version +inline QRgb qPremultiply_impl<8>(QRgb x) { const uint a = qAlpha(x); quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; @@ -82,8 +84,9 @@ inline QRgb qPremultiply(QRgb x) t &= 0x000000ff00ff00ff; return (uint(t)) | (uint(t >> 24)) | (a << 24); } -#else // 32-bit version -inline QRgb qPremultiply(QRgb x) + +template <> // 32-bit version +inline QRgb qPremultiply_impl<4>(QRgb x) { const uint a = qAlpha(x); uint t = (x & 0xff00ff) * a; @@ -96,7 +99,8 @@ inline QRgb qPremultiply(QRgb x) x |= t | (a << 24); return x; } -#endif + +inline QRgb qPremultiply(QRgb x) { return qPremultiply_impl<Q_PROCESSOR_WORDSIZE>(x); } Q_GUI_EXPORT extern const uint qt_inv_premul_factor[]; diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index e12d61bbf4..79ebf12fec 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -285,13 +285,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); |