src/video/SDL_fillrect.c
changeset 7680 6ab959ebea26
parent 7679 b1fe132bc6a4
child 7682 f182a912606a
equal deleted inserted replaced
7679:b1fe132bc6a4 7680:6ab959ebea26
   194 }
   194 }
   195 
   195 
   196 static void
   196 static void
   197 SDL_FillRect1MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
   197 SDL_FillRect1MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
   198 {
   198 {
       
   199     int i, n;
       
   200     Uint8 *p = NULL;
       
   201     
   199     MMX_BEGIN;
   202     MMX_BEGIN;
   200 
   203 
   201     while (h--) {
   204     while (h--) {
   202         int i, n = w;
   205         n = w;
   203         Uint8 *p = pixels;
   206         p = pixels;
   204 
   207 
   205         if (n > 63) {
   208         if (n > 63) {
   206             int adjust = 8 - ((uintptr_t)p & 7);
   209             int adjust = 8 - ((uintptr_t)p & 7);
   207             if (adjust) {
   210             if (adjust) {
   208                 n -= adjust;
   211                 n -= adjust;
   229 #endif /* __MMX__ */
   232 #endif /* __MMX__ */
   230 
   233 
   231 static void
   234 static void
   232 SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   235 SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   233 {
   236 {
   234     while (h--) {
   237     int n;
   235         int n = w;
   238     Uint8 *p = NULL;
   236         Uint8 *p = pixels;
   239     
       
   240     while (h--) {
       
   241         n = w;
       
   242         p = pixels;
   237 
   243 
   238         if (n > 3) {
   244         if (n > 3) {
   239             switch ((uintptr_t) p & 3) {
   245             switch ((uintptr_t) p & 3) {
   240             case 1:
   246             case 1:
   241                 *p++ = (Uint8) color;
   247                 *p++ = (Uint8) color;
   265 }
   271 }
   266 
   272 
   267 static void
   273 static void
   268 SDL_FillRect2(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   274 SDL_FillRect2(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   269 {
   275 {
   270     while (h--) {
   276     int n;
   271         int n = w;
   277     Uint8 *p = NULL;
   272         Uint16 *p = (Uint16 *) pixels;
   278     
       
   279     while (h--) {
       
   280         n = w;
       
   281         p = (Uint16 *) pixels;
   273 
   282 
   274         if (n > 1) {
   283         if (n > 1) {
   275             if ((uintptr_t) p & 2) {
   284             if ((uintptr_t) p & 2) {
   276                 *p++ = (Uint16) color;
   285                 *p++ = (Uint16) color;
   277                 --n;
   286                 --n;
   289 SDL_FillRect3(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   298 SDL_FillRect3(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
   290 {
   299 {
   291     Uint8 r = (Uint8) ((color >> 16) & 0xFF);
   300     Uint8 r = (Uint8) ((color >> 16) & 0xFF);
   292     Uint8 g = (Uint8) ((color >> 8) & 0xFF);
   301     Uint8 g = (Uint8) ((color >> 8) & 0xFF);
   293     Uint8 b = (Uint8) (color & 0xFF);
   302     Uint8 b = (Uint8) (color & 0xFF);
   294 
   303     int n;
   295     while (h--) {
   304     Uint8 *p = NULL;
   296         int n = w;
   305 
   297         Uint8 *p = pixels;
   306     while (h--) {
       
   307         n = w;
       
   308         p = pixels;
   298 
   309 
   299         while (n--) {
   310         while (n--) {
   300             *p++ = r;
   311             *p++ = r;
   301             *p++ = g;
   312             *p++ = g;
   302             *p++ = b;
   313             *p++ = b;