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