Remove "default" clause from enums in wxGDIPlusContext code.
This will allow the compiler to give us a warning if more elements are added to the enum later but not added to the switch. Also add error checking to Graphics::SetSmoothingMode() call. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76301 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1551,21 +1551,26 @@ bool wxGDIPlusContext::SetAntialiasMode(wxAntialiasMode antialias)
|
|||||||
if (m_antialias == antialias)
|
if (m_antialias == antialias)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
m_antialias = antialias;
|
SmoothingMode antialiasMode = SmoothingModeInvalid;
|
||||||
|
|
||||||
SmoothingMode antialiasMode;
|
|
||||||
switch (antialias)
|
switch (antialias)
|
||||||
{
|
{
|
||||||
case wxANTIALIAS_DEFAULT:
|
case wxANTIALIAS_DEFAULT:
|
||||||
antialiasMode = SmoothingModeHighQuality;
|
antialiasMode = SmoothingModeHighQuality;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxANTIALIAS_NONE:
|
case wxANTIALIAS_NONE:
|
||||||
antialiasMode = SmoothingModeNone;
|
antialiasMode = SmoothingModeNone;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
m_context->SetSmoothingMode(antialiasMode);
|
|
||||||
|
wxCHECK_MSG( antialiasMode != SmoothingModeInvalid, false,
|
||||||
|
wxS("Unknown antialias mode") );
|
||||||
|
|
||||||
|
if ( m_context->SetSmoothingMode(antialiasMode) != Gdiplus::Ok )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_antialias = antialias;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1574,7 +1579,7 @@ bool wxGDIPlusContext::SetInterpolationQuality(wxInterpolationQuality interpolat
|
|||||||
if (m_interpolation == interpolation)
|
if (m_interpolation == interpolation)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
InterpolationMode interpolationMode = InterpolationModeDefault;
|
InterpolationMode interpolationMode = InterpolationModeInvalid;
|
||||||
switch (interpolation)
|
switch (interpolation)
|
||||||
{
|
{
|
||||||
case wxINTERPOLATION_DEFAULT:
|
case wxINTERPOLATION_DEFAULT:
|
||||||
@@ -1596,11 +1601,11 @@ bool wxGDIPlusContext::SetInterpolationQuality(wxInterpolationQuality interpolat
|
|||||||
case wxINTERPOLATION_BEST:
|
case wxINTERPOLATION_BEST:
|
||||||
interpolationMode = InterpolationModeHighQualityBicubic;
|
interpolationMode = InterpolationModeHighQualityBicubic;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxCHECK_MSG( interpolationMode != InterpolationModeInvalid, false,
|
||||||
|
wxS("Unknown interpolation mode") );
|
||||||
|
|
||||||
if ( m_context->SetInterpolationMode(interpolationMode) != Gdiplus::Ok )
|
if ( m_context->SetInterpolationMode(interpolationMode) != Gdiplus::Ok )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user