src/video/SDL_blit_N.c
changeset 9583 0bd764eb2b99
parent 8149 681eb46b8ac4
child 9619 b94b6d0bff0f
equal deleted inserted replaced
9582:e0e2e94ce5ea 9583:0bd764eb2b99
  2112             dst = (Uint32 *) ((Uint8 *) dst + dstskip);
  2112             dst = (Uint32 *) ((Uint8 *) dst + dstskip);
  2113         }
  2113         }
  2114     }
  2114     }
  2115 }
  2115 }
  2116 
  2116 
       
  2117 /* blits 32 bit RGBA<->RGBA with both surfaces having the same R,G,B,A fields */
       
  2118 static void
       
  2119 Blit4to4CopyAlpha(SDL_BlitInfo * info)
       
  2120 {
       
  2121     int width = info->dst_w;
       
  2122     int height = info->dst_h;
       
  2123     Uint32 *src = (Uint32 *) info->src;
       
  2124     int srcskip = info->src_skip;
       
  2125     Uint32 *dst = (Uint32 *) info->dst;
       
  2126     int dstskip = info->dst_skip;
       
  2127 
       
  2128     /* RGBA->RGBA, COPY_ALPHA */
       
  2129     while (height--) {
       
  2130         /* *INDENT-OFF* */
       
  2131         DUFFS_LOOP(
       
  2132         {
       
  2133             *dst = *src;
       
  2134             ++dst;
       
  2135             ++src;
       
  2136         },
       
  2137         width);
       
  2138         /* *INDENT-ON* */
       
  2139         src = (Uint32 *) ((Uint8 *) src + srcskip);
       
  2140         dst = (Uint32 *) ((Uint8 *) dst + dstskip);
       
  2141     }
       
  2142 }
       
  2143 
  2117 static void
  2144 static void
  2118 BlitNtoN(SDL_BlitInfo * info)
  2145 BlitNtoN(SDL_BlitInfo * info)
  2119 {
  2146 {
  2120     int width = info->dst_w;
  2147     int width = info->dst_w;
  2121     int height = info->dst_h;
  2148     int height = info->dst_h;
  2560                 } else if (srcfmt->BytesPerPixel == 4 &&
  2587                 } else if (srcfmt->BytesPerPixel == 4 &&
  2561                             dstfmt->BytesPerPixel == 4 &&
  2588                             dstfmt->BytesPerPixel == 4 &&
  2562                             srcfmt->Rmask == dstfmt->Rmask &&
  2589                             srcfmt->Rmask == dstfmt->Rmask &&
  2563                             srcfmt->Gmask == dstfmt->Gmask &&
  2590                             srcfmt->Gmask == dstfmt->Gmask &&
  2564                             srcfmt->Bmask == dstfmt->Bmask) {
  2591                             srcfmt->Bmask == dstfmt->Bmask) {
  2565                     /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
  2592                     if (a_need == COPY_ALPHA) {
  2566                     blitfun = Blit4to4MaskAlpha;
  2593                         if (srcfmt->Amask == dstfmt->Amask) {
       
  2594                             /* Fastpath C fallback: 32bit RGBA<->RGBA blit with matching RGBA */
       
  2595                             blitfun = Blit4to4CopyAlpha;
       
  2596                         } else {
       
  2597                             blitfun = BlitNtoNCopyAlpha;
       
  2598                         }
       
  2599                     } else {
       
  2600                         /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
       
  2601                         blitfun = Blit4to4MaskAlpha;
       
  2602                     }
  2567                 } else if (a_need == COPY_ALPHA) {
  2603                 } else if (a_need == COPY_ALPHA) {
  2568                     blitfun = BlitNtoNCopyAlpha;
  2604                     blitfun = BlitNtoNCopyAlpha;
  2569                 }
  2605                 }
  2570             }
  2606             }
  2571         }
  2607         }