summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-05-19 18:11:57 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-05-19 20:27:29 +0000
commitd6248ed80ed6c2d3c454183cf31e2028f3e78424 (patch)
treeaef3b1128b3a624cd57a745182f60bb11eb47e10 /src/gui
parent53335315ff11752dc0f731adb1c2d5a0f6281b25 (diff)
parent550e16b8141caf8d6c0614a423a295b0aea9cab1 (diff)
Merge "Merge remote-tracking branch 'origin/5.9.0' into 5.9" into refs/staging/5.9
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/configure.json13
-rw-r--r--src/gui/painting/qdrawhelper.cpp66
2 files changed, 42 insertions, 37 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json
index f8cee387b8..306ce13214 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -9,6 +9,7 @@
"options": {
"accessibility": "boolean",
"angle": "boolean",
+ "combined-angle-lib": "boolean",
"direct2d": "boolean",
"directfb": "boolean",
"directwrite": "boolean",
@@ -426,6 +427,13 @@
{ "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" }
]
},
+ "combined-angle-lib": {
+ "label": "Combined ANGLE Library",
+ "autoDetect": false,
+ "enable": "features.angle",
+ "condition": "features.angle",
+ "output": [ "publicFeature" ]
+ },
"directfb": {
"label": "DirectFB",
"section": "Platform plugins",
@@ -1077,6 +1085,11 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"args": "angle",
"condition": "config.win32"
},
+ {
+ "type": "feature",
+ "args": "combined-angle-lib",
+ "condition": "features.angle"
+ },
"opengl-desktop",
{
"type": "feature",
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index b2e762a391..cb3e7523a8 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5710,17 +5710,11 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, QRgba64 slinear, co
static inline void grayBlendPixel(quint32 *dst, int coverage, QRgba64 srcLinear, const QColorProfile *colorProfile)
{
// Do a gammacorrected gray alphablend...
- QRgba64 dstLinear = QRgba64::fromArgb32(*dst);
+ const QRgba64 dstLinear = colorProfile ? colorProfile->toLinear64(*dst) : QRgba64::fromArgb32(*dst);
- if (colorProfile && !dstLinear.isTransparent())
- dstLinear = colorProfile->fromLinear(dstLinear.unpremultiplied()).premultiplied();
+ QRgba64 blend = interpolate255(srcLinear, coverage, dstLinear, 255 - coverage);
- dstLinear = interpolate255(srcLinear, coverage, dstLinear, 255 - coverage);
-
- if (colorProfile && !dstLinear.isTransparent())
- dstLinear = colorProfile->fromLinear(dstLinear.unpremultiplied()).premultiplied();
-
- *dst = toArgb32(dstLinear);
+ *dst = colorProfile ? colorProfile->fromLinear64(blend) : toArgb32(blend);
}
static inline void alphamapblend_argb32(quint32 *dst, int coverage, QRgba64 srcLinear, quint32 src, const QColorProfile *colorProfile)
@@ -5730,7 +5724,12 @@ static inline void alphamapblend_argb32(quint32 *dst, int coverage, QRgba64 srcL
} else if (coverage == 255) {
*dst = src;
} else {
- grayBlendPixel(dst, coverage, srcLinear, colorProfile);
+ if (*dst >= 0xff000000) {
+ grayBlendPixel(dst, coverage, srcLinear, colorProfile);
+ } else {
+ // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
+ *dst = INTERPOLATE_PIXEL_255(src, coverage, *dst, 255 - coverage);
+ }
}
}
@@ -5818,14 +5817,25 @@ static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, co
dstColor = colorProfile->fromLinear(dstColor);
dest[x] = dstColor;
} else {
- // Give up and do a gray alphablend.
- if (colorProfile && !dstColor.isTransparent())
- dstColor = colorProfile->toLinear(dstColor.unpremultiplied()).premultiplied();
+ // Do a gray alphablend.
+ alphamapblend_generic(qRgbAvg(coverage), dest, x, srcLinear, src, colorProfile);
+ }
+ }
+}
+
+static inline void alphargbblend_argb32(quint32 *dst, uint coverage, QRgba64 srcLinear, quint32 src, const QColorProfile *colorProfile)
+{
+ if (coverage == 0xff000000) {
+ // nothing
+ } else if (coverage == 0xffffffff) {
+ *dst = src;
+ } else {
+ if (*dst >= 0xff000000) {
+ rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
+ } else {
+ // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
const int a = qRgbAvg(coverage);
- dstColor = interpolate255(srcLinear, coverage, dstColor, 255 - a);
- if (colorProfile && !dstColor.isTransparent())
- dstColor = colorProfile->fromLinear(dstColor.unpremultiplied()).premultiplied();
- dest[x] = dstColor;
+ *dst = INTERPOLATE_PIXEL_255(src, a, *dst, 255 - a);
}
}
}
@@ -5930,16 +5940,7 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
while (mapHeight--) {
for (int i = 0; i < mapWidth; ++i) {
const uint coverage = src[i];
- if (coverage == 0xffffffff) {
- dst[i] = c;
- } else if (coverage != 0xff000000) {
- if (dst[i] >= 0xff000000) {
- rgbBlendPixel(dst + i, coverage, srcColor, colorProfile);
- } else {
- // Give up and do a gray blend.
- grayBlendPixel(dst + i, qRgbAvg(coverage), srcColor, colorProfile);
- }
- }
+ alphargbblend_argb32(dst + i, coverage, srcColor, c, colorProfile);
}
dst += destStride;
@@ -5965,16 +5966,7 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
for (int xp=start; xp<end; ++xp) {
const uint coverage = src[xp - x];
- if (coverage == 0xffffffff) {
- dst[xp] = c;
- } else if (coverage != 0xff000000) {
- if (dst[xp] >= 0xff000000) {
- rgbBlendPixel(dst + xp, coverage, srcColor, colorProfile);
- } else {
- // Give up and do a gray blend.
- grayBlendPixel(dst + xp, qRgbAvg(coverage), srcColor, colorProfile);
- }
- }
+ alphargbblend_argb32(dst + xp, coverage, srcColor, c, colorProfile);
}
} // for (i -> line.count)
src += srcStride;