+
+void wxMacCoreGraphicsContext::DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h )
+{
+ if (!EnsureIsValid())
+ return;
+
+ if (m_composition == wxCOMPOSITION_DEST)
+ return;
+
+ // when using shading, we have to go back to drawing paths
+ if ( !m_brush.IsNull() && ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->IsShading() )
+ {
+ wxGraphicsContext::DrawRectangle( x,y,w,h );
+ 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);
+ }
+}
+