diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-03-03 18:14:48 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-03-03 18:14:48 +0100 |
commit | 667f2f6719e73297160e608b8c37addd2e5b4fe3 (patch) | |
tree | decadff308353dfc2d567def31aab0d3aff2b86e /src | |
parent | be4d9a6db630549669110100c6c5afdf884f8108 (diff) | |
parent | b725b5fd9158d95f3693a06425924271ee4b4239 (diff) | |
download | qtsvg-667f2f6719e73297160e608b8c37addd2e5b4fe3.tar.gz |
Merge remote-tracking branch 'origin/5.5' into dev
Change-Id: Idaa606177bbdd5b078d04d5e9916d319bf00b66b
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp | 5 | ||||
-rw-r--r-- | src/svg/qsvggenerator.cpp | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp index acd4c88..0ccf551 100644 --- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp +++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp @@ -220,7 +220,10 @@ void QSvgIconEngine::addFile(const QString &fileName, const QSize &, void QSvgIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) { - painter->drawPixmap(rect, pixmap(rect.size(), mode, state)); + QSize pixmapSize = rect.size(); + if (painter->device()) + pixmapSize *= painter->device()->devicePixelRatio(); + painter->drawPixmap(rect, pixmap(pixmapSize, mode, state)); } QString QSvgIconEngine::key() const diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index 7374d14..6ffab05 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -257,17 +257,17 @@ public: if (!constantAlpha) { const qreal spacing = qreal(0.02); QGradientStops newStops; - QRgb fromColor = PREMUL(stops.at(0).second.rgba()); + QRgb fromColor = qPremultiply(stops.at(0).second.rgba()); QRgb toColor; for (int i = 0; i + 1 < stops.size(); ++i) { int parts = qCeil((stops.at(i + 1).first - stops.at(i).first) / spacing); newStops.append(stops.at(i)); - toColor = PREMUL(stops.at(i + 1).second.rgba()); + toColor = qPremultiply(stops.at(i + 1).second.rgba()); if (parts > 1) { qreal step = (stops.at(i + 1).first - stops.at(i).first) / parts; for (int j = 1; j < parts; ++j) { - QRgb color = INV_PREMUL(INTERPOLATE_PIXEL_256(fromColor, 256 - 256 * j / parts, toColor, 256 * j / parts)); + QRgb color = qUnpremultiply(INTERPOLATE_PIXEL_256(fromColor, 256 - 256 * j / parts, toColor, 256 * j / parts)); newStops.append(QGradientStop(stops.at(i).first + j * step, QColor::fromRgba(color))); } } |