src/video/SDL_RLEaccel.c
changeset 9761 fd7fe355f173
parent 9619 b94b6d0bff0f
child 10000 acd714e378f4
equal deleted inserted replaced
9760:2f5a57f86e24 9761:fd7fe355f173
   370                     blitter(4, Uint16, ALPHA_BLIT_ANY);         \
   370                     blitter(4, Uint16, ALPHA_BLIT_ANY);         \
   371                 break;                                          \
   371                 break;                                          \
   372             }                                                   \
   372             }                                                   \
   373         }                                                       \
   373         }                                                       \
   374     } while(0)
   374     } while(0)
       
   375 
       
   376 /*
       
   377  * Set a pixel value using the given format, except that the alpha value is
       
   378  * placed in the top byte. This is the format used for RLE with alpha.
       
   379  */
       
   380 #define RLEPIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)                      \
       
   381 {                                                                       \
       
   382     Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|                             \
       
   383         ((g>>fmt->Gloss)<<fmt->Gshift)|                                 \
       
   384         ((b>>fmt->Bloss)<<fmt->Bshift)|                                 \
       
   385         (a<<24);                                                        \
       
   386 }
   375 
   387 
   376 /*
   388 /*
   377  * This takes care of the case when the surface is clipped on the left and/or
   389  * This takes care of the case when the surface is clipped on the left and/or
   378  * right. Top clipping has already been taken care of.
   390  * right. Top clipping has already been taken care of.
   379  */
   391  */
   980     int i;
   992     int i;
   981     Uint32 *d = dst;
   993     Uint32 *d = dst;
   982     for (i = 0; i < n; i++) {
   994     for (i = 0; i < n; i++) {
   983         unsigned r, g, b, a;
   995         unsigned r, g, b, a;
   984         RGBA_FROM_8888(*src, sfmt, r, g, b, a);
   996         RGBA_FROM_8888(*src, sfmt, r, g, b, a);
   985         PIXEL_FROM_RGBA(*d, dfmt, r, g, b, a);
   997         RLEPIXEL_FROM_RGBA(*d, dfmt, r, g, b, a);
   986         d++;
   998         d++;
   987         src++;
   999         src++;
   988     }
  1000     }
   989     return n * 4;
  1001     return n * 4;
   990 }
  1002 }