src/video/SDL_blit_0.c
changeset 6967 adc80d085ddf
parent 6885 700f1b25f77f
child 7502 6ff02ff3cf06
equal deleted inserted replaced
6966:090df160f6e0 6967:adc80d085ddf
   441         dst += dstskip;
   441         dst += dstskip;
   442     }
   442     }
   443 }
   443 }
   444 
   444 
   445 static const SDL_BlitFunc bitmap_blit[] = {
   445 static const SDL_BlitFunc bitmap_blit[] = {
   446     NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4
   446     (SDL_BlitFunc) NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4
   447 };
   447 };
   448 
   448 
   449 static const SDL_BlitFunc colorkey_blit[] = {
   449 static const SDL_BlitFunc colorkey_blit[] = {
   450     NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key
   450     (SDL_BlitFunc) NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key
   451 };
   451 };
   452 
   452 
   453 SDL_BlitFunc
   453 SDL_BlitFunc
   454 SDL_CalculateBlit0(SDL_Surface * surface)
   454 SDL_CalculateBlit0(SDL_Surface * surface)
   455 {
   455 {
   456     int which;
   456     int which;
   457 
   457 
   458     if (surface->format->BitsPerPixel != 1) {
   458     if (surface->format->BitsPerPixel != 1) {
   459         /* We don't support sub 8-bit packed pixel modes */
   459         /* We don't support sub 8-bit packed pixel modes */
   460         return NULL;
   460         return (SDL_BlitFunc) NULL;
   461     }
   461     }
   462     if (surface->map->dst->format->BitsPerPixel < 8) {
   462     if (surface->map->dst->format->BitsPerPixel < 8) {
   463         which = 0;
   463         which = 0;
   464     } else {
   464     } else {
   465         which = surface->map->dst->format->BytesPerPixel;
   465         which = surface->map->dst->format->BytesPerPixel;
   470 
   470 
   471     case SDL_COPY_COLORKEY:
   471     case SDL_COPY_COLORKEY:
   472         return colorkey_blit[which];
   472         return colorkey_blit[which];
   473 
   473 
   474     case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   474     case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   475         return which >= 2 ? BlitBtoNAlpha : NULL;
   475         return which >= 2 ? BlitBtoNAlpha : (SDL_BlitFunc) NULL;
   476 
   476 
   477     case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   477     case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   478         return which >= 2 ? BlitBtoNAlphaKey : NULL;
   478         return which >= 2 ? BlitBtoNAlphaKey : (SDL_BlitFunc) NULL;
   479     }
   479     }
   480     return NULL;
   480     return (SDL_BlitFunc) NULL;
   481 }
   481 }
   482 
   482 
   483 /* vi: set ts=4 sw=4 expandtab: */
   483 /* vi: set ts=4 sw=4 expandtab: */