Parcourir la source

Use functions from SDL instead of libc

meyraud705 il y a 1 an
Parent
commit
f85535b4b6
3 fichiers modifiés avec 5 ajouts et 5 suppressions
  1. 3 3
      src/video/SDL_pixels.c
  2. 1 1
      src/video/x11/SDL_x11pen.c
  3. 1 1
      test/testpen.c

+ 3 - 3
src/video/SDL_pixels.c

@@ -759,9 +759,9 @@ float SDL_PQfromNits(float v)
     const float m2 = 78.84375f;
 
     float y = SDL_clamp(v / 10000.0f, 0.0f, 1.0f);
-    float num = c1 + c2 * pow(y, m1);
-    float den = 1.0f + c3 * pow(y, m1);
-    return pow(num / den, m2);
+    float num = c1 + c2 * SDL_powf(y, m1);
+    float den = 1.0f + c3 * SDL_powf(y, m1);
+    return SDL_powf(num / den, m2);
 }
 
 const float *SDL_GetYCbCRtoRGBConversionMatrix(SDL_Colorspace colorspace)

+ 1 - 1
src/video/x11/SDL_x11pen.c

@@ -275,7 +275,7 @@ static SDL_bool xinput2_pen_is_eraser(SDL_VideoDevice *_this, int deviceid, char
     SDL_strlcpy(dev_name, devicename, PEN_ERASER_ID_MAXLEN);
     /* lowercase device name string so we can use strstr() */
     for (k = 0; dev_name[k]; ++k) {
-        dev_name[k] = tolower(dev_name[k]);
+        dev_name[k] = SDL_tolower(dev_name[k]);
     }
 
     return (SDL_strstr(dev_name, PEN_ERASER_NAME_TAG)) ? SDL_TRUE : SDL_FALSE;

+ 1 - 1
test/testpen.c

@@ -158,7 +158,7 @@ static void DrawScreen(SDL_Renderer *renderer)
     SDL_RenderLine(renderer, X, Y, endx - (ydelta * last_pressure / 3.0f), endy + (xdelta * last_pressure / 3.0f));
 
     /* If tilt is very small (or zero, for pens that don't have tilt), add some extra lines, rotated by the current rotation value */
-    if (ALWAYS_SHOW_PRESSURE_BOX || (fabs(tilt_vec_x) < 0.2f && fabs(tilt_vec_y) < 0.2f)) {
+    if (ALWAYS_SHOW_PRESSURE_BOX || (SDL_fabs(tilt_vec_x) < 0.2f && SDL_fabs(tilt_vec_y) < 0.2f)) {
         int rot;
         float pressure = last_pressure * 80.0f;