speeding up rectangle drawing by using specific methods, needs 40% less time

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-06-06 23:15:27 +00:00
parent a3c222122d
commit 2bc4cc1ead

View File

@@ -1487,6 +1487,11 @@ public:
virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
// fast convenience methods
virtual void DrawRectangleX( wxDouble x, wxDouble y, wxDouble w, wxDouble h );
void SetNativeContext( CGContextRef cg );
@@ -2611,6 +2616,27 @@ void * wxMacCoreGraphicsContext::GetNativeContext()
return m_cgContext;
}
void wxMacCoreGraphicsContext::DrawRectangleX( wxDouble x, wxDouble y, wxDouble w, wxDouble h )
{
if (m_composition == wxCOMPOSITION_DEST)
return;
CGRect rect = CGRectMake( (CGFloat) x , (CGFloat) y , (CGFloat) w , (CGFloat) h );
if ( !m_brush.IsNull() )
{
((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->Apply(this);
CGContextFillRect(m_cgContext, rect);
}
wxQuartzOffsetHelper helper( m_cgContext , ShouldOffset() );
if ( !m_pen.IsNull() )
{
((wxMacCoreGraphicsPenData*)m_pen.GetRefData())->Apply(this);
CGContextStrokeRect(m_cgContext, rect);
}
}
// concatenates this transform with the current transform of this context
void wxMacCoreGraphicsContext::ConcatTransform( const wxGraphicsMatrix& matrix )
{