summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qcolor.cpp27
-rw-r--r--src/gui/painting/qpaintdevice.cpp5
-rw-r--r--src/gui/painting/qpaintdevice.h1
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp9
-rw-r--r--src/gui/painting/qpaintengine_s60.cpp2
-rw-r--r--src/gui/painting/qpaintengineex_p.h7
-rw-r--r--src/gui/painting/qpen.cpp14
7 files changed, 35 insertions, 30 deletions
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index d9b824b..4da993b 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -176,22 +176,25 @@ QT_BEGIN_NAMESPACE
\section1 Predefined Colors
- There are 20 predefined QColors: Qt::white, Qt::black,
- Qt::red, Qt::darkRed, Qt::green, Qt::darkGreen, Qt::blue,
- Qt::darkBlue, Qt::cyan, Qt::darkCyan, Qt::magenta,
- Qt::darkMagenta, Qt::yellow, Qt::darkYellow, Qt::gray,
- Qt::darkGray, Qt::lightGray, Qt::color0, Qt::color1, and
- Qt::transparent.
+ There are 20 predefined QColors described by the Qt::GlobalColor enum,
+ including black, white, primary and secondary colors, darker versions
+ of these colors and three shades of gray. QColor also recognizes a
+ variety of color names; the static colorNames() function returns a
+ QStringList color names that QColor knows about.
\img qt-colors.png Qt Colors
- QColor provides the static colorNames() function which returns a
- QStringList containing the color names Qt knows about.
+ Additionally, the Qt::color0, Qt::color1 and Qt::transparent colors
+ are used for special purposes.
- The colors Qt::color0 (zero pixel value) and Qt::color1 (non-zero
- pixel value) are special colors for drawing in QBitmaps. Painting with
- Qt::color0 sets the bitmap bits to 0 (transparent, i.e. background), and
- painting with Qt::color1 sets the bits to 1 (opaque, i.e. foreground).
+ Qt::color0 (zero pixel value) and Qt::color1 (non-zero pixel value)
+ are special colors for drawing in QBitmaps. Painting with Qt::color0
+ sets the bitmap bits to 0 (transparent; i.e., background), and painting
+ with Qt::color1 sets the bits to 1 (opaque; i.e., foreground).
+
+ Qt::transparent is used to indicate a transparent pixel. When painting
+ with this value, a pixel value will be used that is appropriate for the
+ underlying pixel format in use.
\section1 The HSV Color Model
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index 95c0b44..6114938 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -65,4 +65,9 @@ int QPaintDevice::metric(PaintDeviceMetric) const
return 0;
}
+Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice::PaintDeviceMetric metric)
+{
+ return device->metric(metric);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 92aa3cb..c8e86b8 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -137,6 +137,7 @@ public:
friend class QPainter;
friend class QFontEngineMac;
friend class QX11PaintEngine;
+ friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric);
};
#ifdef QT3_SUPPORT
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 6037bd5..240403d 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -4213,13 +4213,6 @@ void QRasterBuffer::prepare(QCustomRasterPaintDevice *device)
drawHelper = qDrawHelper + format;
}
-class MetricAccessor : public QWidget {
-public:
- int metric(PaintDeviceMetric m) {
- return QWidget::metric(m);
- }
-};
-
int QCustomRasterPaintDevice::metric(PaintDeviceMetric m) const
{
switch (m) {
@@ -4231,7 +4224,7 @@ int QCustomRasterPaintDevice::metric(PaintDeviceMetric m) const
break;
}
- return (static_cast<MetricAccessor*>(widget)->metric(m));
+ return qt_paint_device_metric(widget, m);
}
int QCustomRasterPaintDevice::bytesPerLine() const
diff --git a/src/gui/painting/qpaintengine_s60.cpp b/src/gui/painting/qpaintengine_s60.cpp
index e17dba1..6f4f398 100644
--- a/src/gui/painting/qpaintengine_s60.cpp
+++ b/src/gui/painting/qpaintengine_s60.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
class QS60PaintEnginePrivate : public QRasterPaintEnginePrivate
{
public:
- QS60PaintEnginePrivate(QS60PaintEngine *engine) { }
+ QS60PaintEnginePrivate(QS60PaintEngine *engine) { Q_UNUSED(engine); }
};
QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PixmapData *data)
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 81ed06b..3ec9bd6 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -54,6 +54,7 @@
//
#include <QtGui/qpaintengine.h>
+#include <QtGui/qdrawutil.h>
#include <private/qpaintengine_p.h>
#include <private/qstroker_p.h>
@@ -71,12 +72,6 @@ class QPainterState;
class QPaintEngineExPrivate;
struct StrokeHandler;
-namespace QDrawPixmaps
-{
- struct Data;
- enum DrawingHint;
-}
-
struct QIntRect {
int x1, y1, x2, y2;
inline void set(const QRect &r) {
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index a050cb2..41efc80 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -411,6 +411,8 @@ Qt::PenStyle QPen::style() const
pattern using the setDashPattern() function which implicitly
converts the style of the pen to Qt::CustomDashLine.
+ \note This function resets the dash offset to zero.
+
\sa style(), {QPen#Pen Style}{Pen Style}
*/
@@ -420,7 +422,9 @@ void QPen::setStyle(Qt::PenStyle s)
return;
detach();
d->style = s;
- static_cast<QPenData *>(d)->dashPattern.clear();
+ QPenData *dd = static_cast<QPenData *>(d);
+ dd->dashPattern.clear();
+ dd->dashOffset = 0;
}
/*!
@@ -538,8 +542,12 @@ void QPen::setDashOffset(qreal offset)
if (qFuzzyCompare(offset, static_cast<QPenData *>(d)->dashOffset))
return;
detach();
- static_cast<QPenData *>(d)->dashOffset = offset;
- d->style = Qt::CustomDashLine;
+ QPenData *dd = static_cast<QPenData *>(d);
+ dd->dashOffset = offset;
+ if (d->style != Qt::CustomDashLine) {
+ dd->dashPattern = dashPattern();
+ d->style = Qt::CustomDashLine;
+ }
}
/*!