src/video/SDL_blit_1.c
changeset 2267 c785543d1843
parent 2262 bee005ace1bf
child 2698 e1da92da346c
     1.1 --- a/src/video/SDL_blit_1.c	Sat Aug 18 01:44:21 2007 +0000
     1.2 +++ b/src/video/SDL_blit_1.c	Sat Aug 18 05:39:09 2007 +0000
     1.3 @@ -42,9 +42,9 @@
     1.4      width = info->dst_w;
     1.5      height = info->dst_h;
     1.6      src = info->src;
     1.7 -    srcskip = info->s_skip;
     1.8 +    srcskip = info->src_skip;
     1.9      dst = info->dst;
    1.10 -    dstskip = info->dst_pitch;
    1.11 +    dstskip = info->dst_skip;
    1.12      map = info->table;
    1.13  
    1.14      while (height--) {
    1.15 @@ -93,9 +93,9 @@
    1.16      width = info->dst_w;
    1.17      height = info->dst_h;
    1.18      src = info->src;
    1.19 -    srcskip = info->s_skip;
    1.20 +    srcskip = info->src_skip;
    1.21      dst = info->dst;
    1.22 -    dstskip = info->dst_pitch;
    1.23 +    dstskip = info->dst_skip;
    1.24      map = (Uint16 *) info->table;
    1.25  
    1.26  #ifdef USE_DUFFS_LOOP
    1.27 @@ -199,9 +199,9 @@
    1.28      width = info->dst_w;
    1.29      height = info->dst_h;
    1.30      src = info->src;
    1.31 -    srcskip = info->s_skip;
    1.32 +    srcskip = info->src_skip;
    1.33      dst = info->dst;
    1.34 -    dstskip = info->dst_pitch;
    1.35 +    dstskip = info->dst_skip;
    1.36      map = info->table;
    1.37  
    1.38      while (height--) {
    1.39 @@ -247,9 +247,9 @@
    1.40      width = info->dst_w;
    1.41      height = info->dst_h;
    1.42      src = info->src;
    1.43 -    srcskip = info->s_skip;
    1.44 +    srcskip = info->src_skip;
    1.45      dst = (Uint32 *) info->dst;
    1.46 -    dstskip = info->dst_pitch / 4;
    1.47 +    dstskip = info->dst_skip / 4;
    1.48      map = (Uint32 *) info->table;
    1.49  
    1.50      while (height--) {
    1.51 @@ -286,11 +286,11 @@
    1.52      int width = info->dst_w;
    1.53      int height = info->dst_h;
    1.54      Uint8 *src = info->src;
    1.55 -    int srcskip = info->s_skip;
    1.56 +    int srcskip = info->src_skip;
    1.57      Uint8 *dst = info->dst;
    1.58 -    int dstskip = info->dst_pitch;
    1.59 +    int dstskip = info->dst_skip;
    1.60      Uint8 *palmap = info->table;
    1.61 -    Uint32 ckey = info->ckey;
    1.62 +    Uint32 ckey = info->colorkey;
    1.63  
    1.64      if (palmap) {
    1.65          while (height--) {
    1.66 @@ -333,11 +333,11 @@
    1.67      int width = info->dst_w;
    1.68      int height = info->dst_h;
    1.69      Uint8 *src = info->src;
    1.70 -    int srcskip = info->s_skip;
    1.71 +    int srcskip = info->src_skip;
    1.72      Uint16 *dstp = (Uint16 *) info->dst;
    1.73 -    int dstskip = info->dst_pitch;
    1.74 +    int dstskip = info->dst_skip;
    1.75      Uint16 *palmap = (Uint16 *) info->table;
    1.76 -    Uint32 ckey = info->ckey;
    1.77 +    Uint32 ckey = info->colorkey;
    1.78  
    1.79      /* Set up some basic variables */
    1.80      dstskip /= 2;
    1.81 @@ -365,11 +365,11 @@
    1.82      int width = info->dst_w;
    1.83      int height = info->dst_h;
    1.84      Uint8 *src = info->src;
    1.85 -    int srcskip = info->s_skip;
    1.86 +    int srcskip = info->src_skip;
    1.87      Uint8 *dst = info->dst;
    1.88 -    int dstskip = info->dst_pitch;
    1.89 +    int dstskip = info->dst_skip;
    1.90      Uint8 *palmap = info->table;
    1.91 -    Uint32 ckey = info->ckey;
    1.92 +    Uint32 ckey = info->colorkey;
    1.93      int o;
    1.94  
    1.95      while (height--) {
    1.96 @@ -398,11 +398,11 @@
    1.97      int width = info->dst_w;
    1.98      int height = info->dst_h;
    1.99      Uint8 *src = info->src;
   1.100 -    int srcskip = info->s_skip;
   1.101 +    int srcskip = info->src_skip;
   1.102      Uint32 *dstp = (Uint32 *) info->dst;
   1.103 -    int dstskip = info->dst_pitch;
   1.104 +    int dstskip = info->dst_skip;
   1.105      Uint32 *palmap = (Uint32 *) info->table;
   1.106 -    Uint32 ckey = info->ckey;
   1.107 +    Uint32 ckey = info->colorkey;
   1.108  
   1.109      /* Set up some basic variables */
   1.110      dstskip /= 4;
   1.111 @@ -430,13 +430,13 @@
   1.112      int width = info->dst_w;
   1.113      int height = info->dst_h;
   1.114      Uint8 *src = info->src;
   1.115 -    int srcskip = info->s_skip;
   1.116 +    int srcskip = info->src_skip;
   1.117      Uint8 *dst = info->dst;
   1.118 -    int dstskip = info->dst_pitch;
   1.119 -    SDL_PixelFormat *dstfmt = info->dst;
   1.120 -    const SDL_Color *srcpal = info->src->palette->colors;
   1.121 +    int dstskip = info->dst_skip;
   1.122 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.123 +    const SDL_Color *srcpal = info->src_fmt->palette->colors;
   1.124      int dstbpp;
   1.125 -    const int A = (info->cmod >> 24);
   1.126 +    const int A = info->a;
   1.127  
   1.128      /* Set up some basic variables */
   1.129      dstbpp = dstfmt->BytesPerPixel;
   1.130 @@ -471,15 +471,15 @@
   1.131      int width = info->dst_w;
   1.132      int height = info->dst_h;
   1.133      Uint8 *src = info->src;
   1.134 -    int srcskip = info->s_skip;
   1.135 +    int srcskip = info->src_skip;
   1.136      Uint8 *dst = info->dst;
   1.137 -    int dstskip = info->dst_pitch;
   1.138 -    SDL_PixelFormat *srcfmt = info->src;
   1.139 -    SDL_PixelFormat *dstfmt = info->dst;
   1.140 -    const SDL_Color *srcpal = info->src->palette->colors;
   1.141 -    Uint32 ckey = info->ckey;
   1.142 +    int dstskip = info->dst_skip;
   1.143 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.144 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.145 +    const SDL_Color *srcpal = info->src_fmt->palette->colors;
   1.146 +    Uint32 ckey = info->colorkey;
   1.147      int dstbpp;
   1.148 -    const int A = (info->cmod >> 24);
   1.149 +    const int A = info->a;
   1.150  
   1.151      /* Set up some basic variables */
   1.152      dstbpp = dstfmt->BytesPerPixel;
   1.153 @@ -510,16 +510,16 @@
   1.154      }
   1.155  }
   1.156  
   1.157 -static SDL_loblit one_blit[] = {
   1.158 +static SDL_BlitFunc one_blit[] = {
   1.159      NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4
   1.160  };
   1.161  
   1.162 -static SDL_loblit one_blitkey[] = {
   1.163 +static SDL_BlitFunc one_blitkey[] = {
   1.164      NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key
   1.165  };
   1.166  
   1.167 -SDL_loblit
   1.168 -SDL_CalculateBlit1(SDL_Surface * surface, int blit_index)
   1.169 +SDL_BlitFunc
   1.170 +SDL_CalculateBlit1(SDL_Surface * surface)
   1.171  {
   1.172      int which;
   1.173      SDL_PixelFormat *dstfmt;
   1.174 @@ -530,22 +530,21 @@
   1.175      } else {
   1.176          which = dstfmt->BytesPerPixel;
   1.177      }
   1.178 -    switch (blit_index) {
   1.179 -    case 0:                    /* copy */
   1.180 +    switch (surface->map->info.flags) {
   1.181 +    case 0:
   1.182          return one_blit[which];
   1.183  
   1.184 -    case 1:                    /* colorkey */
   1.185 +    case SDL_COPY_COLORKEY:
   1.186          return one_blitkey[which];
   1.187  
   1.188 -    case 2:                    /* alpha */
   1.189 +    case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   1.190          /* Supporting 8bpp->8bpp alpha is doable but requires lots of
   1.191             tables which consume space and takes time to precompute,
   1.192             so is better left to the user */
   1.193          return which >= 2 ? Blit1toNAlpha : NULL;
   1.194  
   1.195 -    case 3:                    /* alpha + colorkey */
   1.196 +    case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   1.197          return which >= 2 ? Blit1toNAlphaKey : NULL;
   1.198 -
   1.199      }
   1.200      return NULL;
   1.201  }