From 9b0fab6b62df98519ebfab117f14b9d3465d8c68 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 21 Dec 2012 18:35:58 +0200 Subject: Update Qt internals to use QChar::Script ...and remove the outdated QUnicodeTables::Script enum. QFontEngineData now has one extra slot that never used (engines[QChar::Script_Inherited]). engines[QChar::Script_Unknown], if accessed, would be set with a Box engine instance, and could be used as a minor optimization some time later. In order to preserve the existing behavior, we map all scripts up to Latin to Common. Change-Id: Ide4182a0f8447b4bf25713ecc3fe8097b8fed040 Reviewed-by: Pierre Rossi Reviewed-by: Konstantin Ritt --- src/gui/painting/qpaintbuffer.cpp | 2 +- src/gui/painting/qpainter.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index d7b16114b8..382f6489a7 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/qpainter.cpp b/src/gui/painting/qpainter.cpp index 8ec9c1648f..9d5d4ebc95 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5738,7 +5738,7 @@ 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(fe)->engine(0); bool supportsTransformations = d->extended->supportsTransformations(fe, @@ -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)) -- cgit v1.2.3 From 0f014fcde824d191eef003cd52ea70485499d845 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Dec 2011 20:17:19 -0200 Subject: Mark several template functions as static. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no reason those function shouldn't be static. This produces no change in code, except that the functions may be better optimised. Change-Id: Ia60b81d4e29a36190a453e8c7c8102c8f547e1a9 Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 2 +- src/gui/painting/qdrawhelper_p.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 0f8fde1d9c..a5486ecae9 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 +template 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 439882a3cf..0b984b39bd 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -382,7 +382,7 @@ static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c) return (b * b) - (4 * a * c); } -template +template 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) { @@ -687,7 +687,7 @@ inline quint24::operator uint() const return data[2] | (data[1] << 8) | (data[0] << 16); } -template +template 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 +728,7 @@ inline void qt_memfill(T *dest, T value, int count) } } -template +template Q_STATIC_TEMPLATE_FUNCTION inline void qt_rectfill(T *dest, T value, int x, int y, int width, int height, int stride) { -- cgit v1.2.3 From 8927084d0acfea2bb3fc8a932069c1d5ceb001d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 10 Jan 2013 15:09:32 +0100 Subject: Refactor paint/font-engine shouldDrawCachedGlyphs and supportsTransformations Some cruft had built up over time, and this is an attempt at cleaning up the naming and use of these functions, and should not have any behavioral effects. The function supportsTransformations() has been renamed in QPaintEngineEx to reflect its use, which is to decide if QPainter needs to pre-transform the coordinates of the static text before asking the paint-engine to draw it. The new name is requiresPretransformedGlyphPositions(). The OpenGL and CoreGraphics (Mac) paint engines keep their behavior of not needing pre-transformed text, while the raster engine needs this when using cached glyphs. The base-class implementation assumes that all transforms that include a projection will need pre-transform, which is also the case for the raster engine. All decisions in the paint engines about whether or not to use the glyph cache when drawing text are now deferred to the function shouldDrawCachedGlyphs(), which has been refactored for the GL paint engine(s) to share more logic. All implementations call the base class implementation, which ensures that large font sizes will not be cached. The raster engine will in addition ask the font engine whether or not it can produce glyphs for the glyph-cache with the given transform. This is the only remaining instance of the supportsTransformations() function, and will for all font engines except the CoreText engine support affine transformations. The CoreText engine on the other hand only supports translations (for now). Change-Id: I8fb5e43e3de3ef62a526a79a6dfeda7f9546771d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qpaintengine_raster.cpp | 34 +++++++++++++++++++------------- src/gui/painting/qpaintengine_raster_p.h | 4 ++-- src/gui/painting/qpaintengineex.cpp | 9 ++------- src/gui/painting/qpaintengineex_p.h | 2 +- src/gui/painting/qpainter.cpp | 24 ++++++++++++---------- 5 files changed, 39 insertions(+), 34 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 0e9129f8c0..53fdd42b8a 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3010,13 +3010,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; @@ -3055,7 +3057,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 positions; QVarLengthArray glyphs; @@ -3299,21 +3301,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 8fb72edabd..440ddd9ef9 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 2c41ab9ff2..872197ab75 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1081,14 +1081,9 @@ 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 diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index de43b7782c..257bc7a65a 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -164,7 +164,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: diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 9d5d4ebc95..1a97839ef8 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5552,13 +5552,13 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) QVarLengthArray 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; istate->transform().map(processedPosition); fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition); } @@ -5741,14 +5741,18 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText QFontEngine *fe = staticText_d->font.d->engineForScript(QChar::Script_Common); if (fe->type() == QFontEngine::Multi) fe = static_cast(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 -- cgit v1.2.3 From 2aaffe1800db0d8a170b278ac9a43f2e00ef0e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Wed, 9 Jan 2013 14:49:09 +0200 Subject: Fix comments to use pre C99 standard style instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VxWorks compiler fails to compile *.c file with C99 style comments on it Change-Id: Ib5c5ff14006c17f9392b77363232b8b7cc112d34 Reviewed-by: Samuel Rødal --- src/gui/painting/qgrayraster.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 291d1899ad..dc84a3d3bf 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; -- cgit v1.2.3 From 07e3bcdc106ac42703ae0fb88b6cac2d2bfdd072 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 26 Jan 2013 21:42:12 +0100 Subject: Remove QT_{BEGIN,END}_HEADER macro usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp Reviewed-by: Jędrzej Nowacki Reviewed-by: hjk --- src/gui/painting/qbackingstore.h | 4 ---- src/gui/painting/qbrush.h | 4 ---- src/gui/painting/qcolor.h | 4 ---- src/gui/painting/qcosmeticstroker_p.h | 4 ---- src/gui/painting/qemulationpaintengine_p.h | 4 ---- src/gui/painting/qmatrix.h | 4 ---- src/gui/painting/qpagedpaintdevice.h | 4 ---- src/gui/painting/qpaintdevice.h | 4 ---- src/gui/painting/qpaintengine.h | 4 ---- src/gui/painting/qpaintengineex_p.h | 4 ---- src/gui/painting/qpainter.h | 4 ---- src/gui/painting/qpainterpath.h | 4 ---- src/gui/painting/qpathclipper_p.h | 4 ---- src/gui/painting/qpdfwriter.h | 4 ---- src/gui/painting/qpen.h | 4 ---- src/gui/painting/qplatformbackingstore.h | 4 ---- src/gui/painting/qpolygon.h | 4 ---- src/gui/painting/qregion.h | 4 ---- src/gui/painting/qrgb.h | 4 ---- src/gui/painting/qtransform.h | 4 ---- src/gui/painting/qvectorpath_p.h | 4 ---- 21 files changed, 84 deletions(-) (limited to 'src/gui/painting') 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 #include -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..6a89db6a52 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -61,8 +61,6 @@ # endif #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -326,6 +324,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 #include -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 #include -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/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 -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -107,6 +105,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif 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 #include -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/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 -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -87,6 +85,4 @@ protected: QT_END_NAMESPACE -QT_END_HEADER - #endif 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 #include -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 #include -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/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 4b578d8f97..5a9df72c76 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -61,8 +61,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -192,6 +190,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif 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 #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 #include -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 #include -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 #include -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 #include -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 #include -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 #include -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 #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..834ebec5a9 100644 --- a/src/gui/painting/qrgb.h +++ b/src/gui/painting/qrgb.h @@ -44,8 +44,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -82,6 +80,4 @@ inline bool qIsGray(QRgb rgb) QT_END_NAMESPACE -QT_END_HEADER - #endif // QRGB_H diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index f98642cd98..22fc82bb58 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -54,8 +54,6 @@ # undef m_type #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -389,6 +387,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 -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 -- cgit v1.2.3 From 4c5b503f335706916a88b44e86c40de34006d887 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 28 Jan 2013 20:15:00 -0800 Subject: Remove unused variables and functions from the source code Change-Id: I5f37414ee4846b4fe774361f49367bc0d5874039 Reviewed-by: Frederik Gladhorn Reviewed-by: Olivier Goffart --- src/gui/painting/qoutlinemapper.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/gui/painting') 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)) -- cgit v1.2.3 From f9f0f4aea5f0b66d7dcf0f402e5ccf3053c3957c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Dec 2011 20:04:23 -0200 Subject: Rename the Q_STATIC_INLINE_FUNCTION macro to Q_ALWAYS_INLINE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That's what the macro did anyway, except it had an extra "static" keyword. This allows us now to use Q_ALWAYS_INLINE in non-static contexts, if we wanted to (e.g., certain template cases). Change-Id: I899d359f46234e93d1912ef9125080dc84e15c93 Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_p.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index eda2fc9242..7bd31d0ef5 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -70,15 +70,15 @@ 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__ #else # define Q_STATIC_TEMPLATE_FUNCTION static -# define Q_STATIC_INLINE_FUNCTION static inline +# define Q_ALWAYS_INLINE inline # define Q_DECL_RESTRICT #endif @@ -562,7 +562,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 +579,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 +587,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 +604,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 +619,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 +634,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 +649,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; @@ -794,7 +794,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 -- cgit v1.2.3 From 2d98bd48e5145b798dceb254ee57d3c975bcf6b9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Dec 2011 20:05:04 -0200 Subject: Add Q_DECL_RESTRICT and Q_ALWAYS_INLINE for MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I598463e5990e91a5a049d1f9f7a4aa80930c0904 Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_p.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 7bd31d0ef5..f958538aa6 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -76,6 +76,10 @@ QT_BEGIN_NAMESPACE # 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_ALWAYS_INLINE inline -- cgit v1.2.3 From 1f5b10281fc275761a8a213fdba2edf2ccc7f17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 12 Feb 2013 08:26:17 +0100 Subject: Document the QPainter::HighQualityAntialiasing render hint as obsolete. It was only used in the now removed OpenGL 1.x paint engine. Change-Id: I2237172de700bfd31ca25279fbed21d601785962 Reviewed-by: Gunnar Sletta --- src/gui/painting/qpainter.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d95d55acd0..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. -- cgit v1.2.3 From 8d2679673e6268f826abe6d4ef1734e9d69edab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Mon, 11 Feb 2013 16:40:10 +0200 Subject: Remove overlapping variable names defined in VxWorks headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VxWorks has defined variables with same name as in Qt's headers. Remove these undefines because that has already done in file src/corelib/kernel/qfunctions_vxworks.h. See related change f7bd8652caab2f53ced739ce90c640924d4962dc. Change-Id: I994ac9d00ca223b9fa955dfcba8ad6c8dcbd0549 Reviewed-by: Samuel Rødal --- src/gui/painting/qbrush.h | 9 --------- src/gui/painting/qtextureglyphcache_p.h | 4 ---- src/gui/painting/qtransform.h | 4 ---- 3 files changed, 17 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 6a89db6a52..4d8c97e255 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -52,15 +52,6 @@ #include #include -#if defined(Q_OS_VXWORKS) -# if defined(m_data) -# undef m_data -# endif -# if defined(m_type) -# undef m_type -# endif -#endif - QT_BEGIN_NAMESPACE 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 -#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 22fc82bb58..060362f63e 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -50,10 +50,6 @@ #include #include -#if defined(Q_OS_VXWORKS) && defined(m_type) -# undef m_type -#endif - QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 9253509f3eebdcfc9669dd15caf9c7ec01f15dc7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 28 Jan 2013 20:17:16 -0800 Subject: Mark public non-member non-static variables as Q_DECL_UNUSED This avoids warnings in compilers that check for unused variables. They can't tell that the the variable came from a header. Change-Id: I1ea5e5bbc76d676fbb561bdc8ae6543e758de90e Reviewed-by: Andreas Aardal Hanssen Reviewed-by: Gunnar Sletta Reviewed-by: Lars Knoll --- src/gui/painting/qrgb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h index 834ebec5a9..d7a01840e8 100644 --- a/src/gui/painting/qrgb.h +++ b/src/gui/painting/qrgb.h @@ -49,7 +49,8 @@ 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); } -- cgit v1.2.3 From d1ee7189553e13337b198fe4ba66d79fb7a7f41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Feb 2013 18:16:49 +0100 Subject: Add support for color glyphs (Emoji) on Mac OS X and iOS A new glyph type is added to the glyph caches for ARGB bitmap glyphs, and the raster and OpenGL paint engines have been modified to support this glyph type for drawCachedGlyphs(). The CoreText font engine implements support for these glyphs through the CTFontDrawGlyphs API, since CGContextShowGlyphsWithAdvances does not handle color glyphs. Change-Id: Idad9ce75a911cae130d65aebe59142772a16fc12 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qpaintengine_raster.cpp | 14 +++++++++++++- src/gui/painting/qpaintengineex.cpp | 3 +++ src/gui/painting/qtextureglyphcache.cpp | 7 ++++++- 3 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index b9202e1612..fd867ebde6 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2857,7 +2857,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; diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 5ca6075423..6e72b5db7f 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1088,6 +1088,9 @@ bool QPaintEngineEx::requiresPretransformedGlyphPositions(QFontEngine *, const Q 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/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()); -- cgit v1.2.3 From d88ec35b1186348085c8db9b8e075021ab8dfd68 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 4 Feb 2013 21:08:10 +0200 Subject: Fix compile on Android This is a workaround for a broken compiler Change-Id: I10c8c750caf56036419807ec4a2439bf14cf64d6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qdrawhelper_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index f958538aa6..5d9867012f 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -386,13 +386,14 @@ static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c) return (b * b) - (4 * a * c); } +extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count); + template 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) { // avoid division by zero if (qFuzzyIsNull(op->radial.a)) { - extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count); qt_memfill32(buffer, 0, length); return buffer; } @@ -696,7 +697,6 @@ void qt_memfill(T *dest, T value, int count); template<> inline void qt_memfill(quint32 *dest, quint32 color, int count) { - extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count); qt_memfill32(dest, color, count); } -- cgit v1.2.3 From 09fb084e3a16ea3cbca896e270ff7d9bd6b6c313 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 1 Mar 2013 15:15:03 +0100 Subject: Output window in warning about flush() for unexposed window. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1dd975926c2bea7bcc10a702739836b16b656213 Reviewed-by: Samuel Rødal --- src/gui/painting/qbackingstore.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 1bf0b33047..fb47e62d11 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -97,8 +98,10 @@ void QBackingStore::flush(const QRegion ®ion, QWindow *win, const QPoint &off if (!win) win = window(); - if (win && !qt_window_private(win)->receivedExpose) - qWarning("QBackingStore::flush() called with non-exposed window, behavior is undefined"); + if (win && !qt_window_private(win)->receivedExpose) { + qWarning().nospace() << "QBackingStore::flush() called with non-exposed window " + << win << ", behavior is undefined"; + } d_ptr->platformBackingStore->flush(win, region, offset); } -- cgit v1.2.3 From f69c9059d6c0bfb911bf0bdcec1e7470c38fa7e2 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sat, 9 Mar 2013 19:28:20 +0200 Subject: Replace HB types used in API with Qt analogs hb_uint32 <-> quint32 HB_Glyph <-> glyph_t HB_Fixed <-> QFixed, HB_FixedPoint <-> QFixedPoint HB_GlyphAttributes <-> QGlyphAttributes Change-Id: I4338ec4ce9a9c20ea591606ab10e6ef4f19931b8 Reviewed-by: Lars Knoll --- src/gui/painting/qpaintbuffer.cpp | 4 ++-- src/gui/painting/qpainter.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index 43bf1fd4ee..be446c86eb 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -74,11 +74,11 @@ QTextItemIntCopy::QTextItemIntCopy(const QTextItem &item) char *glyphLayoutData = new char[size]; QGlyphLayout glyphs(glyphLayoutData, m_item.glyphs.numGlyphs); memcpy(glyphs.offsets, m_item.glyphs.offsets, m_item.glyphs.numGlyphs * sizeof(QFixedPoint)); - memcpy(glyphs.glyphs, m_item.glyphs.glyphs, m_item.glyphs.numGlyphs * sizeof(HB_Glyph)); + memcpy(glyphs.glyphs, m_item.glyphs.glyphs, m_item.glyphs.numGlyphs * sizeof(glyph_t)); memcpy(glyphs.advances_x, m_item.glyphs.advances_x, m_item.glyphs.numGlyphs * sizeof(QFixed)); memcpy(glyphs.advances_y, m_item.glyphs.advances_y, m_item.glyphs.numGlyphs * sizeof(QFixed)); memcpy(glyphs.justifications, m_item.glyphs.justifications, m_item.glyphs.numGlyphs * sizeof(QGlyphJustification)); - memcpy(glyphs.attributes, m_item.glyphs.attributes, m_item.glyphs.numGlyphs * sizeof(HB_GlyphAttributes)); + memcpy(glyphs.attributes, m_item.glyphs.attributes, m_item.glyphs.numGlyphs * sizeof(QGlyphAttributes)); m_item.glyphs = glyphs; m_font = *m_item.f; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index c483e93a5f..be77fffc7c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5612,13 +5612,13 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio QVarLengthArray advances(glyphCount); QVarLengthArray glyphJustifications(glyphCount); - QVarLengthArray glyphAttributes(glyphCount); - memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes)); + QVarLengthArray glyphAttributes(glyphCount); + memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(QGlyphAttributes)); memset(advances.data(), 0, advances.size() * sizeof(QFixed)); memset(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification)); textItem.glyphs.numGlyphs = glyphCount; - textItem.glyphs.glyphs = reinterpret_cast(const_cast(glyphArray)); + textItem.glyphs.glyphs = const_cast(glyphArray); textItem.glyphs.offsets = positions; textItem.glyphs.advances_x = advances.data(); textItem.glyphs.advances_y = advances.data(); @@ -5841,7 +5841,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif return; if (tf & Qt::TextBypassShaping) { - // Skip harfbuzz complex shaping, shape using glyph advances only + // Skip complex shaping, shape using glyph advances only int len = str.length(); int numGlyphs = len; QVarLengthGlyphLayoutArray glyphs(len); -- cgit v1.2.3 From b11317a64339f5a4bcffc8234ecaf15c7fb416f2 Mon Sep 17 00:00:00 2001 From: Axel Waggershauser Date: Fri, 15 Mar 2013 00:42:15 +0100 Subject: Whitespace cleanup: remove trailing whitespace Remove all trailing whitespace from the following list of files: *.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README excluding 3rdparty, test-data and auto generated code. Note A): the only non 3rdparty c++-files that still have trailing whitespace after this change are: * src/corelib/codecs/cp949codetbl_p.h * src/corelib/codecs/qjpunicode.cpp * src/corelib/codecs/qbig5codec.cpp * src/corelib/xml/qxmlstream_p.h * src/tools/qdoc/qmlparser/qqmljsgrammar.cpp * src/tools/uic/ui4.cpp * tests/auto/other/qtokenautomaton/tokenizers/* * tests/benchmarks/corelib/tools/qstring/data.cpp * util/lexgen/tokenizer.cpp Note B): in about 30 files some overlapping 'leading tab' and 'TAB character in non-leading whitespace' issues have been fixed to make the sanity bot happy. Plus some general ws-fixes here and there as asked for during review. Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d Reviewed-by: Oswald Buddenhagen --- src/gui/painting/qcolor.cpp | 2 +- src/gui/painting/qcolor.h | 4 ++-- src/gui/painting/qcssutil_p.h | 2 +- src/gui/painting/qemulationpaintengine_p.h | 6 +++--- src/gui/painting/qpaintbuffer.cpp | 6 +++--- src/gui/painting/qtextureglyphcache.cpp | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 7eec60ed12..12ca84d8d1 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -1572,7 +1572,7 @@ QColor QColor::toRgb() const // achromatic case color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsl.lightness; } else if (ct.ahsl.lightness == 0) { - // lightness 0 + // lightness 0 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0; } else { // chromatic case diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index 5bd879ed63..ef3503e8d8 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -266,10 +266,10 @@ inline QColor::QColor(const QColor &acolor) inline bool QColor::isValid() const { return cspec != Invalid; } -inline QColor QColor::lighter(int f) const +inline QColor QColor::lighter(int f) const { return light(f); } -inline QColor QColor::darker(int f) const +inline QColor QColor::darker(int f) const { return dark(f); } QT_END_NAMESPACE diff --git a/src/gui/painting/qcssutil_p.h b/src/gui/painting/qcssutil_p.h index 38e45ae7c9..7888b9edf1 100644 --- a/src/gui/painting/qcssutil_p.h +++ b/src/gui/painting/qcssutil_p.h @@ -78,7 +78,7 @@ extern void Q_GUI_EXPORT qNormalizeRadii(const QRect &br, const QSize *radii, QSize *tlr, QSize *trr, QSize *blr, QSize *brr); QT_END_NAMESPACE - + #endif //QT_NO_CSSPARSER #endif // QCSSUTIL_P_H diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h index 72093a3612..db2d51e53a 100644 --- a/src/gui/painting/qemulationpaintengine_p.h +++ b/src/gui/painting/qemulationpaintengine_p.h @@ -62,10 +62,10 @@ class QEmulationPaintEngine : public QPaintEngineEx { public: QEmulationPaintEngine(QPaintEngineEx *engine); - + virtual bool begin(QPaintDevice *pdev); virtual bool end(); - + virtual Type type() const; virtual QPainterState *createState(QPainterState *orig) const; @@ -78,7 +78,7 @@ public: virtual void drawStaticTextItem(QStaticTextItem *item); virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags); - + virtual void clipEnabledChanged(); virtual void penChanged(); virtual void brushChanged(); diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index be446c86eb..bb0c441b40 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -1731,12 +1731,12 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd) #endif painter->setClipRegion(region, Qt::ClipOperation(cmd.extra)); break; } - + #if !defined(QT_NO_RAWFONT) case QPaintBufferPrivate::Cmd_DrawStaticText: { - + QVariantList variants(d->variants.at(cmd.offset).value()); - + QFont font = variants.at(0).value(); QVector glyphIndexes; diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 8769aeaba9..81c9c676ba 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -158,7 +158,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const metrics.yoff.toReal(), metrics.x.toReal(), metrics.y.toReal()); -#endif +#endif GlyphAndSubPixelPosition key(glyph, subPixelPosition); int glyph_width = metrics.width.ceil().toInt(); int glyph_height = metrics.height.ceil().toInt(); -- cgit v1.2.3