Fix abs warning

This commit is contained in:
Pan7 2017-04-28 13:59:41 +02:00
parent 6e3c89c217
commit a7f7a59422

View file

@ -264,15 +264,15 @@ void FitView( IWindow* hwndDlg, int TexSize[2] ){
float TSize = (float)fabs( g_2DView.m_Maxs[1] - g_2DView.m_Mins[1] ); float TSize = (float)fabs( g_2DView.m_Maxs[1] - g_2DView.m_Mins[1] );
float XSize = TexSize[0] * SSize; float XSize = TexSize[0] * SSize;
float YSize = TexSize[1] * TSize; float YSize = TexSize[1] * TSize;
float RatioX = XSize / (float)abs( g_2DView.m_rect.left - g_2DView.m_rect.right ); float RatioX = XSize / (float)fabs( g_2DView.m_rect.left - g_2DView.m_rect.right );
float RatioY = YSize / (float)abs( g_2DView.m_rect.top - g_2DView.m_rect.bottom ); float RatioY = YSize / (float)fabs( g_2DView.m_rect.top - g_2DView.m_rect.bottom );
if ( RatioX > RatioY ) { if ( RatioX > RatioY ) {
YSize = (float)abs( g_2DView.m_rect.top - g_2DView.m_rect.bottom ) * RatioX; YSize = (float)fabs( g_2DView.m_rect.top - g_2DView.m_rect.bottom ) * RatioX;
TSize = YSize / (float)TexSize[1]; TSize = YSize / (float)TexSize[1];
} }
else else
{ {
XSize = (float)abs( g_2DView.m_rect.left - g_2DView.m_rect.right ) * RatioY; XSize = (float)fabs( g_2DView.m_rect.left - g_2DView.m_rect.right ) * RatioY;
SSize = XSize / (float)TexSize[0]; SSize = XSize / (float)TexSize[0];
} }
g_2DView.m_Mins[0] = g_2DView.m_Center[0] - 0.5f * SSize; g_2DView.m_Mins[0] = g_2DView.m_Center[0] - 0.5f * SSize;