summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-06-04 13:49:06 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-06-04 13:49:06 (GMT)
commitda7b5677262254aada234ac2c71d54d8fee3c711 (patch)
tree56affaa770244028ddec22f9e1cc19e94d445920 /src/gui/painting
parentc3cad947658ba2ea70e6b9335dd365192a6ed4c4 (diff)
downloadQt-da7b5677262254aada234ac2c71d54d8fee3c711.zip
Qt-da7b5677262254aada234ac2c71d54d8fee3c711.tar.gz
Qt-da7b5677262254aada234ac2c71d54d8fee3c711.tar.bz2
Implement a dummy QColorMap for Symbian.
It seems that this class has been completely forgotten until now, but this never causes any problems because apparently no one uses it. Provide a quick little implementation to get things linking. Implementation brought to you courtesy of Qt/Mac.
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/painting.pri3
-rw-r--r--src/gui/painting/qcolormap_s60.cpp112
2 files changed, 114 insertions, 1 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 33d53e4..693e506 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -190,7 +190,8 @@ embedded {
symbian {
SOURCES += \
painting/qpaintdevice_s60.cpp \
- painting/qregion_s60.cpp
+ painting/qregion_s60.cpp \
+ painting/qcolormap_s60.cpp
}
x11|embedded {
diff --git a/src/gui/painting/qcolormap_s60.cpp b/src/gui/painting/qcolormap_s60.cpp
new file mode 100644
index 0000000..c21eba9
--- /dev/null
+++ b/src/gui/painting/qcolormap_s60.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcolormap.h"
+#include "qcolor.h"
+
+QT_BEGIN_NAMESPACE
+
+class QColormapPrivate
+{
+public:
+ inline QColormapPrivate()
+ : ref(1)
+ { }
+
+ QAtomicInt ref;
+};
+static QColormap *qt_symbian_color_map = 0;
+
+void QColormap::initialize()
+{
+ qt_symbian_color_map = new QColormap;
+}
+
+void QColormap::cleanup()
+{
+ delete qt_symbian_color_map;
+ qt_symbian_color_map = 0;
+}
+
+QColormap QColormap::instance(int)
+{
+ return *qt_symbian_color_map;
+}
+
+QColormap::QColormap() : d(new QColormapPrivate)
+{}
+
+QColormap::QColormap(const QColormap &colormap) :d (colormap.d)
+{ d->ref.ref(); }
+
+QColormap::~QColormap()
+{
+ if (!d->ref.deref())
+ delete d;
+}
+
+QColormap::Mode QColormap::mode() const
+{ return QColormap::Direct; }
+
+int QColormap::depth() const
+{
+ return 32;
+}
+
+int QColormap::size() const
+{
+ return -1;
+}
+
+uint QColormap::pixel(const QColor &color) const
+{ return color.rgba(); }
+
+const QColor QColormap::colorAt(uint pixel) const
+{ return QColor(pixel); }
+
+const QVector<QColor> QColormap::colormap() const
+{ return QVector<QColor>(); }
+
+QColormap &QColormap::operator=(const QColormap &colormap)
+{ qAtomicAssign(d, colormap.d); return *this; }
+
+QT_END_NAMESPACE
+