Make QPoint have the same layout on all platforms
[profile/ivi/qtbase.git] / src / gui / painting / qpaintengineex.cpp
index 7f601eb..9427dd5 100644 (file)
@@ -7,29 +7,29 @@
 ** This file is part of the QtGui module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
 ** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** 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
+** rights. These rights are described in the Nokia Qt LGPL Exception
 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 **
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** 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.
 **
 **
 **
@@ -44,6 +44,8 @@
 #include "qstroker_p.h"
 #include "qbezier_p.h"
 #include <private/qpainterpath_p.h>
+#include <private/qfontengine_p.h>
+#include <private/qstatictext_p.h>
 
 #include <qvarlengtharray.h>
 #include <qdebug.h>
@@ -787,15 +789,8 @@ void QPaintEngineEx::drawLines(const QLine *lines, int lineCount)
 
         qreal pts[64];
         int count2 = count<<1;
-#ifdef Q_WS_MAC
-        for (int i=0; i<count2; i+=2) {
-            pts[i] = ((int *) lines)[i+1];
-            pts[i+1] = ((int *) lines)[i];
-        }
-#else
         for (int i=0; i<count2; ++i)
             pts[i] = ((int *) lines)[i];
-#endif
 
         QVectorPath path(pts, count, qpaintengineex_line_types_16, QVectorPath::LinesHint);
         stroke(path, state()->pen);
@@ -831,7 +826,7 @@ void QPaintEngineEx::drawEllipse(const QRectF &r)
 
     int point_count = 0;
     x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count);
-    QVectorPath vp((qreal *) pts, point_count, qpaintengineex_ellipse_types, QVectorPath::EllipseHint);
+    QVectorPath vp((qreal *) pts, point_count + 1, qpaintengineex_ellipse_types, QVectorPath::EllipseHint);
     draw(vp);
 }
 
@@ -1057,5 +1052,48 @@ Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)
     return p;
 }
 
+void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
+{
+    QPainterPath path;
+#ifndef Q_WS_MAC
+    path.setFillRule(Qt::WindingFill);
+#endif
+
+    if (staticTextItem->numGlyphs == 0)
+        return;
+
+    QFontEngine *fontEngine = staticTextItem->fontEngine();
+    fontEngine->addGlyphsToPath(staticTextItem->glyphs, staticTextItem->glyphPositions,
+                                staticTextItem->numGlyphs, &path, 0);
+    if (!path.isEmpty()) {
+        QPainterState *s = state();
+        QPainter::RenderHints oldHints = s->renderHints;
+        bool changedHints = false;
+        if (bool(oldHints & QPainter::TextAntialiasing)
+            && !bool(fontEngine->fontDef.styleStrategy & QFont::NoAntialias)
+            && !bool(oldHints & QPainter::Antialiasing)) {
+            s->renderHints |= QPainter::Antialiasing;
+            renderHintsChanged();
+            changedHints = true;
+        }
+
+        fill(qtVectorPathForPath(path), s->pen.color());
+
+        if (changedHints) {
+            s->renderHints = oldHints;
+            renderHintsChanged();
+        }
+    }
+}
+
+bool QPaintEngineEx::supportsTransformations(qreal pixelSize, const QTransform &m) const
+{
+    Q_UNUSED(pixelSize);
+
+    if (!m.isAffine())
+        return true;
+
+    return false;
+}
 
 QT_END_NAMESPACE