Browse Source

Removed SDL_round() because the license wasn't compatible with zlib

Sam Lantinga 11 years ago
parent
commit
1ea8697894

+ 2 - 2
CMakeLists.txt

@@ -496,7 +496,7 @@ if(LIBC)
             strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
             strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
             _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
             _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
             _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos
             _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos
-            cosf fabs floor log pow round scalbn sin sinf sqrt sqrtf tan tanf)
+            cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf)
       string(TOUPPER ${_FN} _UPPER)
       string(TOUPPER ${_FN} _UPPER)
       set(HAVE_${_UPPER} 1)
       set(HAVE_${_UPPER} 1)
     endforeach()
     endforeach()
@@ -542,7 +542,7 @@ if(LIBC)
     if(HAVE_LIBM)
     if(HAVE_LIBM)
       set(CMAKE_REQUIRED_LIBRARIES m)
       set(CMAKE_REQUIRED_LIBRARIES m)
       foreach(_FN
       foreach(_FN
-              atan atan2 ceil copysign cos cosf fabs floor log pow round scalbn sin
+              atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin
               sinf sqrt sqrtf tan tanf)
               sinf sqrt sqrtf tan tanf)
         string(TOUPPER ${_FN} _UPPER)
         string(TOUPPER ${_FN} _UPPER)
         set(_HAVEVAR "HAVE_${_UPPER}")
         set(_HAVEVAR "HAVE_${_UPPER}")

+ 1 - 1
configure

@@ -16641,7 +16641,7 @@ if test "x$ac_cv_lib_m_pow" = xyes; then :
   LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
   LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
 fi
 fi
 
 
-    for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow round scalbn sin sinf sqrt sqrtf tan tanf
+    for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf
 do :
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

+ 1 - 1
configure.in

@@ -271,7 +271,7 @@ if test x$enable_libc = xyes; then
     AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
     AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
 
 
     AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
     AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
-    AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow round scalbn sin sinf sqrt sqrtf tan tanf)
+    AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf)
 
 
     AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
     AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
     AC_CHECK_FUNCS(iconv)
     AC_CHECK_FUNCS(iconv)

+ 0 - 1
include/SDL_config.h.cmake

@@ -140,7 +140,6 @@
 #cmakedefine HAVE_FLOOR 1
 #cmakedefine HAVE_FLOOR 1
 #cmakedefine HAVE_LOG 1
 #cmakedefine HAVE_LOG 1
 #cmakedefine HAVE_POW 1
 #cmakedefine HAVE_POW 1
-#cmakedefine HAVE_ROUND 1
 #cmakedefine HAVE_SCALBN 1
 #cmakedefine HAVE_SCALBN 1
 #cmakedefine HAVE_SIN 1
 #cmakedefine HAVE_SIN 1
 #cmakedefine HAVE_SINF 1
 #cmakedefine HAVE_SINF 1

+ 0 - 1
include/SDL_config.h.in

@@ -150,7 +150,6 @@
 #undef HAVE_FLOOR
 #undef HAVE_FLOOR
 #undef HAVE_LOG
 #undef HAVE_LOG
 #undef HAVE_POW
 #undef HAVE_POW
-#undef HAVE_ROUND
 #undef HAVE_SCALBN
 #undef HAVE_SCALBN
 #undef HAVE_SIN
 #undef HAVE_SIN
 #undef HAVE_SINF
 #undef HAVE_SINF

+ 0 - 1
include/SDL_config_android.h

@@ -96,7 +96,6 @@
 #define HAVE_FLOOR  1
 #define HAVE_FLOOR  1
 #define HAVE_LOG    1
 #define HAVE_LOG    1
 #define HAVE_POW    1
 #define HAVE_POW    1
-#define HAVE_ROUND  1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
 #define HAVE_SIN    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SINF   1

+ 0 - 1
include/SDL_config_iphoneos.h

@@ -94,7 +94,6 @@
 #define HAVE_FLOOR  1
 #define HAVE_FLOOR  1
 #define HAVE_LOG    1
 #define HAVE_LOG    1
 #define HAVE_POW    1
 #define HAVE_POW    1
-#define HAVE_ROUND  1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
 #define HAVE_SIN    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SINF   1

+ 0 - 1
include/SDL_config_macosx.h

