use on gdk_draw_lines() call instead of multiple gdk_draw_line() ones (patch 717012)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-04-11 14:14:23 +00:00
parent e2a5251d01
commit 6eb37239e0
2 changed files with 32 additions and 16 deletions

View File

@ -695,20 +695,28 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
if (m_pen.GetStyle() == wxTRANSPARENT) return;
if (n <= 0) return;
CalcBoundingBox( points[0].x + xoffset, points[0].y + yoffset );
GdkPoint *gpts = new GdkPoint[n];
if (! gpts)
{
wxFAIL_MSG( wxT("Cannot allocate PolyLine") );
return;
}
for (int i = 0; i < n-1; i++)
for (int i = 0; i < n; i++)
{
wxCoord x1 = XLOG2DEV(points[i].x + xoffset);
wxCoord x2 = XLOG2DEV(points[i+1].x + xoffset);
wxCoord y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
wxCoord y2 = YLOG2DEV(points[i+1].y + yoffset);
wxCoord y1 = YLOG2DEV(points[i].y + yoffset);
if (m_window)
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
CalcBoundingBox( x1 + xoffset, y1 + yoffset );
CalcBoundingBox( points[i+1].x + xoffset, points[i+1].y + yoffset );
gpts[i].x = x1;
gpts[i].y = y1;
}
if (m_window)
gdk_draw_lines( m_window, m_penGC, gpts, n);
delete[] gpts;
}
void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int WXUNUSED(fillStyle) )

View File

@ -695,20 +695,28 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
if (m_pen.GetStyle() == wxTRANSPARENT) return;
if (n <= 0) return;
CalcBoundingBox( points[0].x + xoffset, points[0].y + yoffset );
GdkPoint *gpts = new GdkPoint[n];
if (! gpts)
{
wxFAIL_MSG( wxT("Cannot allocate PolyLine") );
return;
}
for (int i = 0; i < n-1; i++)
for (int i = 0; i < n; i++)
{
wxCoord x1 = XLOG2DEV(points[i].x + xoffset);
wxCoord x2 = XLOG2DEV(points[i+1].x + xoffset);
wxCoord y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
wxCoord y2 = YLOG2DEV(points[i+1].y + yoffset);
wxCoord y1 = YLOG2DEV(points[i].y + yoffset);
if (m_window)
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
CalcBoundingBox( x1 + xoffset, y1 + yoffset );
CalcBoundingBox( points[i+1].x + xoffset, points[i+1].y + yoffset );
gpts[i].x = x1;
gpts[i].y = y1;
}
if (m_window)
gdk_draw_lines( m_window, m_penGC, gpts, n);
delete[] gpts;
}
void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int WXUNUSED(fillStyle) )