Added notes on the next steps for SDL 1.3
authorSam Lantinga <slouken@libsdl.org>
Thu, 16 Aug 2007 21:43:19 +0000
changeset 22536d99edd791bf
parent 2252 b80e3d57941f
child 2254 79e00f5561f4
Added notes on the next steps for SDL 1.3
Moved fill and copy routines to their own files.
NOTES
src/video/SDL_blit.c
src/video/SDL_blit_copy.c
src/video/SDL_blit_copy.h
src/video/SDL_copy.c
src/video/SDL_copy.h
src/video/SDL_fill.c
src/video/SDL_surface.c
     1.1 --- a/NOTES	Thu Aug 16 06:40:34 2007 +0000
     1.2 +++ b/NOTES	Thu Aug 16 21:43:19 2007 +0000
     1.3 @@ -157,6 +157,16 @@
     1.4  streaming textures are lockable and may have system memory pixels available.
     1.5  SDL_compat will use a streaming video texture, and will never be HWSURFACE,
     1.6  but may be PREALLOC, if system memory pixels are available.
     1.7 +*** DONE Thu Aug 16 14:18:42 PDT 2007
     1.8  
     1.9  The software renderer will be abstracted so the surface management can be
    1.10  used by any renderer that provides functions to copy surfaces to the window.
    1.11 +
    1.12 +Blitters...
    1.13 +----
    1.14 +Copy blit and fill rect are optimized with MMX and SSE now.
    1.15 +
    1.16 +Here are the pieces we still need:
    1.17 +- Merging SDL texture capabilities into the SDL surface system
    1.18 +- Generic fallback blitter architecture
    1.19 +- Custom fast path blitters
     2.1 --- a/src/video/SDL_blit.c	Thu Aug 16 06:40:34 2007 +0000
     2.2 +++ b/src/video/SDL_blit.c	Thu Aug 16 21:43:19 2007 +0000
     2.3 @@ -24,7 +24,7 @@
     2.4  #include "SDL_video.h"
     2.5  #include "SDL_sysvideo.h"
     2.6  #include "SDL_blit.h"
     2.7 -#include "SDL_blit_copy.h"
     2.8 +#include "SDL_copy.h"
     2.9  #include "SDL_RLEaccel_c.h"
    2.10  #include "SDL_pixels_c.h"
    2.11  
     3.1 --- a/src/video/SDL_blit_copy.c	Thu Aug 16 06:40:34 2007 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,158 +0,0 @@
     3.4 -/*
     3.5 -    SDL - Simple DirectMedia Layer
     3.6 -    Copyright (C) 1997-2006 Sam Lantinga
     3.7 -
     3.8 -    This library is free software; you can redistribute it and/or
     3.9 -    modify it under the terms of the GNU Lesser General Public
    3.10 -    License as published by the Free Software Foundation; either
    3.11 -    version 2.1 of the License, or (at your option) any later version.
    3.12 -
    3.13 -    This library is distributed in the hope that it will be useful,
    3.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 -    Lesser General Public License for more details.
    3.17 -
    3.18 -    You should have received a copy of the GNU Lesser General Public
    3.19 -    License along with this library; if not, write to the Free Software
    3.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    3.21 -
    3.22 -    Sam Lantinga
    3.23 -    slouken@libsdl.org
    3.24 -*/
    3.25 -#include "SDL_config.h"
    3.26 -
    3.27 -#include "SDL_video.h"
    3.28 -#include "SDL_blit.h"
    3.29 -#include "SDL_blit_copy.h"
    3.30 -
    3.31 -
    3.32 -#ifdef __MMX__
    3.33 -static __inline__ void
    3.34 -SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
    3.35 -{
    3.36 -    int i;
    3.37 -
    3.38 -    __m64 values[8];
    3.39 -    for (i = len / 64; i--;) {
    3.40 -        _mm_prefetch(src, _MM_HINT_NTA);
    3.41 -        values[0] = *(__m64 *) (src + 0);
    3.42 -        values[1] = *(__m64 *) (src + 8);
    3.43 -        values[2] = *(__m64 *) (src + 16);
    3.44 -        values[3] = *(__m64 *) (src + 24);
    3.45 -        values[4] = *(__m64 *) (src + 32);
    3.46 -        values[5] = *(__m64 *) (src + 40);
    3.47 -        values[6] = *(__m64 *) (src + 48);
    3.48 -        values[7] = *(__m64 *) (src + 56);
    3.49 -        _mm_stream_pi((__m64 *) (dst + 0), values[0]);
    3.50 -        _mm_stream_pi((__m64 *) (dst + 8), values[1]);
    3.51 -        _mm_stream_pi((__m64 *) (dst + 16), values[2]);
    3.52 -        _mm_stream_pi((__m64 *) (dst + 24), values[3]);
    3.53 -        _mm_stream_pi((__m64 *) (dst + 32), values[4]);
    3.54 -        _mm_stream_pi((__m64 *) (dst + 40), values[5]);
    3.55 -        _mm_stream_pi((__m64 *) (dst + 48), values[6]);
    3.56 -        _mm_stream_pi((__m64 *) (dst + 56), values[7]);
    3.57 -        src += 64;
    3.58 -        dst += 64;
    3.59 -    }
    3.60 -
    3.61 -    if (len & 63)
    3.62 -        SDL_memcpy(dst, src, len & 63);
    3.63 -}
    3.64 -#endif /* __MMX__ */
    3.65 -
    3.66 -#ifdef __SSE__
    3.67 -static __inline__ void
    3.68 -SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
    3.69 -{
    3.70 -    int i;
    3.71 -
    3.72 -    __m128 values[4];
    3.73 -    for (i = len / 64; i--;) {
    3.74 -        _mm_prefetch(src, _MM_HINT_NTA);
    3.75 -        values[0] = *(__m128 *) (src + 0);
    3.76 -        values[1] = *(__m128 *) (src + 16);
    3.77 -        values[2] = *(__m128 *) (src + 32);
    3.78 -        values[3] = *(__m128 *) (src + 48);
    3.79 -        _mm_stream_ps((float *) (dst + 0), values[0]);
    3.80 -        _mm_stream_ps((float *) (dst + 16), values[1]);
    3.81 -        _mm_stream_ps((float *) (dst + 32), values[2]);
    3.82 -        _mm_stream_ps((float *) (dst + 48), values[3]);
    3.83 -        src += 64;
    3.84 -        dst += 64;
    3.85 -    }
    3.86 -
    3.87 -    if (len & 63)
    3.88 -        SDL_memcpy(dst, src, len & 63);
    3.89 -}
    3.90 -#endif /* __SSE__ */
    3.91 -
    3.92 -void
    3.93 -SDL_BlitCopy(SDL_BlitInfo * info)
    3.94 -{
    3.95 -    Uint8 *src, *dst;
    3.96 -    int w, h;
    3.97 -    int srcskip, dstskip;
    3.98 -
    3.99 -    w = info->d_width * info->dst->BytesPerPixel;
   3.100 -    h = info->d_height;
   3.101 -    src = info->s_pixels;
   3.102 -    dst = info->d_pixels;
   3.103 -    srcskip = w + info->s_skip;
   3.104 -    dstskip = w + info->d_skip;
   3.105 -
   3.106 -#ifdef __SSE__
   3.107 -    if (SDL_HasSSE() && !((uintptr_t) src & 15) && !((uintptr_t) dst & 15)) {
   3.108 -        while (h--) {
   3.109 -            SDL_memcpySSE(dst, src, w);
   3.110 -            src += srcskip;
   3.111 -            dst += dstskip;
   3.112 -        }
   3.113 -        return;
   3.114 -    }
   3.115 -#endif
   3.116 -
   3.117 -#ifdef __MMX__
   3.118 -    if (SDL_HasMMX() && !((uintptr_t) src & 7) && !((uintptr_t) dst & 7)) {
   3.119 -        while (h--) {
   3.120 -            SDL_memcpyMMX(dst, src, w);
   3.121 -            src += srcskip;
   3.122 -            dst += dstskip;
   3.123 -        }
   3.124 -        _mm_empty();
   3.125 -        return;
   3.126 -    }
   3.127 -#endif
   3.128 -
   3.129 -    while (h--) {
   3.130 -        SDL_memcpy(dst, src, w);
   3.131 -        src += srcskip;
   3.132 -        dst += dstskip;
   3.133 -    }
   3.134 -}
   3.135 -
   3.136 -void
   3.137 -SDL_BlitCopyOverlap(SDL_BlitInfo * info)
   3.138 -{
   3.139 -    Uint8 *src, *dst;
   3.140 -    int w, h;
   3.141 -    int skip;
   3.142 -
   3.143 -    w = info->d_width * info->dst->BytesPerPixel;
   3.144 -    h = info->d_height;
   3.145 -    src = info->s_pixels;
   3.146 -    dst = info->d_pixels;
   3.147 -    skip = w + info->s_skip;
   3.148 -    if ((dst < src) || (dst >= (src + h * skip))) {
   3.149 -        SDL_BlitCopy(info);
   3.150 -    } else {
   3.151 -        src += ((h - 1) * skip);
   3.152 -        dst += ((h - 1) * skip);
   3.153 -        while (h--) {
   3.154 -            SDL_revcpy(dst, src, w);
   3.155 -            src -= skip;
   3.156 -            dst -= skip;
   3.157 -        }
   3.158 -    }
   3.159 -}
   3.160 -
   3.161 -/* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/src/video/SDL_blit_copy.h	Thu Aug 16 06:40:34 2007 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,26 +0,0 @@
     4.4 -/*
     4.5 -    SDL - Simple DirectMedia Layer
     4.6 -    Copyright (C) 1997-2006 Sam Lantinga
     4.7 -
     4.8 -    This library is free software; you can redistribute it and/or
     4.9 -    modify it under the terms of the GNU Lesser General Public
    4.10 -    License as published by the Free Software Foundation; either
    4.11 -    version 2.1 of the License, or (at your option) any later version.
    4.12 -
    4.13 -    This library is distributed in the hope that it will be useful,
    4.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.16 -    Lesser General Public License for more details.
    4.17 -
    4.18 -    You should have received a copy of the GNU Lesser General Public
    4.19 -    License along with this library; if not, write to the Free Software
    4.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    4.21 -
    4.22 -    Sam Lantinga
    4.23 -    slouken@libsdl.org
    4.24 -*/
    4.25 -
    4.26 -void SDL_BlitCopy(SDL_BlitInfo * info);
    4.27 -void SDL_BlitCopyOverlap(SDL_BlitInfo * info);
    4.28 -
    4.29 -/* vi: set ts=4 sw=4 expandtab: */
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/video/SDL_copy.c	Thu Aug 16 21:43:19 2007 +0000
     5.3 @@ -0,0 +1,160 @@
     5.4 +/*
     5.5 +    SDL - Simple DirectMedia Layer
     5.6 +    Copyright (C) 1997-2006 Sam Lantinga
     5.7 +
     5.8 +    This library is free software; you can redistribute it and/or
     5.9 +    modify it under the terms of the GNU Lesser General Public
    5.10 +    License as published by the Free Software Foundation; either
    5.11 +    version 2.1 of the License, or (at your option) any later version.
    5.12 +
    5.13 +    This library is distributed in the hope that it will be useful,
    5.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    5.16 +    Lesser General Public License for more details.
    5.17 +
    5.18 +    You should have received a copy of the GNU Lesser General Public
    5.19 +    License along with this library; if not, write to the Free Software
    5.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    5.21 +
    5.22 +    Sam Lantinga
    5.23 +    slouken@libsdl.org
    5.24 +*/
    5.25 +#include "SDL_config.h"
    5.26 +
    5.27 +#include "SDL_video.h"
    5.28 +#include "SDL_blit.h"
    5.29 +#include "SDL_copy.h"
    5.30 +
    5.31 +
    5.32 +#ifdef __SSE__
    5.33 +/* This assumes 16-byte aligned src and dst */
    5.34 +static __inline__ void
    5.35 +SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
    5.36 +{
    5.37 +    int i;
    5.38 +
    5.39 +    __m128 values[4];
    5.40 +    for (i = len / 64; i--;) {
    5.41 +        _mm_prefetch(src, _MM_HINT_NTA);
    5.42 +        values[0] = *(__m128 *) (src + 0);
    5.43 +        values[1] = *(__m128 *) (src + 16);
    5.44 +        values[2] = *(__m128 *) (src + 32);
    5.45 +        values[3] = *(__m128 *) (src + 48);
    5.46 +        _mm_stream_ps((float *) (dst + 0), values[0]);
    5.47 +        _mm_stream_ps((float *) (dst + 16), values[1]);
    5.48 +        _mm_stream_ps((float *) (dst + 32), values[2]);
    5.49 +        _mm_stream_ps((float *) (dst + 48), values[3]);
    5.50 +        src += 64;
    5.51 +        dst += 64;
    5.52 +    }
    5.53 +
    5.54 +    if (len & 63)
    5.55 +        SDL_memcpy(dst, src, len & 63);
    5.56 +}
    5.57 +#endif /* __SSE__ */
    5.58 +
    5.59 +#ifdef __MMX__
    5.60 +/* This assumes 8-byte aligned src and dst */
    5.61 +static __inline__ void
    5.62 +SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
    5.63 +{
    5.64 +    int i;
    5.65 +
    5.66 +    __m64 values[8];
    5.67 +    for (i = len / 64; i--;) {
    5.68 +        _mm_prefetch(src, _MM_HINT_NTA);
    5.69 +        values[0] = *(__m64 *) (src + 0);
    5.70 +        values[1] = *(__m64 *) (src + 8);
    5.71 +        values[2] = *(__m64 *) (src + 16);
    5.72 +        values[3] = *(__m64 *) (src + 24);
    5.73 +        values[4] = *(__m64 *) (src + 32);
    5.74 +        values[5] = *(__m64 *) (src + 40);
    5.75 +        values[6] = *(__m64 *) (src + 48);
    5.76 +        values[7] = *(__m64 *) (src + 56);
    5.77 +        _mm_stream_pi((__m64 *) (dst + 0), values[0]);
    5.78 +        _mm_stream_pi((__m64 *) (dst + 8), values[1]);
    5.79 +        _mm_stream_pi((__m64 *) (dst + 16), values[2]);
    5.80 +        _mm_stream_pi((__m64 *) (dst + 24), values[3]);
    5.81 +        _mm_stream_pi((__m64 *) (dst + 32), values[4]);
    5.82 +        _mm_stream_pi((__m64 *) (dst + 40), values[5]);
    5.83 +        _mm_stream_pi((__m64 *) (dst + 48), values[6]);
    5.84 +        _mm_stream_pi((__m64 *) (dst + 56), values[7]);
    5.85 +        src += 64;
    5.86 +        dst += 64;
    5.87 +    }
    5.88 +
    5.89 +    if (len & 63)
    5.90 +        SDL_memcpy(dst, src, len & 63);
    5.91 +}
    5.92 +#endif /* __MMX__ */
    5.93 +
    5.94 +void
    5.95 +SDL_BlitCopy(SDL_BlitInfo * info)
    5.96 +{
    5.97 +    Uint8 *src, *dst;
    5.98 +    int w, h;
    5.99 +    int srcskip, dstskip;
   5.100 +
   5.101 +    w = info->d_width * info->dst->BytesPerPixel;
   5.102 +    h = info->d_height;
   5.103 +    src = info->s_pixels;
   5.104 +    dst = info->d_pixels;
   5.105 +    srcskip = w + info->s_skip;
   5.106 +    dstskip = w + info->d_skip;
   5.107 +
   5.108 +#ifdef __SSE__
   5.109 +    if (SDL_HasSSE() && !((uintptr_t) src & 15) && !((uintptr_t) dst & 15)) {
   5.110 +        while (h--) {
   5.111 +            SDL_memcpySSE(dst, src, w);
   5.112 +            src += srcskip;
   5.113 +            dst += dstskip;
   5.114 +        }
   5.115 +        return;
   5.116 +    }
   5.117 +#endif
   5.118 +
   5.119 +#ifdef __MMX__
   5.120 +    if (SDL_HasMMX() && !((uintptr_t) src & 7) && !((uintptr_t) dst & 7)) {
   5.121 +        while (h--) {
   5.122 +            SDL_memcpyMMX(dst, src, w);
   5.123 +            src += srcskip;
   5.124 +            dst += dstskip;
   5.125 +        }
   5.126 +        _mm_empty();
   5.127 +        return;
   5.128 +    }
   5.129 +#endif
   5.130 +
   5.131 +    while (h--) {
   5.132 +        SDL_memcpy(dst, src, w);
   5.133 +        src += srcskip;
   5.134 +        dst += dstskip;
   5.135 +    }
   5.136 +}
   5.137 +
   5.138 +void
   5.139 +SDL_BlitCopyOverlap(SDL_BlitInfo * info)
   5.140 +{
   5.141 +    Uint8 *src, *dst;
   5.142 +    int w, h;
   5.143 +    int skip;
   5.144 +
   5.145 +    w = info->d_width * info->dst->BytesPerPixel;
   5.146 +    h = info->d_height;
   5.147 +    src = info->s_pixels;
   5.148 +    dst = info->d_pixels;
   5.149 +    skip = w + info->s_skip;
   5.150 +    if ((dst < src) || (dst >= (src + h * skip))) {
   5.151 +        SDL_BlitCopy(info);
   5.152 +    } else {
   5.153 +        src += ((h - 1) * skip);
   5.154 +        dst += ((h - 1) * skip);
   5.155 +        while (h--) {
   5.156 +            SDL_revcpy(dst, src, w);
   5.157 +            src -= skip;
   5.158 +            dst -= skip;
   5.159 +        }
   5.160 +    }
   5.161 +}
   5.162 +
   5.163 +/* vi: set ts=4 sw=4 expandtab: */
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/video/SDL_copy.h	Thu Aug 16 21:43:19 2007 +0000
     6.3 @@ -0,0 +1,26 @@
     6.4 +/*
     6.5 +    SDL - Simple DirectMedia Layer
     6.6 +    Copyright (C) 1997-2006 Sam Lantinga
     6.7 +
     6.8 +    This library is free software; you can redistribute it and/or
     6.9 +    modify it under the terms of the GNU Lesser General Public
    6.10 +    License as published by the Free Software Foundation; either
    6.11 +    version 2.1 of the License, or (at your option) any later version.
    6.12 +
    6.13 +    This library is distributed in the hope that it will be useful,
    6.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.16 +    Lesser General Public License for more details.
    6.17 +
    6.18 +    You should have received a copy of the GNU Lesser General Public
    6.19 +    License along with this library; if not, write to the Free Software
    6.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    6.21 +
    6.22 +    Sam Lantinga
    6.23 +    slouken@libsdl.org
    6.24 +*/
    6.25 +
    6.26 +void SDL_BlitCopy(SDL_BlitInfo * info);
    6.27 +void SDL_BlitCopyOverlap(SDL_BlitInfo * info);
    6.28 +
    6.29 +/* vi: set ts=4 sw=4 expandtab: */
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/video/SDL_fill.c	Thu Aug 16 21:43:19 2007 +0000
     7.3 @@ -0,0 +1,365 @@
     7.4 +/*
     7.5 +    SDL - Simple DirectMedia Layer
     7.6 +    Copyright (C) 1997-2006 Sam Lantinga
     7.7 +
     7.8 +    This library is free software; you can redistribute it and/or
     7.9 +    modify it under the terms of the GNU Lesser General Public
    7.10 +    License as published by the Free Software Foundation; either
    7.11 +    version 2.1 of the License, or (at your option) any later version.
    7.12 +
    7.13 +    This library is distributed in the hope that it will be useful,
    7.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.16 +    Lesser General Public License for more details.
    7.17 +
    7.18 +    You should have received a copy of the GNU Lesser General Public
    7.19 +    License along with this library; if not, write to the Free Software
    7.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    7.21 +
    7.22 +    Sam Lantinga
    7.23 +    slouken@libsdl.org
    7.24 +*/
    7.25 +#include "SDL_config.h"
    7.26 +
    7.27 +#include "SDL_video.h"
    7.28 +#include "SDL_blit.h"
    7.29 +
    7.30 +
    7.31 +#ifdef __SSE__
    7.32 +/* *INDENT-OFF* */
    7.33 +
    7.34 +#ifdef _MSC_VER
    7.35 +#define SSE_BEGIN \
    7.36 +    __m128 c128; \
    7.37 +	c128.m128_u32[0] = color; \
    7.38 +	c128.m128_u32[1] = color; \
    7.39 +	c128.m128_u32[2] = color; \
    7.40 +	c128.m128_u32[3] = color;
    7.41 +#else
    7.42 +#define SSE_BEGIN \
    7.43 +    DECLARE_ALIGNED(Uint32, cccc[4], 16); \
    7.44 +    cccc[0] = color; \
    7.45 +    cccc[1] = color; \
    7.46 +    cccc[2] = color; \
    7.47 +    cccc[3] = color; \
    7.48 +    __m128 c128 = *(__m128 *)cccc;
    7.49 +#endif
    7.50 +
    7.51 +#define SSE_WORK \
    7.52 +    for (i = n / 64; i--;) { \
    7.53 +        _mm_stream_ps((float *)(p+0), c128); \
    7.54 +        _mm_stream_ps((float *)(p+16), c128); \
    7.55 +        _mm_stream_ps((float *)(p+32), c128); \
    7.56 +        _mm_stream_ps((float *)(p+48), c128); \
    7.57 +        p += 64; \
    7.58 +    }
    7.59 +
    7.60 +#define SSE_END
    7.61 +
    7.62 +#define DEFINE_SSE_FILLRECT(bpp, type) \
    7.63 +static void \
    7.64 +SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
    7.65 +{ \
    7.66 +    SSE_BEGIN; \
    7.67 + \
    7.68 +    while (h--) { \
    7.69 +        int i, n = w * bpp; \
    7.70 +        Uint8 *p = pixels; \
    7.71 + \
    7.72 +        if (n > 15) { \
    7.73 +            int adjust = 16 - ((uintptr_t)p & 15); \
    7.74 +            if (adjust < 16) { \
    7.75 +                n -= adjust; \
    7.76 +                adjust /= bpp; \
    7.77 +                while(adjust--) { \
    7.78 +                    *((type *)p) = (type)color; \
    7.79 +                    p += bpp; \
    7.80 +                } \
    7.81 +            } \
    7.82 +            SSE_WORK; \
    7.83 +        } \
    7.84 +        if (n & 63) { \
    7.85 +            int remainder = (n & 63); \
    7.86 +            remainder /= bpp; \
    7.87 +            while(remainder--) { \
    7.88 +                *((type *)p) = (type)color; \
    7.89 +                p += bpp; \
    7.90 +            } \
    7.91 +        } \
    7.92 +        pixels += pitch; \
    7.93 +    } \
    7.94 + \
    7.95 +    SSE_END; \
    7.96 +}
    7.97 +
    7.98 +DEFINE_SSE_FILLRECT(1, Uint8)
    7.99 +DEFINE_SSE_FILLRECT(2, Uint16)
   7.100 +DEFINE_SSE_FILLRECT(4, Uint32)
   7.101 +
   7.102 +/* *INDENT-ON* */
   7.103 +#endif /* __SSE__ */
   7.104 +
   7.105 +#ifdef __MMX__
   7.106 +/* *INDENT-OFF* */
   7.107 +
   7.108 +#define MMX_BEGIN \
   7.109 +    __m64 c64 = _mm_set_pi32(color, color)
   7.110 +
   7.111 +#define MMX_WORK \
   7.112 +    for (i = n / 64; i--;) { \
   7.113 +        _mm_stream_pi((__m64 *)(p+0), c64); \
   7.114 +        _mm_stream_pi((__m64 *)(p+8), c64); \
   7.115 +        _mm_stream_pi((__m64 *)(p+16), c64); \
   7.116 +        _mm_stream_pi((__m64 *)(p+24), c64); \
   7.117 +        _mm_stream_pi((__m64 *)(p+32), c64); \
   7.118 +        _mm_stream_pi((__m64 *)(p+40), c64); \
   7.119 +        _mm_stream_pi((__m64 *)(p+48), c64); \
   7.120 +        _mm_stream_pi((__m64 *)(p+56), c64); \
   7.121 +        p += 64; \
   7.122 +    }
   7.123 +
   7.124 +#define MMX_END \
   7.125 +    _mm_empty()
   7.126 +
   7.127 +#define DEFINE_MMX_FILLRECT(bpp, type) \
   7.128 +static void \
   7.129 +SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
   7.130 +{ \
   7.131 +    MMX_BEGIN; \
   7.132 + \
   7.133 +    while (h--) { \
   7.134 +        int i, n = w * bpp; \
   7.135 +        Uint8 *p = pixels; \
   7.136 + \
   7.137 +        if (n > 7) { \
   7.138 +            int adjust = 8 - ((uintptr_t)p & 7); \
   7.139 +            if (adjust < 8) { \
   7.140 +                n -= adjust; \
   7.141 +                adjust /= bpp; \
   7.142 +                while(adjust--) { \
   7.143 +                    *((type *)p) = (type)color; \
   7.144 +                    p += bpp; \
   7.145 +                } \
   7.146 +            } \
   7.147 +            MMX_WORK; \
   7.148 +        } \
   7.149 +        if (n & 63) { \
   7.150 +            int remainder = (n & 63); \
   7.151 +            remainder /= bpp; \
   7.152 +            while(remainder--) { \
   7.153 +                *((type *)p) = (type)color; \
   7.154 +                p += bpp; \
   7.155 +            } \
   7.156 +        } \
   7.157 +        pixels += pitch; \
   7.158 +    } \
   7.159 + \
   7.160 +    MMX_END; \
   7.161 +}
   7.162 +
   7.163 +DEFINE_MMX_FILLRECT(1, Uint8)
   7.164 +DEFINE_MMX_FILLRECT(2, Uint16)
   7.165 +DEFINE_MMX_FILLRECT(4, Uint32)
   7.166 +
   7.167 +/* *INDENT-ON* */
   7.168 +#endif /* __MMX__ */
   7.169 +
   7.170 +static void
   7.171 +SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   7.172 +{
   7.173 +    while (h--) {
   7.174 +        int n = w;
   7.175 +        Uint8 *p = pixels;
   7.176 +
   7.177 +        if (n > 3) {
   7.178 +            switch ((uintptr_t) p & 3) {
   7.179 +            case 1:
   7.180 +                *p++ = (Uint8) color;
   7.181 +                --n;
   7.182 +            case 2:
   7.183 +                *p++ = (Uint8) color;
   7.184 +                --n;
   7.185 +            case 3:
   7.186 +                *p++ = (Uint8) color;
   7.187 +                --n;
   7.188 +            }
   7.189 +            SDL_memset4(p, color, (n >> 2));
   7.190 +        }
   7.191 +        if (n & 3) {
   7.192 +            p += (n & ~3);
   7.193 +            switch (n & 3) {
   7.194 +            case 3:
   7.195 +                *p++ = (Uint8) color;
   7.196 +            case 2:
   7.197 +                *p++ = (Uint8) color;
   7.198 +            case 1:
   7.199 +                *p++ = (Uint8) color;
   7.200 +            }
   7.201 +        }
   7.202 +        pixels += pitch;
   7.203 +    }
   7.204 +}
   7.205 +
   7.206 +static void
   7.207 +SDL_FillRect2(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   7.208 +{
   7.209 +    while (h--) {
   7.210 +        int n = w;
   7.211 +        Uint16 *p = (Uint16 *) pixels;
   7.212 +
   7.213 +        if (n > 1) {
   7.214 +            if ((uintptr_t) p & 2) {
   7.215 +                *p++ = (Uint16) color;
   7.216 +                --n;
   7.217 +            }
   7.218 +            SDL_memset4(p, color, (n >> 1));
   7.219 +        }
   7.220 +        if (n & 1) {
   7.221 +            p[n - 1] = (Uint16) color;
   7.222 +        }
   7.223 +        pixels += pitch;
   7.224 +    }
   7.225 +}
   7.226 +
   7.227 +static void
   7.228 +SDL_FillRect3(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   7.229 +{
   7.230 +    Uint8 r = (Uint8) ((color >> 16) & 0xFF);
   7.231 +    Uint8 g = (Uint8) ((color >> 8) & 0xFF);
   7.232 +    Uint8 b = (Uint8) (color & 0xFF);
   7.233 +
   7.234 +    while (h--) {
   7.235 +        int n = w;
   7.236 +        Uint8 *p = pixels;
   7.237 +
   7.238 +        while (n--) {
   7.239 +            *p++ = r;
   7.240 +            *p++ = g;
   7.241 +            *p++ = b;
   7.242 +        }
   7.243 +        pixels += pitch;
   7.244 +    }
   7.245 +}
   7.246 +
   7.247 +static void
   7.248 +SDL_FillRect4(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   7.249 +{
   7.250 +    while (h--) {
   7.251 +        SDL_memset4(pixels, color, w);
   7.252 +        pixels += pitch;
   7.253 +    }
   7.254 +}
   7.255 +
   7.256 +/* 
   7.257 + * This function performs a fast fill of the given rectangle with 'color'
   7.258 + */
   7.259 +int
   7.260 +SDL_FillRect(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
   7.261 +{
   7.262 +    Uint8 *pixels;
   7.263 +
   7.264 +    /* This function doesn't work on surfaces < 8 bpp */
   7.265 +    if (dst->format->BitsPerPixel < 8) {
   7.266 +        SDL_SetError("SDL_FillRect(): Unsupported surface format");
   7.267 +        return (-1);
   7.268 +    }
   7.269 +
   7.270 +    /* If 'dstrect' == NULL, then fill the whole surface */
   7.271 +    if (dstrect) {
   7.272 +        /* Perform clipping */
   7.273 +        if (!SDL_IntersectRect(dstrect, &dst->clip_rect, dstrect)) {
   7.274 +            return (0);
   7.275 +        }
   7.276 +    } else {
   7.277 +        dstrect = &dst->clip_rect;
   7.278 +    }
   7.279 +
   7.280 +    /* Perform software fill */
   7.281 +    if (!dst->pixels) {
   7.282 +        SDL_SetError("SDL_FillRect(): You must lock the surface");
   7.283 +        return (-1);
   7.284 +    }
   7.285 +
   7.286 +    pixels =
   7.287 +        (Uint8 *) dst->pixels + dstrect->y * dst->pitch +
   7.288 +        dstrect->x * dst->format->BytesPerPixel;
   7.289 +
   7.290 +    switch (dst->format->BytesPerPixel) {
   7.291 +    case 1:
   7.292 +        {
   7.293 +            color |= (color << 8);
   7.294 +            color |= (color << 16);
   7.295 +#ifdef __SSE__
   7.296 +            if (SDL_HasSSE()) {
   7.297 +                SDL_FillRect1SSE(pixels, dst->pitch, color, dstrect->w,
   7.298 +                                 dstrect->h);
   7.299 +                break;
   7.300 +            }
   7.301 +#endif
   7.302 +#ifdef __MMX__
   7.303 +            if (SDL_HasMMX()) {
   7.304 +                SDL_FillRect1MMX(pixels, dst->pitch, color, dstrect->w,
   7.305 +                                 dstrect->h);
   7.306 +                break;
   7.307 +            }
   7.308 +#endif
   7.309 +            SDL_FillRect1(pixels, dst->pitch, color, dstrect->w, dstrect->h);
   7.310 +            break;
   7.311 +        }
   7.312 +
   7.313 +    case 2:
   7.314 +        {
   7.315 +            color |= (color << 16);
   7.316 +#ifdef __SSE__
   7.317 +            if (SDL_HasSSE()) {
   7.318 +                SDL_FillRect2SSE(pixels, dst->pitch, color, dstrect->w,
   7.319 +                                 dstrect->h);
   7.320 +                break;
   7.321 +            }
   7.322 +#endif
   7.323 +#ifdef __MMX__
   7.324 +            if (SDL_HasMMX()) {
   7.325 +                SDL_FillRect2MMX(pixels, dst->pitch, color, dstrect->w,
   7.326 +                                 dstrect->h);
   7.327 +                break;
   7.328 +            }
   7.329 +#endif
   7.330 +            SDL_FillRect2(pixels, dst->pitch, color, dstrect->w, dstrect->h);
   7.331 +            break;
   7.332 +        }
   7.333 +
   7.334 +    case 3:
   7.335 +        /* 24-bit RGB is a slow path, at least for now. */
   7.336 +        {
   7.337 +            SDL_FillRect3(pixels, dst->pitch, color, dstrect->w, dstrect->h);
   7.338 +            break;
   7.339 +        }
   7.340 +
   7.341 +    case 4:
   7.342 +        {
   7.343 +#ifdef __SSE__
   7.344 +            if (SDL_HasSSE()) {
   7.345 +                SDL_FillRect4SSE(pixels, dst->pitch, color, dstrect->w,
   7.346 +                                 dstrect->h);
   7.347 +                break;
   7.348 +            }
   7.349 +#endif
   7.350 +#ifdef __MMX__
   7.351 +            if (SDL_HasMMX()) {
   7.352 +                SDL_FillRect4MMX(pixels, dst->pitch, color, dstrect->w,
   7.353 +                                 dstrect->h);
   7.354 +                break;
   7.355 +            }
   7.356 +#endif
   7.357 +            SDL_FillRect4(pixels, dst->pitch, color, dstrect->w, dstrect->h);
   7.358 +            break;
   7.359 +        }
   7.360 +    }
   7.361 +
   7.362 +    SDL_UnlockSurface(dst);
   7.363 +
   7.364 +    /* We're done! */
   7.365 +    return (0);
   7.366 +}
   7.367 +
   7.368 +/* vi: set ts=4 sw=4 expandtab: */
     8.1 --- a/src/video/SDL_surface.c	Thu Aug 16 06:40:34 2007 +0000
     8.2 +++ b/src/video/SDL_surface.c	Thu Aug 16 21:43:19 2007 +0000
     8.3 @@ -509,342 +509,6 @@
     8.4      return 0;
     8.5  }
     8.6  
     8.7 -#ifdef __SSE__
     8.8 -/* *INDENT-OFF* */
     8.9 -
    8.10 -#ifdef _MSC_VER
    8.11 -#define SSE_BEGIN \
    8.12 -    __m128 c128; \
    8.13 -	c128.m128_u32[0] = color; \
    8.14 -	c128.m128_u32[1] = color; \
    8.15 -	c128.m128_u32[2] = color; \
    8.16 -	c128.m128_u32[3] = color;
    8.17 -#else
    8.18 -#define SSE_BEGIN \
    8.19 -    DECLARE_ALIGNED(Uint32, cccc[4], 16); \
    8.20 -    cccc[0] = color; \
    8.21 -    cccc[1] = color; \
    8.22 -    cccc[2] = color; \
    8.23 -    cccc[3] = color; \
    8.24 -    __m128 c128 = *(__m128 *)cccc;
    8.25 -#endif
    8.26 -
    8.27 -#define SSE_WORK \
    8.28 -    for (i = n / 64; i--;) { \
    8.29 -        _mm_stream_ps((float *)(p+0), c128); \
    8.30 -        _mm_stream_ps((float *)(p+16), c128); \
    8.31 -        _mm_stream_ps((float *)(p+32), c128); \
    8.32 -        _mm_stream_ps((float *)(p+48), c128); \
    8.33 -        p += 64; \
    8.34 -    }
    8.35 -
    8.36 -#define SSE_END
    8.37 -
    8.38 -#define DEFINE_SSE_FILLRECT(bpp, type) \
    8.39 -static void \
    8.40 -SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
    8.41 -{ \
    8.42 -    SSE_BEGIN; \
    8.43 - \
    8.44 -    while (h--) { \
    8.45 -        int i, n = w * bpp; \
    8.46 -        Uint8 *p = pixels; \
    8.47 - \
    8.48 -        if (n > 15) { \
    8.49 -            int adjust = 16 - ((uintptr_t)p & 15); \
    8.50 -            if (adjust < 16) { \
    8.51 -                n -= adjust; \
    8.52 -                adjust /= bpp; \
    8.53 -                while(adjust--) { \
    8.54 -                    *((type *)p) = (type)color; \
    8.55 -                    p += bpp; \
    8.56 -                } \
    8.57 -            } \
    8.58 -            SSE_WORK; \
    8.59 -        } \
    8.60 -        if (n & 63) { \
    8.61 -            int remainder = (n & 63); \
    8.62 -            remainder /= bpp; \
    8.63 -            while(remainder--) { \
    8.64 -                *((type *)p) = (type)color; \
    8.65 -                p += bpp; \
    8.66 -            } \
    8.67 -        } \
    8.68 -        pixels += pitch; \
    8.69 -    } \
    8.70 - \
    8.71 -    SSE_END; \
    8.72 -}
    8.73 -
    8.74 -DEFINE_SSE_FILLRECT(1, Uint8)
    8.75 -DEFINE_SSE_FILLRECT(2, Uint16)
    8.76 -DEFINE_SSE_FILLRECT(4, Uint32)
    8.77 -
    8.78 -/* *INDENT-ON* */
    8.79 -#endif /* __SSE__ */
    8.80 -
    8.81 -#ifdef __MMX__
    8.82 -/* *INDENT-OFF* */
    8.83 -
    8.84 -#define MMX_BEGIN \
    8.85 -    __m64 c64 = _mm_set_pi32(color, color)
    8.86 -
    8.87 -#define MMX_WORK \
    8.88 -    for (i = n / 64; i--;) { \
    8.89 -        _mm_stream_pi((__m64 *)(p+0), c64); \
    8.90 -        _mm_stream_pi((__m64 *)(p+8), c64); \
    8.91 -        _mm_stream_pi((__m64 *)(p+16), c64); \
    8.92 -        _mm_stream_pi((__m64 *)(p+24), c64); \
    8.93 -        _mm_stream_pi((__m64 *)(p+32), c64); \
    8.94 -        _mm_stream_pi((__m64 *)(p+40), c64); \
    8.95 -        _mm_stream_pi((__m64 *)(p+48), c64); \
    8.96 -        _mm_stream_pi((__m64 *)(p+56), c64); \
    8.97 -        p += 64; \
    8.98 -    }
    8.99 -
   8.100 -#define MMX_END \
   8.101 -    _mm_empty()
   8.102 -
   8.103 -#define DEFINE_MMX_FILLRECT(bpp, type) \
   8.104 -static void \
   8.105 -SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
   8.106 -{ \
   8.107 -    MMX_BEGIN; \
   8.108 - \
   8.109 -    while (h--) { \
   8.110 -        int i, n = w * bpp; \
   8.111 -        Uint8 *p = pixels; \
   8.112 - \
   8.113 -        if (n > 7) { \
   8.114 -            int adjust = 8 - ((uintptr_t)p & 7); \
   8.115 -            if (adjust < 8) { \
   8.116 -                n -= adjust; \
   8.117 -                adjust /= bpp; \
   8.118 -                while(adjust--) { \
   8.119 -                    *((type *)p) = (type)color; \
   8.120 -                    p += bpp; \
   8.121 -                } \
   8.122 -            } \
   8.123 -            MMX_WORK; \
   8.124 -        } \
   8.125 -        if (n & 63) { \
   8.126 -            int remainder = (n & 63); \
   8.127 -            remainder /= bpp; \
   8.128 -            while(remainder--) { \
   8.129 -                *((type *)p) = (type)color; \
   8.130 -                p += bpp; \
   8.131 -            } \
   8.132 -        } \
   8.133 -        pixels += pitch; \
   8.134 -    } \
   8.135 - \
   8.136 -    MMX_END; \
   8.137 -}
   8.138 -
   8.139 -DEFINE_MMX_FILLRECT(1, Uint8)
   8.140 -DEFINE_MMX_FILLRECT(2, Uint16)
   8.141 -DEFINE_MMX_FILLRECT(4, Uint32)
   8.142 -
   8.143 -/* *INDENT-ON* */
   8.144 -#endif /* __MMX__ */
   8.145 -
   8.146 -static void
   8.147 -SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   8.148 -{
   8.149 -    while (h--) {
   8.150 -        int n = w;
   8.151 -        Uint8 *p = pixels;
   8.152 -
   8.153 -        if (n > 3) {
   8.154 -            switch ((uintptr_t) p & 3) {
   8.155 -            case 1:
   8.156 -                *p++ = (Uint8) color;
   8.157 -                --n;
   8.158 -            case 2:
   8.159 -                *p++ = (Uint8) color;
   8.160 -                --n;
   8.161 -            case 3:
   8.162 -                *p++ = (Uint8) color;
   8.163 -                --n;
   8.164 -            }
   8.165 -            SDL_memset4(p, color, (n >> 2));
   8.166 -        }
   8.167 -        if (n & 3) {
   8.168 -            p += (n & ~3);
   8.169 -            switch (n & 3) {
   8.170 -            case 3:
   8.171 -                *p++ = (Uint8) color;
   8.172 -            case 2:
   8.173 -                *p++ = (Uint8) color;
   8.174 -            case 1:
   8.175 -                *p++ = (Uint8) color;
   8.176 -            }
   8.177 -        }
   8.178 -        pixels += pitch;
   8.179 -    }
   8.180 -}
   8.181 -
   8.182 -static void
   8.183 -SDL_FillRect2(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   8.184 -{
   8.185 -    while (h--) {
   8.186 -        int n = w;
   8.187 -        Uint16 *p = (Uint16 *) pixels;
   8.188 -
   8.189 -        if (n > 1) {
   8.190 -            if ((uintptr_t) p & 2) {
   8.191 -                *p++ = (Uint16) color;
   8.192 -                --n;
   8.193 -            }
   8.194 -            SDL_memset4(p, color, (n >> 1));
   8.195 -        }
   8.196 -        if (n & 1) {
   8.197 -            p[n - 1] = (Uint16) color;
   8.198 -        }
   8.199 -        pixels += pitch;
   8.200 -    }
   8.201 -}
   8.202 -
   8.203 -static void
   8.204 -SDL_FillRect3(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   8.205 -{
   8.206 -    Uint8 r = (Uint8) (color & 0xFF);
   8.207 -    Uint8 g = (Uint8) ((color >> 8) & 0xFF);
   8.208 -    Uint8 b = (Uint8) ((color >> 16) & 0xFF);
   8.209 -
   8.210 -    while (h--) {
   8.211 -        int n = w;
   8.212 -        Uint8 *p = pixels;
   8.213 -
   8.214 -        while (n--) {
   8.215 -            *p++ = r;
   8.216 -            *p++ = g;
   8.217 -            *p++ = b;
   8.218 -        }
   8.219 -        pixels += pitch;
   8.220 -    }
   8.221 -}
   8.222 -
   8.223 -static void
   8.224 -SDL_FillRect4(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   8.225 -{
   8.226 -    while (h--) {
   8.227 -        SDL_memset4(pixels, color, w);
   8.228 -        pixels += pitch;
   8.229 -    }
   8.230 -}
   8.231 -
   8.232 -/* 
   8.233 - * This function performs a fast fill of the given rectangle with 'color'
   8.234 - */
   8.235 -int
   8.236 -SDL_FillRect(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
   8.237 -{
   8.238 -    Uint8 *pixels;
   8.239 -
   8.240 -    /* This function doesn't work on surfaces < 8 bpp */
   8.241 -    if (dst->format->BitsPerPixel < 8) {
   8.242 -        SDL_SetError("Fill rect on unsupported surface format");
   8.243 -        return (-1);
   8.244 -    }
   8.245 -
   8.246 -    /* If 'dstrect' == NULL, then fill the whole surface */
   8.247 -    if (dstrect) {
   8.248 -        /* Perform clipping */
   8.249 -        if (!SDL_IntersectRect(dstrect, &dst->clip_rect, dstrect)) {
   8.250 -            return (0);
   8.251 -        }
   8.252 -    } else {
   8.253 -        dstrect = &dst->clip_rect;
   8.254 -    }
   8.255 -
   8.256 -    /* Perform software fill */
   8.257 -    if (SDL_LockSurface(dst) != 0) {
   8.258 -        return (-1);
   8.259 -    }
   8.260 -
   8.261 -    pixels =
   8.262 -        (Uint8 *) dst->pixels + dstrect->y * dst->pitch +
   8.263 -        dstrect->x * dst->format->BytesPerPixel;
   8.264 -
   8.265 -    switch (dst->format->BytesPerPixel) {
   8.266 -    case 1:
   8.267 -        {
   8.268 -            color |= (color << 8);
   8.269 -            color |= (color << 16);
   8.270 -#ifdef __SSE__
   8.271 -            if (SDL_HasSSE()) {
   8.272 -                SDL_FillRect1SSE(pixels, dst->pitch, color, dstrect->w,
   8.273 -                                 dstrect->h);
   8.274 -                break;
   8.275 -            }
   8.276 -#endif
   8.277 -#ifdef __MMX__
   8.278 -            if (SDL_HasMMX()) {
   8.279 -                SDL_FillRect1MMX(pixels, dst->pitch, color, dstrect->w,
   8.280 -                                 dstrect->h);
   8.281 -                break;
   8.282 -            }
   8.283 -#endif
   8.284 -            SDL_FillRect1(pixels, dst->pitch, color, dstrect->w, dstrect->h);
   8.285 -            break;
   8.286 -        }
   8.287 -
   8.288 -    case 2:
   8.289 -        {
   8.290 -            color |= (color << 16);
   8.291 -#ifdef __SSE__
   8.292 -            if (SDL_HasSSE()) {
   8.293 -                SDL_FillRect2SSE(pixels, dst->pitch, color, dstrect->w,
   8.294 -                                 dstrect->h);
   8.295 -                break;
   8.296 -            }
   8.297 -#endif
   8.298 -#ifdef __MMX__
   8.299 -            if (SDL_HasMMX()) {
   8.300 -                SDL_FillRect2MMX(pixels, dst->pitch, color, dstrect->w,
   8.301 -                                 dstrect->h);
   8.302 -                break;
   8.303 -            }
   8.304 -#endif
   8.305 -            SDL_FillRect2(pixels, dst->pitch, color, dstrect->w, dstrect->h);
   8.306 -            break;
   8.307 -        }
   8.308 -
   8.309 -    case 3:
   8.310 -        /* 24-bit RGB is a slow path, at least for now. */
   8.311 -        {
   8.312 -            SDL_FillRect3(pixels, dst->pitch, color, dstrect->w, dstrect->h);
   8.313 -            break;
   8.314 -        }
   8.315 -
   8.316 -    case 4:
   8.317 -        {
   8.318 -#ifdef __SSE__
   8.319 -            if (SDL_HasSSE()) {
   8.320 -                SDL_FillRect4SSE(pixels, dst->pitch, color, dstrect->w,
   8.321 -                                 dstrect->h);
   8.322 -                break;
   8.323 -            }
   8.324 -#endif
   8.325 -#ifdef __MMX__
   8.326 -            if (SDL_HasMMX()) {
   8.327 -                SDL_FillRect4MMX(pixels, dst->pitch, color, dstrect->w,
   8.328 -                                 dstrect->h);
   8.329 -                break;
   8.330 -            }
   8.331 -#endif
   8.332 -            SDL_FillRect4(pixels, dst->pitch, color, dstrect->w, dstrect->h);
   8.333 -            break;
   8.334 -        }
   8.335 -    }
   8.336 -
   8.337 -    SDL_UnlockSurface(dst);
   8.338 -
   8.339 -    /* We're done! */
   8.340 -    return (0);
   8.341 -}
   8.342 -
   8.343  /*
   8.344   * Lock a surface to directly access the pixels
   8.345   */