src/video/SDL_blit_N.c
changeset 12599 e9be1aa42927
parent 12586 eb449394ec0e
child 12600 be2c1d4ee0d1
equal deleted inserted replaced
12598:d3acc7299a95 12599:e9be1aa42927
  2337 
  2337 
  2338     /* BPP 4, same rgb */
  2338     /* BPP 4, same rgb */
  2339     if (srcbpp == 4 && dstbpp == 4 && srcfmt->Rmask == dstfmt->Rmask && srcfmt->Gmask == dstfmt->Gmask && srcfmt->Bmask == dstfmt->Bmask) {
  2339     if (srcbpp == 4 && dstbpp == 4 && srcfmt->Rmask == dstfmt->Rmask && srcfmt->Gmask == dstfmt->Gmask && srcfmt->Bmask == dstfmt->Bmask) {
  2340         Uint32 *src32 = (Uint32*)src;
  2340         Uint32 *src32 = (Uint32*)src;
  2341         Uint32 *dst32 = (Uint32*)dst;
  2341         Uint32 *dst32 = (Uint32*)dst;
  2342  
  2342 
  2343         if (dstfmt->Amask) {
  2343         if (dstfmt->Amask) {
  2344             /* RGB->RGBA, SET_ALPHA */
  2344             /* RGB->RGBA, SET_ALPHA */
  2345             Uint32 mask = info->a << dstfmt->Ashift;
  2345             Uint32 mask = info->a << dstfmt->Ashift;
  2346             while (height--) {
  2346             while (height--) {
  2347                 /* *INDENT-OFF* */
  2347                 /* *INDENT-OFF* */
  2439             /* *INDENT-ON* */
  2439             /* *INDENT-ON* */
  2440             src += srcskip;
  2440             src += srcskip;
  2441             dst += dstskip;
  2441             dst += dstskip;
  2442         }
  2442         }
  2443         return;
  2443         return;
  2444     } 
  2444     }
  2445    
  2445 
  2446     while (height--) {
  2446     while (height--) {
  2447         /* *INDENT-OFF* */
  2447         /* *INDENT-OFF* */
  2448         DUFFS_LOOP(
  2448         DUFFS_LOOP(
  2449         {
  2449         {
  2450             Uint32 Pixel;
  2450             Uint32 Pixel;
  2513                 width);
  2513                 width);
  2514                 /* *INDENT-ON* */
  2514                 /* *INDENT-ON* */
  2515                 src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
  2515                 src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
  2516                 dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
  2516                 dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
  2517             }
  2517             }
       
  2518         }
       
  2519         return;
       
  2520     }
       
  2521 
       
  2522     /* Any src/dst 8888 for CopyAlpha, no ARGB2101010 */
       
  2523     if (srcbpp == 4 && dstbpp == 4 &&
       
  2524         srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
       
  2525         dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
       
  2526 
       
  2527         Uint32 *src32 = (Uint32*)src;
       
  2528         Uint32 *dst32 = (Uint32*)dst;
       
  2529 
       
  2530         /* Find the appropriate permutation */
       
  2531         int r, g, b, a;
       
  2532         Pixel = 0x03020100;
       
  2533         RGBA_FROM_PIXEL(Pixel, srcfmt, r, g, b, a);
       
  2534         PIXEL_FROM_RGBA(Pixel, dstfmt, r, g, b, a);
       
  2535         r = Pixel & 0xFF;
       
  2536         g = (Pixel >> 8) & 0xFF;
       
  2537         b = (Pixel >> 16) & 0xFF;
       
  2538         a = (Pixel >> 24) & 0xFF;
       
  2539 
       
  2540         while (height--) {
       
  2541             /* *INDENT-OFF* */
       
  2542             DUFFS_LOOP(
       
  2543             {
       
  2544                 if ((*src32 & rgbmask) != ckey) {
       
  2545                     Uint8 *s8 = src32;
       
  2546                     Uint8 *d8 = dst32;
       
  2547                     d8[0] = s8[r];
       
  2548                     d8[1] = s8[g];
       
  2549                     d8[2] = s8[b];
       
  2550                     d8[3] = s8[a];
       
  2551                 }
       
  2552                 ++src32;
       
  2553                 ++dst32;
       
  2554             }, width);
       
  2555             /* *INDENT-ON* */
       
  2556             src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
       
  2557             dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
  2518         }
  2558         }
  2519         return;
  2559         return;
  2520     }
  2560     }
  2521 
  2561 
  2522     while (height--) {
  2562     while (height--) {