src/video/SDL_fillrect.c
changeset 3012 7e30c2dc7783
parent 2913 ffae53de58f4
child 3536 0267b8b1595c
     1.1 --- a/src/video/SDL_fillrect.c	Fri Jan 09 20:43:30 2009 +0000
     1.2 +++ b/src/video/SDL_fillrect.c	Sat Jan 10 18:32:24 2009 +0000
     1.3 @@ -66,7 +66,7 @@
     1.4          int i, n = w * bpp; \
     1.5          Uint8 *p = pixels; \
     1.6   \
     1.7 -        if (n > 15) { \
     1.8 +        if (n > 63) { \
     1.9              int adjust = 16 - ((uintptr_t)p & 15); \
    1.10              if (adjust < 16) { \
    1.11                  n -= adjust; \
    1.12 @@ -92,7 +92,35 @@
    1.13      SSE_END; \
    1.14  }
    1.15  
    1.16 -DEFINE_SSE_FILLRECT(1, Uint8)
    1.17 +static void
    1.18 +SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
    1.19 +{
    1.20 +    SSE_BEGIN;
    1.21 +
    1.22 +    while (h--) {
    1.23 +        int i, n = w;
    1.24 +        Uint8 *p = pixels;
    1.25 +
    1.26 +        if (n > 63) {
    1.27 +            int adjust = 16 - ((uintptr_t)p & 15);
    1.28 +            if (adjust) {
    1.29 +                n -= adjust;
    1.30 +                SDL_memset(p, color, adjust);
    1.31 +                p += adjust;
    1.32 +            }
    1.33 +            SSE_WORK;
    1.34 +        }
    1.35 +        if (n & 63) {
    1.36 +            int remainder = (n & 63);
    1.37 +            SDL_memset(p, color, remainder);
    1.38 +            p += remainder;
    1.39 +        }
    1.40 +        pixels += pitch;
    1.41 +    }
    1.42 +
    1.43 +    SSE_END;
    1.44 +}
    1.45 +/*DEFINE_SSE_FILLRECT(1, Uint8)*/
    1.46  DEFINE_SSE_FILLRECT(2, Uint16)
    1.47  DEFINE_SSE_FILLRECT(4, Uint32)
    1.48  
    1.49 @@ -131,7 +159,7 @@
    1.50          int i, n = w * bpp; \
    1.51          Uint8 *p = pixels; \
    1.52   \
    1.53 -        if (n > 7) { \
    1.54 +        if (n > 63) { \
    1.55              int adjust = 8 - ((uintptr_t)p & 7); \
    1.56              if (adjust < 8) { \
    1.57                  n -= adjust; \
    1.58 @@ -157,7 +185,35 @@
    1.59      MMX_END; \
    1.60  }
    1.61  
    1.62 -DEFINE_MMX_FILLRECT(1, Uint8)
    1.63 +static void
    1.64 +SDL_FillRect1MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
    1.65 +{
    1.66 +    MMX_BEGIN;
    1.67 +
    1.68 +    while (h--) {
    1.69 +        int i, n = w;
    1.70 +        Uint8 *p = pixels;
    1.71 +
    1.72 +        if (n > 63) {
    1.73 +            int adjust = 8 - ((uintptr_t)p & 7);
    1.74 +            if (adjust) {
    1.75 +                n -= adjust;
    1.76 +                SDL_memset(p, color, adjust);
    1.77 +                p += adjust;
    1.78 +            }
    1.79 +            MMX_WORK;
    1.80 +        }
    1.81 +        if (n & 63) {
    1.82 +            int remainder = (n & 63);
    1.83 +            SDL_memset(p, color, remainder);
    1.84 +            p += remainder;
    1.85 +        }
    1.86 +        pixels += pitch;
    1.87 +    }
    1.88 +
    1.89 +    MMX_END;
    1.90 +}
    1.91 +/*DEFINE_MMX_FILLRECT(1, Uint8)*/
    1.92  DEFINE_MMX_FILLRECT(2, Uint16)
    1.93  DEFINE_MMX_FILLRECT(4, Uint32)
    1.94