- dc->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) );
- wxSize size = dc->GetSize() ;
- dc->SetClippingRegion( 0 , 0 , size.x , size.y ) ;
+ wxDCImpl *impl = dc->GetImpl();
+ wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl);
+ if (win_impl)
+ {
+ win_impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) );
+ dc->SetClippingRegion( m_x , m_y , m_width , m_height ) ;
+ }