@@ -92,7 +92,6 @@
 #define HAVE_FLOOR  1
 #define HAVE_FLOOR  1
 #define HAVE_LOG    1
 #define HAVE_LOG    1
 #define HAVE_POW    1
 #define HAVE_POW    1
-#define HAVE_ROUND  1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
 #define HAVE_SIN    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SINF   1

+ 0 - 1
include/SDL_config_pandora.h

@@ -91,7 +91,6 @@
 #define HAVE_FABS 1
 #define HAVE_FABS 1
 #define HAVE_FLOOR 1
 #define HAVE_FLOOR 1
 #define HAVE_LOG 1
 #define HAVE_LOG 1
-#define HAVE_ROUND  1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
 #define HAVE_SIN 1
 #define HAVE_SIN 1
 #define HAVE_SINF 1
 #define HAVE_SINF 1

+ 0 - 1
include/SDL_config_psp.h

@@ -94,7 +94,6 @@
 #define HAVE_FLOOR  1
 #define HAVE_FLOOR  1
 #define HAVE_LOG    1
 #define HAVE_LOG    1
 #define HAVE_POW    1
 #define HAVE_POW    1
-#define HAVE_ROUND  1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
 #define HAVE_SIN    1
 #define HAVE_SIN    1
 #define HAVE_SINF   1
 #define HAVE_SINF   1

+ 0 - 1
include/SDL_config_windows.h

@@ -133,7 +133,6 @@ typedef unsigned int uintptr_t;
 #define HAVE_FLOOR 1
 #define HAVE_FLOOR 1
 #define HAVE_LOG 1
 #define HAVE_LOG 1
 #define HAVE_POW 1
 #define HAVE_POW 1
-#define HAVE_ROUND  1
 #define HAVE_SIN 1
 #define HAVE_SIN 1
 #define HAVE_SINF 1
 #define HAVE_SINF 1
 #define HAVE_SQRT 1
 #define HAVE_SQRT 1

+ 0 - 1
include/SDL_config_winrt.h

@@ -135,7 +135,6 @@ typedef unsigned int uintptr_t;
 #define HAVE_FLOOR 1
 #define HAVE_FLOOR 1
 #define HAVE_LOG 1
 #define HAVE_LOG 1
 #define HAVE_POW 1
 #define HAVE_POW 1
-#define HAVE_ROUND 1
 //#define HAVE_SCALBN 1
 //#define HAVE_SCALBN 1
 #define HAVE__SCALB 1
 #define HAVE__SCALB 1
 #define HAVE_SIN 1
 #define HAVE_SIN 1

+ 0 - 1
include/SDL_config_wiz.h

@@ -85,7 +85,6 @@
 #define HAVE_FABS 1
 #define HAVE_FABS 1
 #define HAVE_FLOOR 1
 #define HAVE_FLOOR 1
 #define HAVE_LOG 1
 #define HAVE_LOG 1
-#define HAVE_ROUND 1
 #define HAVE_SCALBN 1
 #define HAVE_SCALBN 1
 #define HAVE_SIN 1
 #define HAVE_SIN 1
 #define HAVE_SINF 1
 #define HAVE_SINF 1

+ 0 - 1
include/SDL_stdinc.h

@@ -428,7 +428,6 @@ extern DECLSPEC double SDLCALL SDL_fabs(double x);
 extern DECLSPEC double SDLCALL SDL_floor(double x);
 extern DECLSPEC double SDLCALL SDL_floor(double x);
 extern DECLSPEC double SDLCALL SDL_log(double x);
 extern DECLSPEC double SDLCALL SDL_log(double x);
 extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
 extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
-extern DECLSPEC double SDLCALL SDL_round(double x);
 extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
 extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
 extern DECLSPEC double SDLCALL SDL_sin(double x);
 extern DECLSPEC double SDLCALL SDL_sin(double x);
 extern DECLSPEC float SDLCALL SDL_sinf(float x);
 extern DECLSPEC float SDLCALL SDL_sinf(float x);

+ 0 - 1
src/dynapi/SDL_dynapi_overrides.h

@@ -591,4 +591,3 @@
 #define SDL_QueueAudio SDL_QueueAudio_REAL
 #define SDL_QueueAudio SDL_QueueAudio_REAL
 #define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL
 #define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL
 #define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL
 #define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL
-#define SDL_round SDL_round_REAL

