]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dcgraph.cpp
Fix from wxAUI forum (http://www.kirix.com/forums/viewtopic.php?f=16&t=564) for displ...
[wxWidgets.git] / src / common / dcgraph.cpp
index 40ff9d38d9d01d530ea55a2aa388d4187a568411..24801af63c298b884b5f809daa8d19b07b877b70 100644 (file)
@@ -501,20 +501,15 @@ void wxGCDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
     if ( !m_logicalFunctionSupported )
         return;
 
-    bool fill = m_brush.GetStyle() != wxTRANSPARENT;
-
     wxGraphicsPath path = m_graphicContext->CreatePath();
     m_graphicContext->PushState();
-    m_graphicContext->Translate(x+w/2,y+h/2);
+    m_graphicContext->Translate(x+w/2.0,y+h/2.0);
     wxDouble factor = ((wxDouble) w) / h;
     m_graphicContext->Scale( factor , 1.0);
-    if ( fill && (sa!=ea) )
-        path.MoveToPoint(0,0);
+
     // since these angles (ea,sa) are measured counter-clockwise, we invert them to
     // get clockwise angles
-    path.AddArc( 0, 0, h/2 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
-    if ( fill && (sa!=ea) )
-        path.AddLineToPoint(0,0);
+    path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
     m_graphicContext->DrawPath( path );
     m_graphicContext->PopState();
 }
@@ -546,7 +541,7 @@ void wxGCDC::DoDrawLines(int n, wxPoint points[],
 }
 
 #if wxUSE_SPLINES
-void wxGCDC::DoDrawSpline(wxList *points)
+void wxGCDC::DoDrawSpline(const wxPointList *points)
 {
     wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") );
 
@@ -555,18 +550,18 @@ void wxGCDC::DoDrawSpline(wxList *points)
 
     wxGraphicsPath path = m_graphicContext->CreatePath();
 
-    wxList::compatibility_iterator node = points->GetFirst();
-    if (node == wxList::compatibility_iterator())
+    wxPointList::compatibility_iterator node = points->GetFirst();
+    if (node == wxPointList::compatibility_iterator())
         // empty list
         return;
 
-    wxPoint *p = (wxPoint *)node->GetData();
+    wxPoint *p = node->GetData();
 
     wxCoord x1 = p->x;
     wxCoord y1 = p->y;
 
     node = node->GetNext();
-    p = (wxPoint *)node->GetData();
+    p = node->GetData();
 
     wxCoord x2 = p->x;
     wxCoord y2 = p->y;
@@ -584,7 +579,7 @@ void wxGCDC::DoDrawSpline(wxList *points)
 #endif // !wxUSE_STL
 
     {
-        p = (wxPoint *)node->GetData();
+        p = node->GetData();
         x1 = x2;
         y1 = y2;
         x2 = p->x;
@@ -698,6 +693,13 @@ void wxGCDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
     if (w == 0 || h == 0)
         return;
 
+    if ( m_graphicContext->ShouldOffset() )
+    {
+        // if we are offsetting the entire rectangle is moved 0.5, so the
+        // border line gets off by 1
+        w -= 1;
+        h -= 1;
+    }
     m_graphicContext->DrawRoundedRectangle( x,y,w,h,radius);
 }
 
@@ -708,6 +710,13 @@ void wxGCDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
     if ( !m_logicalFunctionSupported )
         return;
 
+    if ( m_graphicContext->ShouldOffset() )
+    {
+        // if we are offsetting the entire rectangle is moved 0.5, so the
+        // border line gets off by 1
+        w -= 1;
+        h -= 1;
+    }
     m_graphicContext->DrawEllipse(x,y,w,h);
 }
 
@@ -821,7 +830,7 @@ bool wxGCDC::CanGetTextExtent() const
 
 void wxGCDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height,
                               wxCoord *descent, wxCoord *externalLeading ,
-                              wxFont *theFont ) const
+                              const wxFont *theFont ) const
 {
     wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoGetTextExtent - invalid DC") );