using GetNativePath instead of dynamic_cast

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42249 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2006-10-22 20:42:12 +00:00
parent eec960fa89
commit f540e5bd06
2 changed files with 29 additions and 23 deletions

View File

@@ -182,7 +182,12 @@ public :
virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ;
*/
GraphicsPath* GetPath() const;
// returns the native path
virtual void * GetNativePath() const { return m_path; }
// give the native path returned by GetNativePath() back (there might be some deallocations necessary)
virtual void UnGetNativePath(void *p) {}
private :
GraphicsPath* m_path;
};
@@ -263,11 +268,6 @@ wxGDIPlusPath::~wxGDIPlusPath()
delete m_path;
}
GraphicsPath* wxGDIPlusPath::GetPath() const
{
return m_path;
}
//
// The Primitives
//
@@ -409,22 +409,20 @@ void wxGDIPlusContext::ResetClip()
// TODO
}
void wxGDIPlusContext::StrokePath( const wxGraphicsPath *p )
void wxGDIPlusContext::StrokePath( const wxGraphicsPath *path )
{
if ( m_penTransparent )
return;
const wxGDIPlusPath* path = dynamic_cast< const wxGDIPlusPath*>( p );
m_context->DrawPath( m_pen , path->GetPath() );
m_context->DrawPath( m_pen , (GraphicsPath*) path->GetNativePath() );
}
void wxGDIPlusContext::FillPath( const wxGraphicsPath *p , int fillStyle )
void wxGDIPlusContext::FillPath( const wxGraphicsPath *path , int fillStyle )
{
if ( !m_brushTransparent )
{
const wxGDIPlusPath* path = dynamic_cast< const wxGDIPlusPath*>( p );
path->GetPath()->SetFillMode( fillStyle == wxODDEVEN_RULE ? FillModeAlternate : FillModeWinding);
m_context->FillPath( m_brush , path->GetPath() );
((GraphicsPath*) path->GetNativePath())->SetFillMode( fillStyle == wxODDEVEN_RULE ? FillModeAlternate : FillModeWinding);
m_context->FillPath( m_brush , (GraphicsPath*) path->GetNativePath());
}
}