mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 20:10:56 +00:00
Merge pull request #560 from Pan7/fixTexAbs
Fix warning using floating point absolute value function fabs
This commit is contained in:
commit
93f88ca829
1 changed files with 7 additions and 6 deletions
|
@ -27,6 +27,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,19 +261,19 @@ void FitView( IWindow* hwndDlg, int TexSize[2] ){
|
||||||
}
|
}
|
||||||
// we want a texture with the same X / Y ratio
|
// we want a texture with the same X / Y ratio
|
||||||
// compute XY space / window size ratio
|
// compute XY space / window size ratio
|
||||||
float SSize = (float)fabs( g_2DView.m_Maxs[0] - g_2DView.m_Mins[0] );
|
float SSize = std::fabs( g_2DView.m_Maxs[0] - g_2DView.m_Mins[0] );
|
||||||
float TSize = (float)fabs( g_2DView.m_Maxs[1] - g_2DView.m_Mins[1] );
|
float TSize = std::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)fabs( g_2DView.m_rect.left - g_2DView.m_rect.right );
|
float RatioX = XSize / std::fabs( g_2DView.m_rect.left - g_2DView.m_rect.right );
|
||||||
float RatioY = YSize / (float)fabs( g_2DView.m_rect.top - g_2DView.m_rect.bottom );
|
float RatioY = YSize / std::fabs( g_2DView.m_rect.top - g_2DView.m_rect.bottom );
|
||||||
if ( RatioX > RatioY ) {
|
if ( RatioX > RatioY ) {
|
||||||
YSize = (float)fabs( g_2DView.m_rect.top - g_2DView.m_rect.bottom ) * RatioX;
|
YSize = std::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)fabs( g_2DView.m_rect.left - g_2DView.m_rect.right ) * RatioY;
|
XSize = std::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;
|
||||||
|
|
Loading…
Reference in a new issue