+ 0 - 1
src/dynapi/SDL_dynapi_procs.h

@@ -623,4 +623,3 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX2,(void),(),return)
 SDL_DYNAPI_PROC(int,SDL_QueueAudio,(SDL_AudioDeviceID a, const void *b, Uint32 c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_QueueAudio,(SDL_AudioDeviceID a, const void *b, Uint32 c),(a,b,c),return)
 SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return)
 SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),)
 SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),)
-SDL_DYNAPI_PROC(double,SDL_round,(double a),(a),return)

+ 0 - 1
src/libm/math_libm.h

@@ -30,7 +30,6 @@ double SDL_uclibc_fabs(double x);
 double SDL_uclibc_floor(double x);
 double SDL_uclibc_floor(double x);
 double SDL_uclibc_log(double x);
 double SDL_uclibc_log(double x);
 double SDL_uclibc_pow(double x, double y);    
 double SDL_uclibc_pow(double x, double y);    
-double SDL_uclibc_round(double x);
 double SDL_uclibc_scalbn(double x, int n);
 double SDL_uclibc_scalbn(double x, int n);
 double SDL_uclibc_sin(double x);
 double SDL_uclibc_sin(double x);
 double SDL_uclibc_sqrt(double x);
 double SDL_uclibc_sqrt(double x);

+ 0 - 1
src/libm/math_private.h

@@ -37,7 +37,6 @@ typedef unsigned int u_int32_t;
 #define floor           SDL_uclibc_floor
 #define floor           SDL_uclibc_floor
 #define __ieee754_log   SDL_uclibc_log
 #define __ieee754_log   SDL_uclibc_log
 #define __ieee754_pow   SDL_uclibc_pow
 #define __ieee754_pow   SDL_uclibc_pow
-#define round           SDL_uclibc_round
 #define scalbn          SDL_uclibc_scalbn
 #define scalbn          SDL_uclibc_scalbn
 #define sin             SDL_uclibc_sin
 #define sin             SDL_uclibc_sin
 #define __ieee754_sqrt  SDL_uclibc_sqrt
 #define __ieee754_sqrt  SDL_uclibc_sqrt

+ 0 - 10
src/stdlib/SDL_stdlib.c

@@ -169,16 +169,6 @@ SDL_pow(double x, double y)
 #endif /* HAVE_POW */
 #endif /* HAVE_POW */
 }
 }
 
 
-double
-SDL_round(double x)
-{
-#if defined(HAVE_ROUND)
-    return round(x);
-#else
-    return SDL_uclibc_round(x);
-#endif /* HAVE_ROUND */
-}
-
 double
 double
 SDL_scalbn(double x, int n)
 SDL_scalbn(double x, int n)
 {
 {

+ 9 - 9
src/video/SDL_surface.c

@@ -741,15 +741,15 @@ SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
     dst_y0 += dst->clip_rect.y;
     dst_y0 += dst->clip_rect.y;
     dst_y1 += dst->clip_rect.y;
     dst_y1 += dst->clip_rect.y;
 
 
-    final_src.x = SDL_round(src_x0);
-    final_src.y = SDL_round(src_y0);
-    final_src.w = SDL_round(src_x1 - src_x0 + 1);
-    final_src.h = SDL_round(src_y1 - src_y0 + 1);
-
-    final_dst.x = SDL_round(dst_x0);
-    final_dst.y = SDL_round(dst_y0);
-    final_dst.w = SDL_round(dst_x1 - dst_x0 + 1);
-    final_dst.h = SDL_round(dst_y1 - dst_y0 + 1);
+    final_src.x = SDL_floor(src_x0 + 0.5);
+    final_src.y = SDL_floor(src_y0 + 0.5);
+    final_src.w = SDL_floor(src_x1 - src_x0 + 1.5);
+    final_src.h = SDL_floor(src_y1 - src_y0 + 1.5);
+
+    final_dst.x = SDL_floor(dst_x0 + 0.5);
+    final_dst.y = SDL_floor(dst_y0 + 0.5);
+    final_dst.w = SDL_floor(dst_x1 - dst_x0 + 1.5);
+    final_dst.h = SDL_floor(dst_y1 - dst_y0 + 1.5);
 
 
     if (final_dst.w < 0)
     if (final_dst.w < 0)
         final_dst.w = 0;
         final_dst.w = 0;