From baa7c3bdecc7fbcf7673b4b1807e742ede2e7bd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <sroedal@trolltech.com>
Date: Tue, 16 Feb 2010 15:20:29 +0100
Subject: Fixed autotest failure in tst_QGraphicsScene::render on Maemo.

The fixed point code in the raster paint engine's drawEllipse() function
causes rendering errors on ARM. Remove untested code and use the vector
path fallback instead.

Reviewed-by: Gunnar Sletta
---
 src/gui/painting/qpaintengine_raster.cpp | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index bc56ed0..4a4792a 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1827,6 +1827,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
         }
     }
 
+#ifndef FLOATING_POINT_BUGGY_OR_NO_FPU
     if (path.shape() == QVectorPath::EllipseHint) {
         if (!s->flags.antialiased && s->matrix.type() <= QTransform::TxScale) {
             const qreal *p = path.points();
@@ -1846,6 +1847,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
             }
         }
     }
+#endif
 
     // ### Optimize for non transformed ellipses and rectangles...
     QRectF cpRect = path.controlPointRect();
@@ -3672,6 +3674,7 @@ void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount)
 */
 void QRasterPaintEngine::drawEllipse(const QRectF &rect)
 {
+#ifndef FLOATING_POINT_BUGGY_OR_NO_FPU
     Q_D(QRasterPaintEngine);
     QRasterPaintEngineState *s = state();
 
@@ -3679,9 +3682,6 @@ void QRasterPaintEngine::drawEllipse(const QRectF &rect)
     if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen)
          || (qpen_style(s->lastPen) == Qt::NoPen && !s->flags.antialiased))
         && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT
-#ifdef FLOATING_POINT_BUGGY_OR_NO_FPU
-        && qMax(rect.width(), rect.height()) < 128 // integer math breakdown
-#endif
         && s->matrix.type() <= QTransform::TxScale) // no shear
     {
         ensureBrush();
@@ -3697,6 +3697,7 @@ void QRasterPaintEngine::drawEllipse(const QRectF &rect)
             return;
         }
     }
+#endif
     QPaintEngineEx::drawEllipse(rect);
 }
 
@@ -6054,15 +6055,9 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
                                    ProcessSpans pen_func, ProcessSpans brush_func,
                                    QSpanData *pen_data, QSpanData *brush_data)
 {
-#ifdef FLOATING_POINT_BUGGY_OR_NO_FPU // no fpu, so use fixed point
-    const QFixed a = QFixed(rect.width()) >> 1;
-    const QFixed b = QFixed(rect.height()) >> 1;
-    QFixed d = b*b - (a*a*b) + ((a*a) >> 2);
-#else
     const qreal a = qreal(rect.width()) / 2;
     const qreal b = qreal(rect.height()) / 2;
     qreal d = b*b - (a*a*b) + 0.25*a*a;
-#endif
 
     int x = 0;
     int y = (rect.height() + 1) / 2;
@@ -6085,12 +6080,7 @@ static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip,
                       pen_func, brush_func, pen_data, brush_data);
 
     // region 2
-#ifdef FLOATING_POINT_BUGGY_OR_NO_FPU
-    d = b*b*(x + (QFixed(1) >> 1))*(x + (QFixed(1) >> 1))
-        + a*a*((y - 1)*(y - 1) - b*b);
-#else
     d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b);
-#endif
     const int miny = rect.height() & 0x1;
     while (y > miny) {
         if (d < 0) { // select SE
-- 
cgit v0.12