diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-06-26 17:12:02 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-08 10:12:05 +0000 |
commit | 90a8de656fe689b6aa856e70e2d22de6630ea855 (patch) | |
tree | c1402760952701c854bb92cb12407283ead9dd6f /src/gui/kernel | |
parent | 17512d497d7eaf01aefe8140f5010818c0103a95 (diff) |
Long live QColorSpace and friends
Adds QColorSpace and QColorTransform classes,
and parsing of a common subset of ICC profiles
found in images, and also parses the ICC profiles
in PNG and JPEGs.
For backwards compatibility no automatic color
handling is done by this patch.
[ChangeLog][QtGui] A QColorSpace class has been added,
and color spaces are now parsed from PNG and JPEG images.
No automatic color space conversion is done however, and
applications must request it.
Change-Id: Ic09935f84640a716467fa3a9ed1e73c02daf3675
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 30 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 11 |
2 files changed, 17 insertions, 24 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 4a0febc615..6753bf64bc 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -68,7 +68,7 @@ #include <qpalette.h> #include <qscreen.h> #include "qsessionmanager.h" -#include <private/qcolorprofile_p.h> +#include <private/qcolortrclut_p.h> #include <private/qscreen_p.h> #include <QtGui/qgenericpluginfactory.h> @@ -1643,8 +1643,6 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() platform_theme = 0; delete platform_integration; platform_integration = 0; - delete m_a8ColorProfile.load(); - delete m_a32ColorProfile.load(); window_list.clear(); screen_list.clear(); @@ -4019,32 +4017,26 @@ void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag) } #endif -const QColorProfile *QGuiApplicationPrivate::colorProfileForA8Text() +const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA8Text() { #ifdef Q_OS_WIN - QColorProfile *result = m_a8ColorProfile.load(); - if (!result){ - QColorProfile *cs = QColorProfile::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering - if (!m_a8ColorProfile.testAndSetRelease(0, cs)) - delete cs; - result = m_a8ColorProfile.load(); + if (!m_a8ColorProfile){ + QColorTrcLut *cs = QColorTrcLut::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering + m_a8ColorProfile.reset(cs); } - return result; + return m_a8ColorProfile.get(); #else return colorProfileForA32Text(); #endif } -const QColorProfile *QGuiApplicationPrivate::colorProfileForA32Text() +const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA32Text() { - QColorProfile *result = m_a32ColorProfile.load(); - if (!result){ - QColorProfile *cs = QColorProfile::fromGamma(fontSmoothingGamma); - if (!m_a32ColorProfile.testAndSetRelease(0, cs)) - delete cs; - result = m_a32ColorProfile.load(); + if (!m_a32ColorProfile) { + QColorTrcLut *cs = QColorTrcLut::fromGamma(fontSmoothingGamma); + m_a32ColorProfile.reset(cs); } - return result; + return m_a32ColorProfile.get(); } void QGuiApplicationPrivate::_q_updateFocusObject(QObject *object) diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 63646dcd50..61d9661286 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -55,6 +55,7 @@ #include <QtGui/qguiapplication.h> #include <QtCore/QPointF> +#include <QtCore/QSharedPointer> #include <QtCore/private/qcoreapplication_p.h> #include <QtCore/private/qthread_p.h> @@ -66,7 +67,7 @@ QT_BEGIN_NAMESPACE -class QColorProfile; +class QColorTrcLut; class QPlatformIntegration; class QPlatformTheme; class QPlatformDragQtResponse; @@ -299,8 +300,8 @@ public: static QInputDeviceManager *inputDeviceManager(); - const QColorProfile *colorProfileForA8Text(); - const QColorProfile *colorProfileForA32Text(); + const QColorTrcLut *colorProfileForA8Text(); + const QColorTrcLut *colorProfileForA32Text(); // hook reimplemented in QApplication to apply the QStyle function on the QIcon virtual QPixmap applyQIconStyleHelper(QIcon::Mode, const QPixmap &basePixmap) const { return basePixmap; } @@ -327,8 +328,8 @@ private: static QGuiApplicationPrivate *self; static QTouchDevice *m_fakeTouchDevice; static int m_fakeMouseSourcePointId; - QAtomicPointer<QColorProfile> m_a8ColorProfile; - QAtomicPointer<QColorProfile> m_a32ColorProfile; + QSharedPointer<QColorTrcLut> m_a8ColorProfile; + QSharedPointer<QColorTrcLut> m_a32ColorProfile; bool ownGlobalShareContext; |