From 3dd030863435e058468df66c696e1608b71e1fd2 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 12 Dec 2017 11:35:25 +0100 Subject: Mask potentially undefined alpha in blend_transformed_argb Makes sure the ARGB32PM that is painted on always have a defined alpha. Task-number: QTBUG-55645 Change-Id: Ifcf5fcc2127d255518eca4763845a197da6c7914 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qdrawhelper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/painting/qdrawhelper.cpp') diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 6a24c02aaa..6bfdc940ac 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -4719,6 +4719,7 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; uint buffer[buffer_size]; + quint32 mask = (data->texture.format == QImage::Format_RGB32) ? 0xff000000 : 0; const int image_x1 = data->texture.x1; const int image_y1 = data->texture.y1; @@ -4752,7 +4753,7 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData while (b < end) { int px = qBound(image_x1, x >> 16, image_x2); int py = qBound(image_y1, y >> 16, image_y2); - *b = reinterpret_cast(data->texture.scanLine(py))[px]; + *b = reinterpret_cast(data->texture.scanLine(py))[px] | mask; x += fdx; y += fdy; @@ -4793,7 +4794,7 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData const int px = qBound(image_x1, int(tx) - (tx < 0), image_x2); const int py = qBound(image_y1, int(ty) - (ty < 0), image_y2); - *b = reinterpret_cast(data->texture.scanLine(py))[px]; + *b = reinterpret_cast(data->texture.scanLine(py))[px] | mask; x += fdx; y += fdy; w += fdw; -- cgit v1.2.3