summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbackingstore.h4
-rw-r--r--src/gui/painting/qbrush.h13
-rw-r--r--src/gui/painting/qcolor.h4
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h4
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_p.h38
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h4
-rw-r--r--src/gui/painting/qgrayraster.c10
-rw-r--r--src/gui/painting/qmatrix.h4
-rw-r--r--src/gui/painting/qoutlinemapper.cpp2
-rw-r--r--src/gui/painting/qpagedpaintdevice.h4
-rw-r--r--src/gui/painting/qpaintbuffer.cpp2
-rw-r--r--src/gui/painting/qpaintdevice.h4
-rw-r--r--src/gui/painting/qpaintengine.h4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp48
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h4
-rw-r--r--src/gui/painting/qpaintengineex.cpp12
-rw-r--r--src/gui/painting/qpaintengineex_p.h6
-rw-r--r--src/gui/painting/qpainter.cpp36
-rw-r--r--src/gui/painting/qpainter.h4
-rw-r--r--src/gui/painting/qpainterpath.h4
-rw-r--r--src/gui/painting/qpathclipper_p.h4
-rw-r--r--src/gui/painting/qpdfwriter.h4
-rw-r--r--src/gui/painting/qpen.h4
-rw-r--r--src/gui/painting/qplatformbackingstore.h4
-rw-r--r--src/gui/painting/qpolygon.h4
-rw-r--r--src/gui/painting/qregion.h4
-rw-r--r--src/gui/painting/qrgb.h7
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp7
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h4
-rw-r--r--src/gui/painting/qtransform.h8
-rw-r--r--src/gui/painting/qvectorpath_p.h4
32 files changed, 95 insertions, 172 deletions
diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h
index 2a3f91246b..65efab2f48 100644
--- a/src/gui/painting/qbackingstore.h
+++ b/src/gui/painting/qbackingstore.h
@@ -47,8 +47,6 @@
#include <QtGui/qwindow.h>
#include <QtGui/qregion.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -93,6 +91,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QBACKINGSTORE_H
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index 294e0b7931..4d8c97e255 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -52,17 +52,6 @@
#include <QtGui/qimage.h>
#include <QtGui/qpixmap.h>
-#if defined(Q_OS_VXWORKS)
-# if defined(m_data)
-# undef m_data
-# endif
-# if defined(m_type)
-# undef m_type
-# endif
-#endif
-
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -326,6 +315,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QBRUSH_H
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index cd65984f4e..5bd879ed63 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -46,8 +46,6 @@
#include <QtCore/qnamespace.h>
#include <QtCore/qstringlist.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -276,6 +274,4 @@ inline QColor QColor::darker(int f) const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOLOR_H
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index 136b014424..fb37b70ba5 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -47,8 +47,6 @@
#include <private/qpaintengine_raster_p.h>
#include <qpen.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -155,6 +153,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOSMETICLINE_H
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 0f77ae6d86..906ef128fa 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5368,7 +5368,7 @@ void qBlendTexture(int count, const QSpan *spans, void *userData)
proc(count, spans, userData);
}
-template <class DST>
+template <class DST> Q_STATIC_TEMPLATE_FUNCTION
inline void qt_bitmapblit_template(QRasterBuffer *rasterBuffer,
int x, int y, DST color,
const uchar *map,
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 258f130efc..f958538aa6 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -70,15 +70,19 @@ QT_BEGIN_NAMESPACE
#if defined(Q_CC_RVCT)
// RVCT doesn't like static template functions
# define Q_STATIC_TEMPLATE_FUNCTION
-# define Q_STATIC_INLINE_FUNCTION static __forceinline
+# define Q_ALWAYS_INLINE __forceinline
# define Q_DECL_RESTRICT
#elif defined(Q_CC_GNU)
-# define Q_STATIC_TEMPLATE_FUNCTION static __attribute__((always_inline))
-# define Q_STATIC_INLINE_FUNCTION static inline __attribute__((always_inline))
+# define Q_STATIC_TEMPLATE_FUNCTION static
+# define Q_ALWAYS_INLINE inline __attribute__((always_inline))
# define Q_DECL_RESTRICT __restrict__
+#elif defined(Q_CC_MSVC)
+# define Q_STATIC_TEMPLATE_FUNCTION static
+# define Q_ALWAYS_INLINE __forceinline
+# define Q_DECL_RESTRICT __restrict
#else
# define Q_STATIC_TEMPLATE_FUNCTION static
-# define Q_STATIC_INLINE_FUNCTION static inline
+# define Q_ALWAYS_INLINE inline
# define Q_DECL_RESTRICT
#endif
@@ -382,7 +386,7 @@ static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c)
return (b * b) - (4 * a * c);
}
-template <class RadialFetchFunc>
+template <class RadialFetchFunc> Q_STATIC_TEMPLATE_FUNCTION
const uint * QT_FASTCALL qt_fetch_radial_gradient_template(uint *buffer, const Operator *op, const QSpanData *data,
int y, int x, int length)
{
@@ -562,7 +566,7 @@ public:
# pragma push
# pragma arm
#endif
-Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
+static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
t &= 0xff00ff;
@@ -579,7 +583,7 @@ Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint
#if QT_POINTER_SIZE == 8 // 64-bit versions
-Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
+static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
t >>= 8;
@@ -587,14 +591,14 @@ Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint
return (uint(t)) | (uint(t >> 24));
}
-Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
+static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
t &= 0x00ff00ff00ff00ff;
return (uint(t)) | (uint(t >> 24));
}
-Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
+static Q_ALWAYS_INLINE uint PREMUL(uint x) {
uint a = x >> 24;
quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
@@ -604,7 +608,7 @@ Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
#else // 32-bit versions
-Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
+static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t >>= 8;
t &= 0xff00ff;
@@ -619,7 +623,7 @@ Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint
# pragma push
# pragma arm
#endif
-Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
+static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
uint t = (x & 0xff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
t &= 0xff00ff;
@@ -634,7 +638,7 @@ Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
# pragma pop
#endif
-Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
+static Q_ALWAYS_INLINE uint PREMUL(uint x) {
uint a = x >> 24;
uint t = (x & 0xff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
@@ -649,14 +653,14 @@ Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
#endif
-Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) {
+static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16(uint x, uint a) {
a += 1;
uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0;
t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f;
return t;
}
-Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) {
+static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) {
uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0;
t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f;
return t;
@@ -687,7 +691,7 @@ inline quint24::operator uint() const
return data[2] | (data[1] << 8) | (data[0] << 16);
}
-template <class T>
+template <class T> Q_STATIC_TEMPLATE_FUNCTION
void qt_memfill(T *dest, T value, int count);
template<> inline void qt_memfill(quint32 *dest, quint32 color, int count)
@@ -728,7 +732,7 @@ inline void qt_memfill(T *dest, T value, int count)
}
}
-template <class T>
+template <class T> Q_STATIC_TEMPLATE_FUNCTION
inline void qt_rectfill(T *dest, T value,
int x, int y, int width, int height, int stride)
{
@@ -794,7 +798,7 @@ do { \
# pragma push
# pragma arm
#endif
-Q_STATIC_INLINE_FUNCTION int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
+static Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
#if defined(Q_CC_RVCT)
# pragma pop
#endif
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index f706ef3705..72093a3612 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -55,8 +55,6 @@
#include <private/qpaintengineex_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -107,6 +105,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 8be462517c..7dfb743ae2 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -1736,9 +1736,9 @@
if ( raster->worker )
raster->worker->skip_spans = params->skip_spans;
- // If raster object and raster buffer are allocated, but
- // raster size isn't of the minimum size, indicate out of
- // memory.
+ /* If raster object and raster buffer are allocated, but */
+ /* raster size isn't of the minimum size, indicate out of */
+ /* memory. */
if (raster->buffer_allocated_size < MINIMUM_POOL_SIZE )
return ErrRaster_OutOfMemory;
@@ -1866,8 +1866,8 @@
( sizeof ( TCell ) * 8 ) );
}
else if ( pool_base)
- { // Case when there is a raster pool allocated, but it
- // doesn't have the minimum size (and so memory will be reallocated)
+ { /* Case when there is a raster pool allocated, but it */
+ /* doesn't have the minimum size (and so memory will be reallocated) */
rast->buffer = pool_base;
rast->worker = NULL;
rast->buffer_size = pool_size;
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 672bbdcfd1..d2c1ae3a3c 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -49,8 +49,6 @@
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -185,6 +183,4 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &);
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMATRIX_H
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 2f2fe44209..8b47dae5ff 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -48,8 +48,6 @@
QT_BEGIN_NAMESPACE
-static const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
-
#define qreal_to_fixed_26_6(f) (int(f * 64))
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index 02ed2583ee..aa8506492f 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -44,8 +44,6 @@
#include <QtGui/qpaintdevice.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -87,6 +85,4 @@ protected:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp
index 1a5a19a366..43bf1fd4ee 100644
--- a/src/gui/painting/qpaintbuffer.cpp
+++ b/src/gui/painting/qpaintbuffer.cpp
@@ -1752,7 +1752,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
QRawFont rawFont;
QRawFontPrivate *rawFontD = QRawFontPrivate::get(rawFont);
QFontPrivate *fontD = QFontPrivate::get(font);
- rawFontD->fontEngine = fontD->engineForScript(QUnicodeTables::Common);
+ rawFontD->fontEngine = fontD->engineForScript(QChar::Script_Common);
rawFontD->fontEngine->ref.ref();
QGlyphRun glyphs;
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 1a638ffeba..1529b701cf 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -45,8 +45,6 @@
#include <QtGui/qwindowdefs.h>
#include <QtCore/qrect.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -120,6 +118,4 @@ inline bool QPaintDevice::paintingActive() const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPAINTDEVICE_H
diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h
index 85f4d2159e..b3e3762cc8 100644
--- a/src/gui/painting/qpaintengine.h
+++ b/src/gui/painting/qpaintengine.h
@@ -47,8 +47,6 @@
#include <QtCore/qscopedpointer.h>
#include <QtGui/qpainter.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -348,6 +346,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QPaintEngine::DirtyFlags)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPAINTENGINE_H
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index aaa0a4b87e..801a5689c1 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2858,7 +2858,19 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
// x, y,
// positions[i].x.toInt(), positions[i].y.toInt());
- alphaPenBlt(bits + ((c.x << leftShift) >> rightShift) + c.y * bpl, bpl, depth, x, y, c.w, c.h);
+ const uchar *glyphBits = bits + ((c.x << leftShift) >> rightShift) + c.y * bpl;
+
+ if (glyphType == QFontEngineGlyphCache::Raster_ARGB) {
+ // The current state transform has already been applied to the positions,
+ // so we prevent drawImage() from re-applying the transform by clearing
+ // the state for the duration of the call.
+ QTransform originalTransform = s->matrix;
+ s->matrix = QTransform();
+ drawImage(QPoint(x, y), QImage(glyphBits, c.w, c.h, bpl, image.format()));
+ s->matrix = originalTransform;
+ } else {
+ alphaPenBlt(glyphBits, bpl, depth, x, y, c.w, c.h);
+ }
}
}
return true;
@@ -3011,13 +3023,15 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
ensurePen();
ensureRasterState();
+ QTransform matrix = state()->matrix;
+
QFontEngine *fontEngine = textItem->fontEngine();
- if (!supportsTransformations(fontEngine)) {
+ if (shouldDrawCachedGlyphs(fontEngine, matrix)) {
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
fontEngine);
- } else if (state()->matrix.type() < QTransform::TxProject) {
+ } else if (matrix.type() < QTransform::TxProject) {
bool invertible;
- QTransform invMat = state()->matrix.inverted(&invertible);
+ QTransform invMat = matrix.inverted(&invertible);
if (!invertible)
return;
@@ -3056,7 +3070,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
QRasterPaintEngineState *s = state();
QTransform matrix = s->matrix;
- if (!supportsTransformations(ti.fontEngine)) {
+ if (shouldDrawCachedGlyphs(ti.fontEngine, matrix)) {
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
@@ -3300,21 +3314,25 @@ void QRasterPaintEngine::releaseDC(HDC) const
/*!
\internal
*/
-bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine) const
+bool QRasterPaintEngine::requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const
{
- const QTransform &m = state()->matrix;
- return supportsTransformations(fontEngine, m);
+ // Cached glyphs always require pretransformed positions
+ if (shouldDrawCachedGlyphs(fontEngine, m))
+ return true;
+
+ // Otherwise let the base-class decide based on the transform
+ return QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m);
}
-/*!
- \internal
-*/
-bool QRasterPaintEngine::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const
+bool QRasterPaintEngine::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
{
- if (fontEngine->supportsTransformations(m))
- return true;
+ // The font engine might not support filling the glyph cache
+ // with the given transform applied, in which case we need to
+ // fall back to the QPainterPath code-path.
+ if (!fontEngine->supportsTransformation(m))
+ return false;
- return !shouldDrawCachedGlyphs(fontEngine, m);
+ return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, m);
}
/*!
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index e90cad6d8a..e5bb0406ae 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -231,8 +231,8 @@ public:
QPoint coordinateOffset() const;
- bool supportsTransformations(QFontEngine *fontEngine) const;
- bool supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const;
+ bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const;
+ bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const;
protected:
QRasterPaintEngine(QRasterPaintEnginePrivate &d, QPaintDevice *);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 83b684da1e..6e72b5db7f 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -1081,18 +1081,16 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
}
}
-bool QPaintEngineEx::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const
+bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &t) const
{
- Q_UNUSED(fontEngine);
-
- if (!m.isAffine())
- return true;
-
- return false;
+ return t.type() >= QTransform::TxProject;
}
bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
{
+ if (fontEngine->glyphFormat == QFontEngineGlyphCache::Raster_ARGB)
+ return true;
+
qreal pixelSize = fontEngine->fontDef.pixelSize;
return (pixelSize * pixelSize * qAbs(m.determinant())) <
QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE;
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 399a6f63b0..5a9df72c76 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -61,8 +61,6 @@
#include <private/qvectorpath_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -164,7 +162,7 @@ public:
IsEmulationEngine = 0x02 // If set, this object is a QEmulationEngine.
};
virtual uint flags() const {return 0;}
- virtual bool supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const;
+ virtual bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const;
virtual bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const;
protected:
@@ -192,6 +190,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 0811b5282f..b59a0850e8 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1155,9 +1155,6 @@ void QPainterPrivate::updateState(QPainterState *newState)
should antialias text if possible, and the \l
{RenderHint}{QPainter::SmoothPixmapTransform} indicates that the
engine should use a smooth pixmap transformation algorithm.
- \l {RenderHint}{HighQualityAntialiasing} is an OpenGL-specific rendering hint
- indicating that the engine should use fragment programs and offscreen
- rendering for antialiasing.
The renderHints() function returns a flag that specifies the
rendering hints that are set for this painter. Use the
@@ -1409,9 +1406,8 @@ void QPainterPrivate::updateState(QPainterState *newState)
a smooth pixmap transformation algorithm (such as bilinear) rather
than nearest neighbor.
- \value HighQualityAntialiasing An OpenGL-specific rendering hint
- indicating that the engine should use fragment programs and offscreen
- rendering for antialiasing.
+ \value HighQualityAntialiasing This value is obsolete and will be ignored,
+ use the Antialiasing render hint instead.
\value NonCosmeticDefaultPen This value is obsolete, the default for QPen
is now non-cosmetic.
@@ -5552,13 +5548,13 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun)
QVarLengthArray<QFixedPoint, 128> fixedPointPositions(count);
QRawFontPrivate *fontD = QRawFontPrivate::get(font);
- bool supportsTransformations = d->extended
- ? d->extended->supportsTransformations(fontD->fontEngine, d->state->matrix)
- : d->engine->type() == QPaintEngine::CoreGraphics || d->state->matrix.isAffine();
+ bool engineRequiresPretransformedGlyphPositions = d->extended
+ ? d->extended->requiresPretransformedGlyphPositions(fontD->fontEngine, d->state->matrix)
+ : d->engine->type() != QPaintEngine::CoreGraphics && !d->state->matrix.isAffine();
for (int i=0; i<count; ++i) {
QPointF processedPosition = position + glyphPositions[i];
- if (!supportsTransformations)
+ if (engineRequiresPretransformedGlyphPositions)
processedPosition = d->state->transform().map(processedPosition);
fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition);
}
@@ -5738,17 +5734,21 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
return;
}
- QFontEngine *fe = staticText_d->font.d->engineForScript(QUnicodeTables::Common);
+ QFontEngine *fe = staticText_d->font.d->engineForScript(QChar::Script_Common);
if (fe->type() == QFontEngine::Multi)
fe = static_cast<QFontEngineMulti *>(fe)->engine(0);
- bool supportsTransformations = d->extended->supportsTransformations(fe,
- d->state->matrix);
- if (supportsTransformations && !staticText_d->untransformedCoordinates) {
- staticText_d->untransformedCoordinates = true;
- staticText_d->needsRelayout = true;
- } else if (!supportsTransformations && staticText_d->untransformedCoordinates) {
+
+ bool engineRequiresPretransform = d->extended->requiresPretransformedGlyphPositions(fe, d->state->matrix);
+ if (staticText_d->untransformedCoordinates && engineRequiresPretransform) {
+ // The coordinates are untransformed, and the engine can't deal with that
+ // nativly, so we have to pre-transform the static text.
staticText_d->untransformedCoordinates = false;
staticText_d->needsRelayout = true;
+ } else if (!staticText_d->untransformedCoordinates && !engineRequiresPretransform) {
+ // The coordinates are already transformed, but the engine can handle that
+ // nativly, so undo the transform of the static text.
+ staticText_d->untransformedCoordinates = true;
+ staticText_d->needsRelayout = true;
}
// Don't recalculate entire layout because of translation, rather add the dx and dy
@@ -5845,7 +5845,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
int len = str.length();
int numGlyphs = len;
QVarLengthGlyphLayoutArray glyphs(len);
- QFontEngine *fontEngine = d->state->font.d->engineForScript(QUnicodeTables::Common);
+ QFontEngine *fontEngine = d->state->font.d->engineForScript(QChar::Script_Common);
if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)) {
glyphs.resize(numGlyphs);
if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0))
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index 9f390b9865..874b244bd6 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -60,8 +60,6 @@
#include <QtGui/qfontmetrics.h>
#endif
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -932,6 +930,4 @@ inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPAINTER_H
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 7c3365875e..e22c1729f3 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -49,8 +49,6 @@
#include <QtCore/qvector.h>
#include <QtCore/qscopedpointer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -375,6 +373,4 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QPainterPath &);
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPAINTERPATH_H
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index 4ab2b9d88a..45cce640c5 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -60,8 +60,6 @@
#include <private/qdatabuffer_p.h>
#include <stdio.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -488,6 +486,4 @@ inline QPathEdge::Direction QWingedEdge::flip(QPathEdge::Direction direction)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPATHCLIPPER_P_H
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index 792aeefad1..45bb5ad4b4 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -45,8 +45,6 @@
#include <QtCore/qobject.h>
#include <QtGui/qpagedpaintdevice.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -85,6 +83,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h
index 3e5e258123..c5144f784f 100644
--- a/src/gui/painting/qpen.h
+++ b/src/gui/painting/qpen.h
@@ -45,8 +45,6 @@
#include <QtGui/qcolor.h>
#include <QtGui/qbrush.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -139,6 +137,4 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QPen &);
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPEN_H
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index 0429ec7e89..1b19b2c379 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -56,8 +56,6 @@
#include <QtGui/qwindow.h>
#include <QtGui/qregion.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -95,6 +93,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPLATFORMBACKINGSTORE_H
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index 32de4ddd65..1039e842ab 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -46,8 +46,6 @@
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -185,6 +183,4 @@ inline QPolygonF QPolygonF::translated(qreal dx, qreal dy) const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPOLYGON_H
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index dee996c523..0e436e3fb4 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -50,8 +50,6 @@
#include <QtCore/qdatastream.h>
#endif
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -173,6 +171,4 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QRegion &);
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QREGION_H
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index 06c479e5cd..d7a01840e8 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -44,14 +44,13 @@
#include <QtCore/qglobal.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
typedef unsigned int QRgb; // RGB triplet
-const QRgb RGB_MASK = 0x00ffffff; // masks RGB values
+// non-namespaced Qt global variable
+const Q_DECL_UNUSED QRgb RGB_MASK = 0x00ffffff; // masks RGB values
inline int qRed(QRgb rgb) // get red part of RGB
{ return ((rgb >> 16) & 0xff); }
@@ -82,6 +81,4 @@ inline bool qIsGray(QRgb rgb)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QRGB_H
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 2ffdc9cd59..8769aeaba9 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -129,6 +129,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
switch (m_type) {
case Raster_A8: format = QFontEngine::Format_A8; break;
case Raster_RGBMask: format = QFontEngine::Format_A32; break;
+ case Raster_ARGB: format = QFontEngine::Format_ARGB; break;
default: format = QFontEngine::Format_Mono; break;
}
@@ -275,6 +276,8 @@ QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition
{
if (m_type == QFontEngineGlyphCache::Raster_RGBMask)
return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, m_transform);
+ else if (m_type == QFontEngineGlyphCache::Raster_ARGB)
+ return m_current_fontengine->bitmapForGlyph(g, subPixelPosition, m_transform);
return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform);
}
@@ -306,6 +309,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
m_image = QImage(width, height, QImage::Format_RGB32);
break;
case QFontEngineGlyphCache::Raster_ARGB:
+ m_image = QImage(width, height, QImage::Format_ARGB32_Premultiplied);
break;
}
}
@@ -322,7 +326,8 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
}
#endif
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask) {
+ if (m_type == QFontEngineGlyphCache::Raster_RGBMask
+ || m_type == QFontEngineGlyphCache::Raster_ARGB) {
QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()),
qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(),
m_image.format());
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index d0fe7ab8cb..d93f57ad80 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -60,10 +60,6 @@
#include <private/qfontengineglyphcache_p.h>
-#if defined(Q_OS_VXWORKS) && defined(m_type)
-# undef m_type
-#endif
-
#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH
#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256
#endif
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index f98642cd98..060362f63e 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -50,12 +50,6 @@
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
-#if defined(Q_OS_VXWORKS) && defined(m_type)
-# undef m_type
-#endif
-
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -389,6 +383,4 @@ inline QTransform operator -(const QTransform &a, qreal n)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTRANSFORM_H
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index f8ba02dc79..e97d6e1dce 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -60,8 +60,6 @@
#include <private/qpainter_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -187,6 +185,4 @@ Q_GUI_EXPORT const QVectorPath &qtVectorPathForPath(const QPainterPath &path);
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif