Fix: crash when painting with high-dpr image brush

The recently merged f5fe9fc5a4 (Add ObjectMode to QGradient) changed
combineXForm() to check the brush's gradient's
coordinatemode. However, combineXForm() is now also used when painting
with high-dpr image brush. In the latter case, the gradient is 0 so
this would crash. Testcase: tst_lancelot, image_dpr.qps.

Change-Id: I5e2785ef708768c3fa3eac0999c9c24fd25108f4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Eirik Aavitsland 2018-06-25 12:19:02 +02:00
parent 92b3ef24ed
commit 0877ced980

View File

@ -75,10 +75,10 @@ QPainterState *QEmulationPaintEngine::createState(QPainterState *orig) const
static inline void combineXForm(QBrush *brush, const QRectF &r)
{
QTransform t(r.width(), 0, 0, r.height(), r.x(), r.y());
if (brush->gradient()->coordinateMode() == QGradient::ObjectMode)
brush->setTransform(brush->transform() * t);
if (brush->gradient() && brush->gradient()->coordinateMode() != QGradient::ObjectMode)
brush->setTransform(t * brush->transform()); // compat mode
else
brush->setTransform(t * brush->transform());
brush->setTransform(brush->transform() * t);
}
void QEmulationPaintEngine::fill(const QVectorPath &path, const QBrush &brush)