Move some early-out code to the top of the function
This commit is contained in:
@@ -1210,6 +1210,11 @@ void wxGCDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
|
||||
|
||||
void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y)
|
||||
{
|
||||
wxCHECK_RET( IsOk(), "wxGCDC::DoDrawText - invalid DC" );
|
||||
|
||||
if ( str.empty() )
|
||||
return;
|
||||
|
||||
// For compatibility with other ports (notably wxGTK) and because it's
|
||||
// genuinely useful, we allow passing multiline strings to DrawText().
|
||||
// However there is no native OSX function to draw them directly so we
|
||||
@@ -1222,11 +1227,6 @@ void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y)
|
||||
return;
|
||||
}
|
||||
|
||||
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawText - invalid DC") );
|
||||
|
||||
if ( str.empty() )
|
||||
return;
|
||||
|
||||
// Text drawing shouldn't be affected by the raster operation
|
||||
// mode set by SetLogicalFunction() and should be always done
|
||||
// in the default wxCOPY mode (which is wxCOMPOSITION_OVER
|
||||
@@ -1368,6 +1368,9 @@ void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect,
|
||||
const wxColour& destColour,
|
||||
wxDirection nDirection )
|
||||
{
|
||||
if (rect.width == 0 || rect.height == 0)
|
||||
return;
|
||||
|
||||
wxPoint start;
|
||||
wxPoint end;
|
||||
switch( nDirection)
|
||||
@@ -1396,9 +1399,6 @@ void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect,
|
||||
break;
|
||||
}
|
||||
|
||||
if (rect.width == 0 || rect.height == 0)
|
||||
return;
|
||||
|
||||
m_graphicContext->SetBrush( m_graphicContext->CreateLinearGradientBrush(
|
||||
start.x,start.y,end.x,end.y, initialColour, destColour));
|
||||
m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
|
||||
|
Reference in New Issue
Block a user