2006-08-29 Nikolas Zimmermann <zimmermann@kde.org>
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Aug 2006 20:05:09 +0000 (20:05 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Aug 2006 20:05:09 +0000 (20:05 +0000)
        Reviewed and landed by ap.

Fixes: http://bugzilla.opendarwin.org/show_bug.cgi?id=10629.
        Drawing convex polygons is broken in the Qt platform.

        * platform/qt/GraphicsContextQt.cpp:
        (WebCore::GraphicsContext::drawConvexPolygon):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16097 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/qt/GraphicsContextQt.cpp

index 7fd2508c5d7db16148ad6eb51fc5b7d6ad1a82b2..04cd0aedeb54995664bfb9097d9a041dbc6fe5c7 100644 (file)
@@ -1,3 +1,13 @@
+2006-08-29  Nikolas Zimmermann  <zimmermann@kde.org>
+
+        Reviewed and landed by ap.
+
+        Fixes: http://bugzilla.opendarwin.org/show_bug.cgi?id=10629.
+        Drawing convex polygons is broken in the Qt platform.
+
+        * platform/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::drawConvexPolygon):
+
 2006-08-29  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Eric.
index 4c3880cdd9d4544a5e594809903bb7d9e7d51705..80e615b31e4e2229700617345d0d21df9e65892a 100644 (file)
 #include "GraphicsContext.h"
 #include "Path.h"
 
+#include <QStack>
 #include <QPainter>
+#include <QPolygonF>
 #include <QPainterPath>
 #include <QPaintDevice>
-#include <QStack>
 
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
@@ -423,8 +424,18 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points
     if (paintingDisabled())
         return;
 
-    // FIXME: Take 'shouldAntialias' into account...
-    m_data->p().drawConvexPolygon(reinterpret_cast<const QPointF*>(points), npoints);
+    if (npoints <= 1)
+        return;
+
+    QPolygonF polygon(npoints);
+
+    for (size_t i = 0; i < npoints; i++)
+        polygon << points[i];
+
+    m_data->p().save();
+    m_data->p().setRenderHint(QPainter::Antialiasing, shouldAntialias);
+    m_data->p().drawConvexPolygon(polygon);
+    m_data->p().restore();
 }
 
 void GraphicsContext::fillRect(const IntRect& rect, const Color& c)