summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbackingstore.cpp4
-rw-r--r--src/gui/painting/qbrush.cpp81
-rw-r--r--src/gui/painting/qbrush.h10
-rw-r--r--src/gui/painting/qcolorspace.cpp29
-rw-r--r--src/gui/painting/qcolorspace.h3
-rw-r--r--src/gui/painting/qcolorspace_p.h1
-rw-r--r--src/gui/painting/qicc.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpaintengineex.cpp44
-rw-r--r--src/gui/painting/qpainterpath.cpp38
-rw-r--r--src/gui/painting/qpainterpath.h5
-rw-r--r--src/gui/painting/qpainterpath_p.h9
-rw-r--r--src/gui/painting/qpixellayout.cpp22
-rw-r--r--src/gui/painting/qrasterizer.cpp2
-rw-r--r--src/gui/painting/qstroker_p.h2
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp1
-rw-r--r--src/gui/painting/qtriangulator.cpp13
17 files changed, 158 insertions, 112 deletions
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 23fc942234..a2e5f7286e 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -151,15 +151,11 @@ void QBackingStore::beginPaint(const QRegion &region)
|| source->size() != d_ptr->highDpiBackingstore->size()
|| source->devicePixelRatio() != d_ptr->highDpiBackingstore->devicePixelRatio();
if (needsNewImage) {
- qCDebug(lcScaling) << "QBackingStore::beginPaint new backingstore for" << d_ptr->window;
- qCDebug(lcScaling) << " source size" << source->size() << "dpr" << source->devicePixelRatio();
d_ptr->highDpiBackingstore.reset(
new QImage(source->bits(), source->width(), source->height(), source->bytesPerLine(), source->format()));
qreal targetDevicePixelRatio = d_ptr->window->devicePixelRatio();
d_ptr->highDpiBackingstore->setDevicePixelRatio(targetDevicePixelRatio);
- qCDebug(lcScaling) <<" destination size" << d_ptr->highDpiBackingstore->size()
- << "dpr" << targetDevicePixelRatio;
}
}
}
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 60d0b41624..01a0abbce2 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -57,6 +57,11 @@
QT_BEGIN_NAMESPACE
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
+// Avoid an ABI break due to the QScopedPointer->std::unique_ptr change
+static_assert(sizeof(QBrush::DataPtr) == sizeof(QScopedPointer<QBrushData, QBrushDataPointerDeleter>));
+#endif
+
const uchar *qt_patternForBrush(int brushStyle, bool invert)
{
Q_ASSERT(brushStyle > Qt::SolidPattern && brushStyle < Qt::LinearGradientPattern);
@@ -231,7 +236,7 @@ bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush& brush)
{
if (brush.style() != Qt::TexturePattern)
return false;
- QTexturedBrushData *tx_data = static_cast<QTexturedBrushData *>(brush.d.data());
+ QTexturedBrushData *tx_data = static_cast<QTexturedBrushData *>(brush.d.get());
return tx_data->m_has_pixmap_texture;
}
@@ -240,31 +245,27 @@ struct QGradientBrushData : public QBrushData
QGradient gradient;
};
-struct QBrushDataPointerDeleter
+static void deleteData(QBrushData *d)
{
- static inline void deleteData(QBrushData *d)
- {
- switch (d->style) {
- case Qt::TexturePattern:
- delete static_cast<QTexturedBrushData*>(d);
- break;
- case Qt::LinearGradientPattern:
- case Qt::RadialGradientPattern:
- case Qt::ConicalGradientPattern:
- delete static_cast<QGradientBrushData*>(d);
- break;
- default:
- delete d;
- }
+ switch (d->style) {
+ case Qt::TexturePattern:
+ delete static_cast<QTexturedBrushData*>(d);
+ break;
+ case Qt::LinearGradientPattern:
+ case Qt::RadialGradientPattern:
+ case Qt::ConicalGradientPattern:
+ delete static_cast<QGradientBrushData*>(d);
+ break;
+ default:
+ delete d;
}
+}
- static inline void cleanup(QBrushData *d)
- {
- if (d && !d->ref.deref()) {
- deleteData(d);
- }
- }
-};
+void QBrushDataPointerDeleter::operator()(QBrushData *d) const noexcept
+{
+ if (d && !d->ref.deref())
+ deleteData(d);
+}
/*!
\class QBrush
@@ -532,7 +533,7 @@ QBrush::QBrush(Qt::GlobalColor color, const QPixmap &pixmap)
*/
QBrush::QBrush(const QBrush &other)
- : d(other.d.data())
+ : d(other.d.get())
{
d->ref.ref();
}
@@ -559,7 +560,7 @@ QBrush::QBrush(const QGradient &gradient)
};
init(QColor(), enum_table[gradient.type()]);
- QGradientBrushData *grad = static_cast<QGradientBrushData *>(d.data());
+ QGradientBrushData *grad = static_cast<QGradientBrushData *>(d.get());
grad->gradient = gradient;
}
@@ -586,12 +587,12 @@ void QBrush::detach(Qt::BrushStyle newStyle)
return;
}
- QScopedPointer<QBrushData, QBrushDataPointerDeleter> x;
+ DataPtr x;
switch(newStyle) {
case Qt::TexturePattern: {
QTexturedBrushData *tbd = new QTexturedBrushData;
if (d->style == Qt::TexturePattern) {
- QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.data());
+ QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.get());
if (data->m_has_pixmap_texture)
tbd->setPixmap(data->pixmap());
else
@@ -609,7 +610,7 @@ void QBrush::detach(Qt::BrushStyle newStyle)
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
gbd->gradient =
- static_cast<QGradientBrushData *>(d.data())->gradient;
+ static_cast<QGradientBrushData *>(d.get())->gradient;
break;
default:
break;
@@ -642,7 +643,7 @@ QBrush &QBrush::operator=(const QBrush &b)
return *this;
b.d->ref.ref();
- d.reset(b.d.data());
+ d.reset(b.d.get());
return *this;
}
@@ -743,7 +744,7 @@ void QBrush::setColor(const QColor &c)
QPixmap QBrush::texture() const
{
return d->style == Qt::TexturePattern
- ? (static_cast<QTexturedBrushData *>(d.data()))->pixmap()
+ ? (static_cast<QTexturedBrushData *>(d.get()))->pixmap()
: QPixmap();
}
@@ -761,7 +762,7 @@ void QBrush::setTexture(const QPixmap &pixmap)
{
if (!pixmap.isNull()) {
detach(Qt::TexturePattern);
- QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.data());
+ QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.get());
data->setPixmap(pixmap);
} else {
detach(Qt::NoBrush);
@@ -784,7 +785,7 @@ void QBrush::setTexture(const QPixmap &pixmap)
QImage QBrush::textureImage() const
{
return d->style == Qt::TexturePattern
- ? (static_cast<QTexturedBrushData *>(d.data()))->image()
+ ? (static_cast<QTexturedBrushData *>(d.get()))->image()
: QImage();
}
@@ -809,7 +810,7 @@ void QBrush::setTextureImage(const QImage &image)
{
if (!image.isNull()) {
detach(Qt::TexturePattern);
- QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.data());
+ QTexturedBrushData *data = static_cast<QTexturedBrushData *>(d.get());
data->setImage(image);
} else {
detach(Qt::NoBrush);
@@ -825,7 +826,7 @@ const QGradient *QBrush::gradient() const
if (d->style == Qt::LinearGradientPattern
|| d->style == Qt::RadialGradientPattern
|| d->style == Qt::ConicalGradientPattern) {
- return &static_cast<const QGradientBrushData *>(d.data())->gradient;
+ return &static_cast<const QGradientBrushData *>(d.get())->gradient;
}
return nullptr;
}
@@ -943,16 +944,16 @@ bool QBrush::operator==(const QBrush &b) const
const QPixmap *us = nullptr, *them = nullptr;
qint64 cacheKey1, cacheKey2;
if (qHasPixmapTexture(*this)) {
- us = (static_cast<QTexturedBrushData *>(d.data()))->m_pixmap;
+ us = (static_cast<QTexturedBrushData *>(d.get()))->m_pixmap;
cacheKey1 = us->cacheKey();
} else
- cacheKey1 = (static_cast<QTexturedBrushData *>(d.data()))->image().cacheKey();
+ cacheKey1 = (static_cast<QTexturedBrushData *>(d.get()))->image().cacheKey();
if (qHasPixmapTexture(b)) {
- them = (static_cast<QTexturedBrushData *>(b.d.data()))->m_pixmap;
+ them = (static_cast<QTexturedBrushData *>(b.d.get()))->m_pixmap;
cacheKey2 = them->cacheKey();
} else
- cacheKey2 = (static_cast<QTexturedBrushData *>(b.d.data()))->image().cacheKey();
+ cacheKey2 = (static_cast<QTexturedBrushData *>(b.d.get()))->image().cacheKey();
if (cacheKey1 != cacheKey2)
return false;
@@ -969,8 +970,8 @@ bool QBrush::operator==(const QBrush &b) const
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
{
- const QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data());
- const QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data());
+ const QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.get());
+ const QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.get());
return d1->gradient == d2->gradient;
}
default:
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index 5ab9e88443..b5bdd9fb24 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -57,7 +57,10 @@ struct QBrushData;
class QPixmap;
class QGradient;
class QVariant;
-struct QBrushDataPointerDeleter;
+struct QBrushDataPointerDeleter
+{
+ void operator()(QBrushData *d) const noexcept;
+};
class Q_GUI_EXPORT QBrush
{
@@ -107,6 +110,8 @@ public:
bool operator==(const QBrush &b) const;
inline bool operator!=(const QBrush &b) const { return !(operator==(b)); }
+ using DataPtr = std::unique_ptr<QBrushData, QBrushDataPointerDeleter>;
+
private:
friend class QRasterPaintEngine;
friend class QRasterPaintEnginePrivate;
@@ -115,11 +120,10 @@ private:
friend bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush& brush);
void detach(Qt::BrushStyle newStyle);
void init(const QColor &color, Qt::BrushStyle bs);
- QScopedPointer<QBrushData, QBrushDataPointerDeleter> d;
+ DataPtr d;
public:
inline bool isDetached() const;
- typedef QScopedPointer<QBrushData, QBrushDataPointerDeleter> DataPtr;
inline DataPtr &data_ptr() { return d; }
};
diff --git a/src/gui/painting/qcolorspace.cpp b/src/gui/painting/qcolorspace.cpp
index e1f8d0b63b..e770d929d3 100644
--- a/src/gui/painting/qcolorspace.cpp
+++ b/src/gui/painting/qcolorspace.cpp
@@ -1014,6 +1014,35 @@ QColorSpace::operator QVariant() const
return QVariant::fromValue(*this);
}
+/*!
+ Returns the name or short description. If a description hasn't been given
+ in setDescription(), the original name of the profile is returned if the
+ profile is unmodified, a guessed name is returned if the profile has been
+ recognized as a known color space, otherwise an empty string is returned.
+
+ \since 6.2
+*/
+QString QColorSpace::description() const noexcept
+{
+ if (d_ptr)
+ return d_ptr->userDescription.isEmpty() ? d_ptr->description : d_ptr->userDescription;
+ return QString();
+}
+
+/*!
+ Sets the name or short description of the color space to \a description.
+
+ If set to empty description() will return original or guessed descriptions
+ instead.
+
+ \since 6.2
+*/
+void QColorSpace::setDescription(const QString &description)
+{
+ detach();
+ d_ptr->userDescription = description;
+}
+
/*****************************************************************************
QColorSpace stream functions
*****************************************************************************/
diff --git a/src/gui/painting/qcolorspace.h b/src/gui/painting/qcolorspace.h
index 1620c75473..43ae2257c0 100644
--- a/src/gui/painting/qcolorspace.h
+++ b/src/gui/painting/qcolorspace.h
@@ -118,6 +118,9 @@ public:
TransferFunction transferFunction() const noexcept;
float gamma() const noexcept;
+ QString description() const noexcept;
+ void setDescription(const QString &description);
+
void setTransferFunction(TransferFunction transferFunction, float gamma = 0.0f);
void setTransferFunction(const QList<uint16_t> &transferFunctionTable);
void setTransferFunctions(const QList<uint16_t> &redTransferFunctionTable,
diff --git a/src/gui/painting/qcolorspace_p.h b/src/gui/painting/qcolorspace_p.h
index 65e5bcf5ff..b5e5263cae 100644
--- a/src/gui/painting/qcolorspace_p.h
+++ b/src/gui/painting/qcolorspace_p.h
@@ -133,6 +133,7 @@ public:
QColorMatrix toXyz;
QString description;
+ QString userDescription;
QByteArray iccProfile;
static QBasicMutex s_lutWriteLock;
diff --git a/src/gui/painting/qicc.cpp b/src/gui/painting/qicc.cpp
index 2e6d295ce5..8196ccc595 100644
--- a/src/gui/painting/qicc.cpp
+++ b/src/gui/painting/qicc.cpp
@@ -407,7 +407,7 @@ QByteArray toIccProfile(const QColorSpace &space)
}
descOffset = currentOffset;
- QByteArray description = spaceDPtr->description.toUtf8();
+ QByteArray description = space.description().toUtf8();
stream << uint(Tag::desc) << uint(0);
stream << uint(description.size() + 1);
stream.writeRawData(description.constData(), description.size() + 1);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 26f8de5b8b..19a0fac972 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3745,6 +3745,8 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
const QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB);
QImage dest = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied);
+ if (sourceImage.isNull() || dest.isNull())
+ return image; // we must have run out of memory
QRgb fg = qPremultiply(color.rgba());
QRgb bg = 0;
@@ -3754,8 +3756,6 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
for (int y=0; y<height; ++y) {
const uchar *source = sourceImage.constScanLine(y);
QRgb *target = reinterpret_cast<QRgb *>(dest.scanLine(y));
- if (!source || !target)
- QT_THROW(std::bad_alloc()); // we must have run out of memory
for (int x=0; x < width; ++x)
target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg;
}
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 7e26928e32..d752c01f6a 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -385,7 +385,7 @@ QPainterState *QPaintEngineEx::createState(QPainterState *orig) const
Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
-void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
+void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &inPen)
{
#ifdef QT_DEBUG_DRAW
qDebug() << "QPaintEngineEx::stroke()" << pen;
@@ -403,6 +403,38 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
d->stroker.setCubicToHook(qpaintengineex_cubicTo);
}
+ QRectF clipRect;
+ QPen pen = inPen;
+ if (pen.style() > Qt::SolidLine) {
+ QRectF cpRect = path.controlPointRect();
+ const QTransform &xf = state()->matrix;
+ if (pen.isCosmetic()) {
+ clipRect = d->exDeviceRect;
+ cpRect.translate(xf.dx(), xf.dy());
+ } else {
+ clipRect = xf.inverted().mapRect(QRectF(d->exDeviceRect));
+ }
+ // Check to avoid generating unwieldy amount of dashes that will not be visible anyway
+ QRectF extentRect = cpRect & clipRect;
+ qreal extent = qMax(extentRect.width(), extentRect.height());
+ qreal patternLength = 0;
+ const QList<qreal> pattern = pen.dashPattern();
+ const int patternSize = qMin(pattern.size(), 32);
+ for (int i = 0; i < patternSize; i++)
+ patternLength += qMax(pattern.at(i), qreal(0));
+ if (pen.widthF())
+ patternLength *= pen.widthF();
+ if (qFuzzyIsNull(patternLength)) {
+ pen.setStyle(Qt::NoPen);
+ } else if (extent / patternLength > 10000) {
+ // approximate stream of tiny dashes with semi-transparent solid line
+ pen.setStyle(Qt::SolidLine);
+ QColor color(pen.color());
+ color.setAlpha(color.alpha() / 2);
+ pen.setColor(color);
+ }
+ }
+
if (!qpen_fast_equals(pen, d->strokerPen)) {
d->strokerPen = pen;
d->stroker.setJoinStyle(pen.joinStyle());
@@ -430,14 +462,8 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
return;
}
- if (pen.style() > Qt::SolidLine) {
- if (pen.isCosmetic()) {
- d->activeStroker->setClipRect(d->exDeviceRect);
- } else {
- QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect));
- d->activeStroker->setClipRect(clipRect);
- }
- }
+ if (!clipRect.isNull())
+ d->activeStroker->setClipRect(clipRect);
if (d->activeStroker == &d->stroker)
d->stroker.setForceOpen(path.hasExplicitOpen());
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 38acc66ba4..6042106399 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -88,15 +88,6 @@ static bool hasValidCoords(QRectF r)
return isValidCoord(r.x()) && isValidCoord(r.y()) && isValidCoord(r.width()) && isValidCoord(r.height());
}
-struct QPainterPathPrivateDeleter
-{
- static inline void cleanup(QPainterPathPrivate *d)
- {
- if (d && !d->ref.deref())
- delete d;
- }
-};
-
// This value is used to determine the length of control point vectors
// when approximating arc segments as curves. The factor is multiplied
// with the radius of the circle.
@@ -554,12 +545,7 @@ QPainterPath::QPainterPath() noexcept
\sa operator=()
*/
-QPainterPath::QPainterPath(const QPainterPath &other)
- : d_ptr(other.d_ptr.data())
-{
- if (d_ptr)
- d_ptr->ref.ref();
-}
+QPainterPath::QPainterPath(const QPainterPath &other) = default;
/*!
Creates a QPainterPath object with the given \a startPoint as its
@@ -575,23 +561,13 @@ QPainterPath::QPainterPath(const QPointF &startPoint)
void QPainterPath::detach()
{
- if (d_ptr->ref.loadRelaxed() != 1)
- detach_helper();
+ d_ptr.detach();
setDirty(true);
}
/*!
\internal
*/
-void QPainterPath::detach_helper()
-{
- QPainterPathPrivate *data = new QPainterPathPrivate(*d_func());
- d_ptr.reset(data);
-}
-
-/*!
- \internal
-*/
void QPainterPath::ensureData_helper()
{
QPainterPathPrivate *data = new QPainterPathPrivate;
@@ -611,12 +587,8 @@ void QPainterPath::ensureData_helper()
*/
QPainterPath &QPainterPath::operator=(const QPainterPath &other)
{
- if (other.d_func() != d_func()) {
- QPainterPathPrivate *data = other.d_func();
- if (data)
- data->ref.ref();
- d_ptr.reset(data);
- }
+ QPainterPath copy(other);
+ swap(copy);
return *this;
}
@@ -1369,7 +1341,7 @@ void QPainterPath::addRegion(const QRegion &region)
*/
Qt::FillRule QPainterPath::fillRule() const
{
- return isEmpty() ? Qt::OddEvenFill : d_func()->fillRule;
+ return !d_func() ? Qt::OddEvenFill : d_func()->fillRule;
}
/*!
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 0099a7408a..7dadc4084d 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -46,7 +46,7 @@
#include <QtCore/qline.h>
#include <QtCore/qlist.h>
#include <QtCore/qrect.h>
-#include <QtCore/qscopedpointer.h>
+#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
@@ -197,12 +197,11 @@ public:
QPainterPath &operator-=(const QPainterPath &other);
private:
- QScopedPointer<QPainterPathPrivate, QPainterPathPrivateDeleter> d_ptr;
+ QExplicitlySharedDataPointer<QPainterPathPrivate> d_ptr;
inline void ensureData() { if (!d_ptr) ensureData_helper(); }
void ensureData_helper();
void detach();
- void detach_helper();
void setDirty(bool);
void computeBoundingRect() const;
void computeControlPointRect() const;
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index 24feaf410b..5a07e3dc8d 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -55,6 +55,7 @@
#include "QtGui/qpainterpath.h"
#include "QtGui/qregion.h"
#include "QtCore/qlist.h"
+#include "QtCore/qshareddata.h"
#include "QtCore/qvarlengtharray.h"
#include <qdebug.h>
@@ -128,7 +129,7 @@ private:
Q_DISABLE_COPY_MOVE(QVectorPathConverter)
};
-class QPainterPathPrivate
+class QPainterPathPrivate : public QSharedData
{
public:
friend class QPainterPath;
@@ -143,7 +144,7 @@ public:
#endif
QPainterPathPrivate() noexcept
- : ref(1),
+ : QSharedData(),
cStart(0),
fillRule(Qt::OddEvenFill),
require_moveTo(false),
@@ -155,7 +156,7 @@ public:
}
QPainterPathPrivate(const QPainterPathPrivate &other) noexcept
- : ref(1),
+ : QSharedData(other),
elements(other.elements),
cStart(other.cStart),
fillRule(other.fillRule),
@@ -184,7 +185,6 @@ public:
}
private:
- QAtomicInt ref;
QList<QPainterPath::Element> elements;
int cStart;
@@ -292,7 +292,6 @@ inline void QPainterPathPrivate::clear()
elements.clear();
cStart = 0;
- fillRule = Qt::OddEvenFill;
bounds = {};
controlBounds = {};
diff --git a/src/gui/painting/qpixellayout.cpp b/src/gui/painting/qpixellayout.cpp
index 8dd62b0c00..ca6bca344f 100644
--- a/src/gui/painting/qpixellayout.cpp
+++ b/src/gui/painting/qpixellayout.cpp
@@ -1333,7 +1333,7 @@ static void QT_FASTCALL storeRGB64FromRGB32(uchar *dest, const uint *src, int in
{
QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
for (int i = 0; i < count; ++i)
- d[i] = QRgba64::fromArgb32(src[i]);
+ d[i] = QRgba64::fromArgb32(src[i] | 0xff000000);
}
static const uint *QT_FASTCALL fetchRGBA64ToARGB32PM(uint *buffer, const uchar *src, int index, int count,
@@ -1345,12 +1345,24 @@ static const uint *QT_FASTCALL fetchRGBA64ToARGB32PM(uint *buffer, const uchar *
return buffer;
}
+template<bool Mask>
static void QT_FASTCALL storeRGBA64FromARGB32PM(uchar *dest, const uint *src, int index, int count,
const QList<QRgb> *, QDitherInfo *)
{
QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
- for (int i = 0; i < count; ++i)
+ for (int i = 0; i < count; ++i) {
d[i] = QRgba64::fromArgb32(src[i]).unpremultiplied();
+ if (Mask)
+ d[i].setAlpha(65535);
+ }
+}
+
+static void QT_FASTCALL storeRGBA64FromARGB32(uchar *dest, const uint *src, int index, int count,
+ const QList<QRgb> *, QDitherInfo *)
+{
+ QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index;
+ for (int i = 0; i < count; ++i)
+ d[i] = QRgba64::fromArgb32(src[i]);
}
// Note:
@@ -1437,15 +1449,15 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = {
{ false, false, QPixelLayout::BPP64, rbSwap_4x16,
convertPassThrough, nullptr,
fetchRGB64ToRGB32, fetchPassThrough64,
- storeRGB64FromRGB32, storeRGB64FromRGB32 }, // Format_RGBX64
+ storeRGBA64FromARGB32PM<true>, storeRGB64FromRGB32 }, // Format_RGBX64
{ true, false, QPixelLayout::BPP64, rbSwap_4x16,
convertARGB32ToARGB32PM, nullptr,
fetchRGBA64ToARGB32PM, fetchRGBA64ToRGBA64PM,
- storeRGBA64FromARGB32PM, storeRGB64FromRGB32 }, // Format_RGBA64
+ storeRGBA64FromARGB32PM<false>, storeRGB64FromRGB32 }, // Format_RGBA64
{ true, true, QPixelLayout::BPP64, rbSwap_4x16,
convertPassThrough, nullptr,
fetchRGB64ToRGB32, fetchPassThrough64,
- storeRGB64FromRGB32, storeRGB64FromRGB32 }, // Format_RGBA64_Premultiplied
+ storeRGBA64FromARGB32, storeRGB64FromRGB32 }, // Format_RGBA64_Premultiplied
{ false, false, QPixelLayout::BPP16, nullptr,
convertGrayscale16ToRGB32, convertGrayscale16ToRGBA64,
fetchGrayscale16ToRGB32, fetchGrayscale16ToRGBA64,
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 48d41f41f0..e851a3876a 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -864,7 +864,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
if (leftWidth == QScFixedFactor)
coverage[0] = rightWidth * 255;
else
- coverage[0] = (leftWidth + rightWidth) * 255;
+ coverage[0] = (rightWidth + leftWidth - QScFixedFactor) * 255;
x[0] = iLeft;
len[0] = 1;
} else {
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index 28b55f8431..eb0e5d7ffa 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -228,7 +228,7 @@ public:
qfixed miterLimit() const { return m_miterLimit; }
void setForceOpen(bool state) { m_forceOpen = state; }
- bool forceOpen() { return m_forceOpen; }
+ bool forceOpen() const { return m_forceOpen; }
void joinPoints(qfixed x, qfixed y, const QLineF &nextLine, LineJoinMode join);
inline void emitMoveTo(qfixed x, qfixed y);
diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index 44365685c8..8687d221cd 100644
--- a/src/gui/painting/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
void QTriangulatingStroker::endCapOrJoinClosed(const qreal *start, const qreal *cur,
bool implicitClose, bool endsAtStart)
{
+ Q_ASSERT(start);
if (endsAtStart) {
join(start + 2);
} else if (implicitClose) {
diff --git a/src/gui/painting/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp
index 1c21706fbd..d9c1b2c003 100644
--- a/src/gui/painting/qtriangulator.cpp
+++ b/src/gui/painting/qtriangulator.cpp
@@ -570,8 +570,8 @@ public:
class ComplexToSimple
{
public:
- inline ComplexToSimple(QTriangulator<T> *parent) : m_parent(parent),
- m_edges(0), m_events(0), m_splits(0) { }
+ inline ComplexToSimple(QTriangulator<T> *parent)
+ : m_parent(parent), m_edges(0), m_events(0), m_splits(0), m_initialPointCount(0) { }
void decompose();
private:
struct Edge
@@ -674,7 +674,8 @@ public:
class SimpleToMonotone
{
public:
- inline SimpleToMonotone(QTriangulator<T> *parent) : m_parent(parent), m_edges(0), m_upperVertex(0) { }
+ inline SimpleToMonotone(QTriangulator<T> *parent)
+ : m_parent(parent), m_edges(0), m_upperVertex(0), m_clockwiseOrder(false) { }
void decompose();
private:
enum VertexType {MergeVertex, EndVertex, RegularVertex, StartVertex, SplitVertex};
@@ -730,7 +731,8 @@ public:
class MonotoneToTriangles
{
public:
- inline MonotoneToTriangles(QTriangulator<T> *parent) : m_parent(parent) { }
+ inline MonotoneToTriangles(QTriangulator<T> *parent)
+ : m_parent(parent), m_first(0), m_length(0) { }
void decompose();
private:
inline T indices(int index) const {return m_parent->m_indices.at(index + m_first);}
@@ -748,7 +750,8 @@ public:
int m_length;
};
- inline QTriangulator() : m_vertices(0) { }
+ inline QTriangulator()
+ : m_vertices(0), m_hint(0) { }
// Call this only once.
void initialize(const qreal *polygon, int count, uint hint, const QTransform &matrix);