summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-01 23:00:46 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2019-04-01 23:08:25 +0000
commit2f8dcdf93cb2a6156d461679d8eecd9cc4a152f8 (patch)
tree76ca84bce8d6204c28b056b0c7388f94f3888e2e /src/gui/painting
parent81ed119da1215c9dda5ff202cc1339eadb62bda4 (diff)
parentffe9c395dc5a8a3f1dfdd820557d0eadeca24f22 (diff)
Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" into refs/staging/5.13
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbrush.cpp12
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp5
2 files changed, 13 insertions, 4 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index abfa8d41bb..ed575abf54 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -545,9 +545,11 @@ QBrush::QBrush(const QBrush &other)
*/
QBrush::QBrush(const QGradient &gradient)
{
- Q_ASSERT_X(gradient.type() != QGradient::NoGradient, "QBrush::QBrush",
- "QGradient should not be used directly, use the linear, radial\n"
- "or conical gradients instead");
+ if (Q_UNLIKELY(gradient.type() == QGradient::NoGradient)) {
+ d.reset(nullBrushInstance());
+ d->ref.ref();
+ return;
+ }
const Qt::BrushStyle enum_table[] = {
Qt::LinearGradientPattern,
@@ -1376,8 +1378,10 @@ QGradient::QGradient(Preset preset)
}();
const QJsonValue presetData = jsonPresets[preset - 1];
- if (!presetData.isObject())
+ if (!presetData.isObject()) {
+ qWarning("QGradient: Undefined preset %i", preset);
return;
+ }
m_type = LinearGradient;
setCoordinateMode(ObjectMode);
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index afb4613ba5..c71d82546a 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -446,6 +446,11 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
d_ptr->blitter->setRedBlueSwizzle(false);
}
+ // There is no way to tell if the OpenGL-rendered content is premultiplied or not.
+ // For compatibility, assume that it is not, and use normal alpha blend always.
+ if (d_ptr->premultiplied)
+ funcs->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
+
// Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set.
for (int i = 0; i < textures->count(); ++i) {
if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop))