summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/painting.pri1
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qmatrix.cpp1
-rw-r--r--src/gui/painting/qpaintdevice.cpp16
-rw-r--r--src/gui/painting/qpaintdevice_qpa.cpp65
-rw-r--r--src/gui/painting/qpaintengineex_p.h1
-rw-r--r--src/gui/painting/qpainterpath.cpp37
-rw-r--r--src/gui/painting/qpainterpath.h67
-rw-r--r--src/gui/painting/qpainterpath_p.h23
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.cpp3
-rw-r--r--src/gui/painting/qtransform.cpp1
11 files changed, 83 insertions, 134 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index d1dd246e9c..a8f6a5bf8f 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -53,7 +53,6 @@ SOURCES += \
painting/qoutlinemapper.cpp \
painting/qpagedpaintdevice.cpp \
painting/qpaintdevice.cpp \
- painting/qpaintdevice_qpa.cpp \
painting/qpaintengine.cpp \
painting/qpaintengineex.cpp \
painting/qpainter.cpp \
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index f531565fb9..75122571d6 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2260,7 +2260,7 @@ QColor QColor::light(int factor) const
QColor hsv = toHsv();
int s = hsv.ct.ahsv.saturation;
- int v = hsv.ct.ahsv.value;
+ uint v = hsv.ct.ahsv.value;
v = (factor*v)/100;
if (v > USHRT_MAX) {
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index ced2e4548c..c26d7e5d98 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -44,6 +44,7 @@
#include "qmatrix.h"
#include "qregion.h"
#include "qpainterpath.h"
+#include "qpainterpath_p.h"
#include "qvariant.h"
#include <qmath.h>
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index d1dfa7001f..afbd86601d 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -76,4 +76,20 @@ Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice
return device->metric(metric);
}
+int QPaintDevice::metric(PaintDeviceMetric m) const
+{
+ qWarning("QPaintDevice::metrics: Device has no metric information");
+ if (m == PdmDpiX) {
+ return 72;
+ } else if (m == PdmDpiY) {
+ return 72;
+ } else if (m == PdmNumColors) {
+ // FIXME: does this need to be a real value?
+ return 256;
+ } else {
+ qDebug("Unrecognised metric %d!",m);
+ return 0;
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintdevice_qpa.cpp b/src/gui/painting/qpaintdevice_qpa.cpp
deleted file mode 100644
index e469a5f10f..0000000000
--- a/src/gui/painting/qpaintdevice_qpa.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.1, 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpaintdevice.h"
-#include "qpainter.h"
-#include "qbitmap.h"
-#include "qguiapplication.h"
-
-QT_BEGIN_NAMESPACE
-
-int QPaintDevice::metric(PaintDeviceMetric m) const
-{
- qWarning("QPaintDevice::metrics: Device has no metric information");
- if (m == PdmDpiX) {
- return 72;
- } else if (m == PdmDpiY) {
- return 72;
- } else if (m == PdmNumColors) {
- // FIXME: does this need to be a real value?
- return 256;
- } else {
- qDebug("Unrecognised metric %d!",m);
- return 0;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 31c6b30ec4..dd2f507653 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -150,7 +150,6 @@ public:
virtual void beginNativePainting() {}
virtual void endNativePainting() {}
- // ### Qt5: remove, once QtGui is merged into QtGui and QtWidgets
// Return a pixmap filter of "type" that can render the parameters
// in "prototype". The returned filter is owned by the engine and
// will be destroyed when the engine is destroyed. The "prototype"
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index e098e7c761..0e8811b934 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -478,14 +478,26 @@ static void qt_debug_path(const QPainterPath &path)
\sa ElementType, elementAt(), isEmpty()
*/
+int QPainterPath::elementCount() const
+{
+ return d_ptr ? d_ptr->elements.size() : 0;
+}
+
/*!
- \fn const QPainterPath::Element &QPainterPath::elementAt(int index) const
+ \fn QPainterPath::Element QPainterPath::elementAt(int index) const
Returns the element at the given \a index in the painter path.
\sa ElementType, elementCount(), isEmpty()
*/
+QPainterPath::Element QPainterPath::elementAt(int i) const
+{
+ Q_ASSERT(d_ptr);
+ Q_ASSERT(i >= 0 && i < elementCount());
+ return d_ptr->elements.at(i);
+}
+
/*!
\fn void QPainterPath::setElementPositionAt(int index, qreal x, qreal y)
\since 4.2
@@ -494,6 +506,17 @@ static void qt_debug_path(const QPainterPath &path)
x and \a y.
*/
+void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
+{
+ Q_ASSERT(d_ptr);
+ Q_ASSERT(i >= 0 && i < elementCount());
+ detach();
+ QPainterPath::Element &e = d_ptr->elements[i];
+ e.x = x;
+ e.y = y;
+}
+
+
/*###
\fn QPainterPath &QPainterPath::operator +=(const QPainterPath &other)
@@ -535,6 +558,13 @@ QPainterPath::QPainterPath(const QPointF &startPoint)
d_func()->elements << e;
}
+void QPainterPath::detach()
+{
+ if (d_ptr->ref.load() != 1)
+ detach_helper();
+ setDirty(true);
+}
+
/*!
\internal
*/
@@ -1451,6 +1481,11 @@ QRectF QPainterPath::controlPointRect() const
\sa elementCount()
*/
+bool QPainterPath::isEmpty() const
+{
+ return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement);
+}
+
/*!
Creates and returns a reversed copy of the path.
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 40456bc163..7bb52f4125 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -165,7 +165,7 @@ public:
Qt::FillRule fillRule() const;
void setFillRule(Qt::FillRule fillRule);
- inline bool isEmpty() const;
+ bool isEmpty() const;
QPainterPath toReversed() const;
QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const;
@@ -175,9 +175,9 @@ public:
QList<QPolygonF> toFillPolygons(const QTransform &matrix) const;
QPolygonF toFillPolygon(const QTransform &matrix) const;
- inline int elementCount() const;
- inline const QPainterPath::Element &elementAt(int i) const;
- inline void setElementPositionAt(int i, qreal x, qreal y);
+ int elementCount() const;
+ QPainterPath::Element elementAt(int i) const;
+ void setElementPositionAt(int i, qreal x, qreal y);
qreal length() const;
qreal percentAtLength(qreal t) const;
@@ -211,7 +211,7 @@ private:
inline void ensureData() { if (!d_ptr) ensureData_helper(); }
void ensureData_helper();
- inline void detach();
+ void detach();
void detach_helper();
void setDirty(bool);
void computeBoundingRect() const;
@@ -233,29 +233,6 @@ private:
#endif
};
-class QPainterPathPrivate
-{
-public:
- friend class QPainterPath;
- friend class QPainterPathData;
- friend class QPainterPathStroker;
- friend class QPainterPathStrokerPrivate;
- friend class QMatrix;
- friend class QTransform;
- friend class QVectorPath;
- friend struct QPainterPathPrivateDeleter;
-#ifndef QT_NO_DATASTREAM
- friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
- friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
-#endif
-
- QPainterPathPrivate() : ref(1) {}
-
-private:
- QAtomicInt ref;
- QVector<QPainterPath::Element> elements;
-};
-
Q_DECLARE_TYPEINFO(QPainterPath::Element, Q_PRIMITIVE_TYPE);
#ifndef QT_NO_DATASTREAM
@@ -391,40 +368,6 @@ inline void QPainterPath::translate(const QPointF &offset)
inline QPainterPath QPainterPath::translated(const QPointF &offset) const
{ return translated(offset.x(), offset.y()); }
-inline bool QPainterPath::isEmpty() const
-{
- return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement);
-}
-
-inline int QPainterPath::elementCount() const
-{
- return d_ptr ? d_ptr->elements.size() : 0;
-}
-
-inline const QPainterPath::Element &QPainterPath::elementAt(int i) const
-{
- Q_ASSERT(d_ptr);
- Q_ASSERT(i >= 0 && i < elementCount());
- return d_ptr->elements.at(i);
-}
-
-inline void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
-{
- Q_ASSERT(d_ptr);
- Q_ASSERT(i >= 0 && i < elementCount());
- detach();
- QPainterPath::Element &e = d_ptr->elements[i];
- e.x = x;
- e.y = y;
-}
-
-
-inline void QPainterPath::detach()
-{
- if (d_ptr->ref.load() != 1)
- detach_helper();
- setDirty(true);
-}
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPainterPath &);
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index a9068f3855..116ea63425 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -65,6 +65,29 @@
QT_BEGIN_NAMESPACE
+class QPainterPathPrivate
+{
+public:
+ friend class QPainterPath;
+ friend class QPainterPathData;
+ friend class QPainterPathStroker;
+ friend class QPainterPathStrokerPrivate;
+ friend class QMatrix;
+ friend class QTransform;
+ friend class QVectorPath;
+ friend struct QPainterPathPrivateDeleter;
+#ifndef QT_NO_DATASTREAM
+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
+#endif
+
+ QPainterPathPrivate() : ref(1) {}
+
+private:
+ QAtomicInt ref;
+ QVector<QPainterPath::Element> elements;
+};
+
class QPainterPathStrokerPrivate
{
public:
diff --git a/src/gui/painting/qplatformbackingstore_qpa.cpp b/src/gui/painting/qplatformbackingstore_qpa.cpp
index ff7d91ccea..485190d301 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.cpp
+++ b/src/gui/painting/qplatformbackingstore_qpa.cpp
@@ -114,9 +114,6 @@ QWindow* QPlatformBackingStore::window() const
This function is called before painting onto the surface begins,
with the \a region in which the painting will occur.
- \note A platform providing a backing store with an alpha channel
- needs to properly initialize the region to be painted.
-
\sa endPaint(), paintDevice()
*/
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index e5c41efc15..ba971d454d 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -45,6 +45,7 @@
#include "qmatrix.h"
#include "qregion.h"
#include "qpainterpath.h"
+#include "qpainterpath_p.h"
#include "qvariant.h"
#include <qmath.h>
#include <qnumeric.h>