src/video/SDL_blit_N.c
changeset 12583 338b02acfdfc
parent 12582 57b136cff952
child 12586 eb449394ec0e
equal deleted inserted replaced
12582:57b136cff952 12583:338b02acfdfc
  2530     SDL_PixelFormat *dstfmt = info->dst_fmt;
  2530     SDL_PixelFormat *dstfmt = info->dst_fmt;
  2531     int dstbpp = dstfmt->BytesPerPixel;
  2531     int dstbpp = dstfmt->BytesPerPixel;
  2532 
  2532 
  2533     if (dstfmt->Amask) {
  2533     if (dstfmt->Amask) {
  2534         /* SET_ALPHA */
  2534         /* SET_ALPHA */
  2535         unsigned alpha = info->a;
  2535         Uint32 alpha = info->a;
  2536         int alphashift = alpha << 24;
  2536         Uint32 alphashift = alpha << 24;
  2537         while (height--) {
  2537         while (height--) {
  2538             /* *INDENT-OFF* */
  2538             /* *INDENT-OFF* */
  2539             DUFFS_LOOP(
  2539             DUFFS_LOOP(
  2540             {
  2540             {
  2541                 Uint32  *dst32 = (Uint32*)dst;
  2541                 Uint32  *dst32 = (Uint32*)dst;
  2542                 unsigned s0 = src[0];
  2542                 Uint8 s0 = src[0];
  2543                 unsigned s1 = src[1];
  2543                 Uint8 s1 = src[1];
  2544                 unsigned s2 = src[2];
  2544                 Uint8 s2 = src[2];
  2545                 *dst32 = (s0) | (s1 << 8) | (s2 << 16) | alphashift;
  2545                 *dst32 = (s0) | (s1 << 8) | (s2 << 16) | alphashift;
  2546                 dst += dstbpp;
  2546                 dst += dstbpp;
  2547                 src += srcbpp;
  2547                 src += srcbpp;
  2548             }, width);
  2548             }, width);
  2549             /* *INDENT-ON* */
  2549             /* *INDENT-ON* */
  2555         while (height--) {
  2555         while (height--) {
  2556             /* *INDENT-OFF* */
  2556             /* *INDENT-OFF* */
  2557             DUFFS_LOOP(
  2557             DUFFS_LOOP(
  2558             {
  2558             {
  2559                 Uint32  *dst32 = (Uint32*)dst;
  2559                 Uint32  *dst32 = (Uint32*)dst;
  2560                 unsigned s0 = src[0];
  2560                 Uint8 s0 = src[0];
  2561                 unsigned s1 = src[1];
  2561                 Uint8 s1 = src[1];
  2562                 unsigned s2 = src[2];
  2562                 Uint8 s2 = src[2];
  2563                 *dst32 = (s0) | (s1 << 8) | (s2 << 16);
  2563                 *dst32 = (s0) | (s1 << 8) | (s2 << 16);
  2564                 dst += dstbpp;
  2564                 dst += dstbpp;
  2565                 src += srcbpp;
  2565                 src += srcbpp;
  2566             }, width);
  2566             }, width);
  2567             /* *INDENT-ON* */
  2567             /* *INDENT-ON* */
  2595             while (height--) {
  2595             while (height--) {
  2596                 /* *INDENT-OFF* */
  2596                 /* *INDENT-OFF* */
  2597                 DUFFS_LOOP(
  2597                 DUFFS_LOOP(
  2598                 {
  2598                 {
  2599                     Uint32  *dst32 = (Uint32*)dst;
  2599                     Uint32  *dst32 = (Uint32*)dst;
  2600                     unsigned s0 = src[0];
  2600                     Uint8 s0 = src[0];
  2601                     unsigned s1 = src[1];
  2601                     Uint8 s1 = src[1];
  2602                     unsigned s2 = src[2];
  2602                     Uint8 s2 = src[2];
  2603                     unsigned alphashift = src[3] << 24;
  2603                     Uint32 alphashift = src[3] << 24;
  2604                     /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
  2604                     /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
  2605                     *dst32 = (s0 << 16) | (s1 << 8) | (s2) | alphashift;
  2605                     *dst32 = (s0 << 16) | (s1 << 8) | (s2) | alphashift;
  2606                     dst += dstbpp;
  2606                     dst += dstbpp;
  2607                     src += srcbpp;
  2607                     src += srcbpp;
  2608                 }, width);
  2608                 }, width);
  2610                 src += srcskip;
  2610                 src += srcskip;
  2611                 dst += dstskip;
  2611                 dst += dstskip;
  2612             }
  2612             }
  2613         } else {
  2613         } else {
  2614             /* SET_ALPHA */
  2614             /* SET_ALPHA */
  2615             unsigned alpha = info->a;
  2615             Uint32 alpha = info->a;
  2616             int alphashift = alpha << 24;
  2616             Uint32 alphashift = alpha << 24;
  2617             while (height--) {
  2617             while (height--) {
  2618                 /* *INDENT-OFF* */
  2618                 /* *INDENT-OFF* */
  2619                 DUFFS_LOOP(
  2619                 DUFFS_LOOP(
  2620                 {
  2620                 {
  2621                     Uint32  *dst32 = (Uint32*)dst;
  2621                     Uint32  *dst32 = (Uint32*)dst;
  2622                     unsigned s0 = src[0];
  2622                     Uint8 s0 = src[0];
  2623                     unsigned s1 = src[1];
  2623                     Uint8 s1 = src[1];
  2624                     unsigned s2 = src[2];
  2624                     Uint8 s2 = src[2];
  2625                     /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
  2625                     /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
  2626                     *dst32 = (s0 << 16) | (s1 << 8) | (s2) | alphashift;
  2626                     *dst32 = (s0 << 16) | (s1 << 8) | (s2) | alphashift;
  2627                     dst += dstbpp;
  2627                     dst += dstbpp;
  2628                     src += srcbpp;
  2628                     src += srcbpp;
  2629                 }, width);
  2629                 }, width);
  2637         while (height--) {
  2637         while (height--) {
  2638             /* *INDENT-OFF* */
  2638             /* *INDENT-OFF* */
  2639             DUFFS_LOOP(
  2639             DUFFS_LOOP(
  2640             {
  2640             {
  2641                 Uint32  *dst32 = (Uint32*)dst;
  2641                 Uint32  *dst32 = (Uint32*)dst;
  2642                 unsigned s0 = src[0];
  2642                 Uint8 s0 = src[0];
  2643                 unsigned s1 = src[1];
  2643                 Uint8 s1 = src[1];
  2644                 unsigned s2 = src[2];
  2644                 Uint8 s2 = src[2];
  2645                 /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
  2645                 /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
  2646                 *dst32 = (s0 << 16) | (s1 << 8) | (s2);
  2646                 *dst32 = (s0 << 16) | (s1 << 8) | (s2);
  2647                 dst += dstbpp;
  2647                 dst += dstbpp;
  2648                 src += srcbpp;
  2648                 src += srcbpp;
  2649             }, width);
  2649             }, width);