wxDC::DrawPolygon correction
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -749,35 +749,59 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
|
|||||||
wxCoord xoffset, wxCoord yoffset,
|
wxCoord xoffset, wxCoord yoffset,
|
||||||
int fillStyle )
|
int fillStyle )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
||||||
wxMacPortSetter helper(this) ;
|
wxMacPortSetter helper(this) ;
|
||||||
|
|
||||||
|
wxCoord x1, x2 , y1 , y2 ;
|
||||||
|
|
||||||
PolyHandle polygon = OpenPoly() ;
|
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||||
wxCoord x1, x2 , y1 , y2 ;
|
{
|
||||||
x1 = XLOG2DEV(points[0].x + xoffset);
|
PolyHandle polygon = OpenPoly();
|
||||||
y1 = YLOG2DEV(points[0].y + yoffset);
|
|
||||||
::MoveTo(x1,y1);
|
x1 = XLOG2DEV(points[0].x + xoffset);
|
||||||
|
y1 = YLOG2DEV(points[0].y + yoffset);
|
||||||
|
::MoveTo(x1,y1);
|
||||||
|
|
||||||
for (int i = 0; i < n-1; i++)
|
for (int i = 0; i < n-1; i++)
|
||||||
{
|
{
|
||||||
x2 = XLOG2DEV(points[i+1].x + xoffset);
|
x2 = XLOG2DEV(points[i+1].x + xoffset);
|
||||||
y2 = YLOG2DEV(points[i+1].y + yoffset);
|
y2 = YLOG2DEV(points[i+1].y + yoffset);
|
||||||
::LineTo(x2, y2);
|
::LineTo(x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosePoly() ;
|
ClosePoly();
|
||||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
|
||||||
{
|
MacInstallBrush();
|
||||||
MacInstallBrush() ;
|
::PaintPoly( polygon );
|
||||||
::PaintPoly( polygon ) ;
|
|
||||||
|
KillPoly( polygon );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
{
|
{
|
||||||
|
PolyHandle polygon = OpenPoly();
|
||||||
|
|
||||||
|
x1 = XLOG2DEV(points[0].x + xoffset);
|
||||||
|
y1 = YLOG2DEV(points[0].y + yoffset);
|
||||||
|
::MoveTo(x1,y1);
|
||||||
|
|
||||||
|
for (int i = 0; i < n-1; i++)
|
||||||
|
{
|
||||||
|
x2 = XLOG2DEV(points[i+1].x + xoffset);
|
||||||
|
y2 = YLOG2DEV(points[i+1].y + yoffset);
|
||||||
|
::LineTo(x2, y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// return to origin to close path
|
||||||
|
::LineTo(x1,y1);
|
||||||
|
|
||||||
|
ClosePoly();
|
||||||
|
|
||||||
MacInstallPen() ;
|
MacInstallPen() ;
|
||||||
::FramePoly( polygon ) ;
|
::FramePoly( polygon ) ;
|
||||||
|
|
||||||
|
KillPoly( polygon );
|
||||||
}
|
}
|
||||||
KillPoly( polygon ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||||
|
@@ -749,35 +749,59 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
|
|||||||
wxCoord xoffset, wxCoord yoffset,
|
wxCoord xoffset, wxCoord yoffset,
|
||||||
int fillStyle )
|
int fillStyle )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
||||||
wxMacPortSetter helper(this) ;
|
wxMacPortSetter helper(this) ;
|
||||||
|
|
||||||
|
wxCoord x1, x2 , y1 , y2 ;
|
||||||
|
|
||||||
PolyHandle polygon = OpenPoly() ;
|
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||||
wxCoord x1, x2 , y1 , y2 ;
|
{
|
||||||
x1 = XLOG2DEV(points[0].x + xoffset);
|
PolyHandle polygon = OpenPoly();
|
||||||
y1 = YLOG2DEV(points[0].y + yoffset);
|
|
||||||
::MoveTo(x1,y1);
|
x1 = XLOG2DEV(points[0].x + xoffset);
|
||||||
|
y1 = YLOG2DEV(points[0].y + yoffset);
|
||||||
|
::MoveTo(x1,y1);
|
||||||
|
|
||||||
for (int i = 0; i < n-1; i++)
|
for (int i = 0; i < n-1; i++)
|
||||||
{
|
{
|
||||||
x2 = XLOG2DEV(points[i+1].x + xoffset);
|
x2 = XLOG2DEV(points[i+1].x + xoffset);
|
||||||
y2 = YLOG2DEV(points[i+1].y + yoffset);
|
y2 = YLOG2DEV(points[i+1].y + yoffset);
|
||||||
::LineTo(x2, y2);
|
::LineTo(x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosePoly() ;
|
ClosePoly();
|
||||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
|
||||||
{
|
MacInstallBrush();
|
||||||
MacInstallBrush() ;
|
::PaintPoly( polygon );
|
||||||
::PaintPoly( polygon ) ;
|
|
||||||
|
KillPoly( polygon );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||||
{
|
{
|
||||||
|
PolyHandle polygon = OpenPoly();
|
||||||
|
|
||||||
|
x1 = XLOG2DEV(points[0].x + xoffset);
|
||||||
|
y1 = YLOG2DEV(points[0].y + yoffset);
|
||||||
|
::MoveTo(x1,y1);
|
||||||
|
|
||||||
|
for (int i = 0; i < n-1; i++)
|
||||||
|
{
|
||||||
|
x2 = XLOG2DEV(points[i+1].x + xoffset);
|
||||||
|
y2 = YLOG2DEV(points[i+1].y + yoffset);
|
||||||
|
::LineTo(x2, y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// return to origin to close path
|
||||||
|
::LineTo(x1,y1);
|
||||||
|
|
||||||
|
ClosePoly();
|
||||||
|
|
||||||
MacInstallPen() ;
|
MacInstallPen() ;
|
||||||
::FramePoly( polygon ) ;
|
::FramePoly( polygon ) ;
|
||||||
|
|
||||||
|
KillPoly( polygon );
|
||||||
}
|
}
|
||||||
KillPoly( polygon ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||||
|
Reference in New Issue
Block a user