| OLD | NEW | 
|     1 // Copyright 2014 PDFium Authors. All rights reserved. |     1 // Copyright 2014 PDFium Authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |     5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 
|     6  |     6  | 
|     7 #include "core/fxcodec/include/fx_codec.h" |     7 #include "core/fxcodec/include/fx_codec.h" | 
|     8 #include "core/fxge/dib/dib_int.h" |     8 #include "core/fxge/dib/dib_int.h" | 
|     9 #include "core/fxge/include/fx_ge.h" |     9 #include "core/fxge/include/fx_ge.h" | 
|    10  |    10  | 
| (...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2505     } |  2505     } | 
|  2506     if (src_alpha == 0) { |  2506     if (src_alpha == 0) { | 
|  2507       dest_scan += 4; |  2507       dest_scan += 4; | 
|  2508       continue; |  2508       continue; | 
|  2509     } |  2509     } | 
|  2510     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |  2510     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 
|  2511     dest_scan[3] = dest_alpha; |  2511     dest_scan[3] = dest_alpha; | 
|  2512     int alpha_ratio = src_alpha * 255 / dest_alpha; |  2512     int alpha_ratio = src_alpha * 255 / dest_alpha; | 
|  2513     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  2513     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  2514       int blended_colors[3]; |  2514       int blended_colors[3]; | 
|  2515       uint8_t src_scan[3]; |  2515       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  2516       src_scan[0] = src_b; |  2516                          static_cast<uint8_t>(src_g), | 
|  2517       src_scan[1] = src_g; |  2517                          static_cast<uint8_t>(src_r)}; | 
|  2518       src_scan[2] = src_r; |  2518       RGB_Blend(blend_type, scan, dest_scan, blended_colors); | 
|  2519       RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |  | 
|  2520       *dest_scan = |  2519       *dest_scan = | 
|  2521           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |  2520           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 
|  2522       dest_scan++; |  2521       dest_scan++; | 
|  2523       *dest_scan = |  2522       *dest_scan = | 
|  2524           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |  2523           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 
|  2525       dest_scan++; |  2524       dest_scan++; | 
|  2526       *dest_scan = |  2525       *dest_scan = | 
|  2527           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |  2526           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 
|  2528     } else if (blend_type) { |  2527     } else if (blend_type) { | 
|  2529       int blended = Blend(blend_type, *dest_scan, src_b); |  2528       int blended = Blend(blend_type, *dest_scan, src_b); | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2576     if (src_alpha == 0) { |  2575     if (src_alpha == 0) { | 
|  2577       dest_scan += 3; |  2576       dest_scan += 3; | 
|  2578       dest_alpha_scan++; |  2577       dest_alpha_scan++; | 
|  2579       continue; |  2578       continue; | 
|  2580     } |  2579     } | 
|  2581     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |  2580     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 
|  2582     *dest_alpha_scan++ = dest_alpha; |  2581     *dest_alpha_scan++ = dest_alpha; | 
|  2583     int alpha_ratio = src_alpha * 255 / dest_alpha; |  2582     int alpha_ratio = src_alpha * 255 / dest_alpha; | 
|  2584     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  2583     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  2585       int blended_colors[3]; |  2584       int blended_colors[3]; | 
|  2586       uint8_t src_scan[3]; |  2585       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  2587       src_scan[0] = src_b; |  2586                          static_cast<uint8_t>(src_g), | 
|  2588       src_scan[1] = src_g; |  2587                          static_cast<uint8_t>(src_r)}; | 
|  2589       src_scan[2] = src_r; |  2588       RGB_Blend(blend_type, scan, dest_scan, blended_colors); | 
|  2590       RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |  | 
|  2591       *dest_scan = |  2589       *dest_scan = | 
|  2592           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |  2590           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 
|  2593       dest_scan++; |  2591       dest_scan++; | 
|  2594       *dest_scan = |  2592       *dest_scan = | 
|  2595           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |  2593           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 
|  2596       dest_scan++; |  2594       dest_scan++; | 
|  2597       *dest_scan = |  2595       *dest_scan = | 
|  2598           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |  2596           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 
|  2599       dest_scan++; |  2597       dest_scan++; | 
|  2600     } else if (blend_type) { |  2598     } else if (blend_type) { | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2637       src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |  2635       src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 
|  2638     } else { |  2636     } else { | 
|  2639       src_alpha = mask_alpha * src_scan[col] / 255; |  2637       src_alpha = mask_alpha * src_scan[col] / 255; | 
|  2640     } |  2638     } | 
|  2641     if (src_alpha == 0) { |  2639     if (src_alpha == 0) { | 
|  2642       dest_scan += Bpp; |  2640       dest_scan += Bpp; | 
|  2643       continue; |  2641       continue; | 
|  2644     } |  2642     } | 
|  2645     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  2643     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  2646       int blended_colors[3]; |  2644       int blended_colors[3]; | 
|  2647       uint8_t src_scan[3]; |  2645       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  2648       src_scan[0] = src_b; |  2646                          static_cast<uint8_t>(src_g), | 
|  2649       src_scan[1] = src_g; |  2647                          static_cast<uint8_t>(src_r)}; | 
|  2650       src_scan[2] = src_r; |  2648       RGB_Blend(blend_type, scan, dest_scan, blended_colors); | 
|  2651       RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |  | 
|  2652       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); |  2649       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); | 
|  2653       dest_scan++; |  2650       dest_scan++; | 
|  2654       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); |  2651       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); | 
|  2655       dest_scan++; |  2652       dest_scan++; | 
|  2656       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); |  2653       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); | 
|  2657     } else if (blend_type) { |  2654     } else if (blend_type) { | 
|  2658       int blended = Blend(blend_type, *dest_scan, src_b); |  2655       int blended = Blend(blend_type, *dest_scan, src_b); | 
|  2659       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |  2656       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 
|  2660       dest_scan++; |  2657       dest_scan++; | 
|  2661       blended = Blend(blend_type, *dest_scan, src_g); |  2658       blended = Blend(blend_type, *dest_scan, src_g); | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2784     if (back_alpha == 0) { |  2781     if (back_alpha == 0) { | 
|  2785       FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); |  2782       FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); | 
|  2786       dest_scan += 4; |  2783       dest_scan += 4; | 
|  2787       continue; |  2784       continue; | 
|  2788     } |  2785     } | 
|  2789     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |  2786     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 
|  2790     dest_scan[3] = dest_alpha; |  2787     dest_scan[3] = dest_alpha; | 
|  2791     int alpha_ratio = src_alpha * 255 / dest_alpha; |  2788     int alpha_ratio = src_alpha * 255 / dest_alpha; | 
|  2792     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  2789     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  2793       int blended_colors[3]; |  2790       int blended_colors[3]; | 
|  2794       uint8_t src_scan[3]; |  2791       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  2795       src_scan[0] = src_b; |  2792                          static_cast<uint8_t>(src_g), | 
|  2796       src_scan[1] = src_g; |  2793                          static_cast<uint8_t>(src_r)}; | 
|  2797       src_scan[2] = src_r; |  2794       RGB_Blend(blend_type, scan, dest_scan, blended_colors); | 
|  2798       RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |  | 
|  2799       *dest_scan = |  2795       *dest_scan = | 
|  2800           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |  2796           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 
|  2801       dest_scan++; |  2797       dest_scan++; | 
|  2802       *dest_scan = |  2798       *dest_scan = | 
|  2803           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |  2799           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 
|  2804       dest_scan++; |  2800       dest_scan++; | 
|  2805       *dest_scan = |  2801       *dest_scan = | 
|  2806           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |  2802           FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 
|  2807     } else if (blend_type) { |  2803     } else if (blend_type) { | 
|  2808       int blended = Blend(blend_type, *dest_scan, src_b); |  2804       int blended = Blend(blend_type, *dest_scan, src_b); | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2859       src_alpha = mask_alpha * clip_scan[col] / 255; |  2855       src_alpha = mask_alpha * clip_scan[col] / 255; | 
|  2860     } else { |  2856     } else { | 
|  2861       src_alpha = mask_alpha; |  2857       src_alpha = mask_alpha; | 
|  2862     } |  2858     } | 
|  2863     if (src_alpha == 0) { |  2859     if (src_alpha == 0) { | 
|  2864       dest_scan += Bpp; |  2860       dest_scan += Bpp; | 
|  2865       continue; |  2861       continue; | 
|  2866     } |  2862     } | 
|  2867     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  2863     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  2868       int blended_colors[3]; |  2864       int blended_colors[3]; | 
|  2869       uint8_t src_scan[3]; |  2865       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  2870       src_scan[0] = src_b; |  2866                          static_cast<uint8_t>(src_g), | 
|  2871       src_scan[1] = src_g; |  2867                          static_cast<uint8_t>(src_r)}; | 
|  2872       src_scan[2] = src_r; |  2868       RGB_Blend(blend_type, scan, dest_scan, blended_colors); | 
|  2873       RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |  | 
|  2874       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); |  2869       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); | 
|  2875       dest_scan++; |  2870       dest_scan++; | 
|  2876       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); |  2871       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); | 
|  2877       dest_scan++; |  2872       dest_scan++; | 
|  2878       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); |  2873       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); | 
|  2879     } else if (blend_type) { |  2874     } else if (blend_type) { | 
|  2880       int blended = Blend(blend_type, *dest_scan, src_b); |  2875       int blended = Blend(blend_type, *dest_scan, src_b); | 
|  2881       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |  2876       *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 
|  2882       dest_scan++; |  2877       dest_scan++; | 
|  2883       blended = Blend(blend_type, *dest_scan, src_g); |  2878       blended = Blend(blend_type, *dest_scan, src_g); | 
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3577     } |  3572     } | 
|  3578     if (src_alpha == 0) { |  3573     if (src_alpha == 0) { | 
|  3579       dest_scan += 4; |  3574       dest_scan += 4; | 
|  3580       continue; |  3575       continue; | 
|  3581     } |  3576     } | 
|  3582     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |  3577     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 
|  3583     dest_scan[3] = dest_alpha; |  3578     dest_scan[3] = dest_alpha; | 
|  3584     int alpha_ratio = src_alpha * 255 / dest_alpha; |  3579     int alpha_ratio = src_alpha * 255 / dest_alpha; | 
|  3585     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  3580     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  3586       int blended_colors[3]; |  3581       int blended_colors[3]; | 
|  3587       uint8_t src_scan[3]; |  3582       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  3588       uint8_t dest_scan_o[3]; |  3583                          static_cast<uint8_t>(src_g), | 
|  3589       src_scan[0] = src_b; |  3584                          static_cast<uint8_t>(src_r)}; | 
|  3590       src_scan[1] = src_g; |  3585       uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; | 
|  3591       src_scan[2] = src_r; |  3586       RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); | 
|  3592       dest_scan_o[0] = dest_scan[2]; |  | 
|  3593       dest_scan_o[1] = dest_scan[1]; |  | 
|  3594       dest_scan_o[2] = dest_scan[0]; |  | 
|  3595       RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |  | 
|  3596       dest_scan[2] = |  3587       dest_scan[2] = | 
|  3597           FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); |  3588           FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); | 
|  3598       dest_scan[1] = |  3589       dest_scan[1] = | 
|  3599           FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); |  3590           FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); | 
|  3600       dest_scan[0] = |  3591       dest_scan[0] = | 
|  3601           FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); |  3592           FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); | 
|  3602     } else if (blend_type) { |  3593     } else if (blend_type) { | 
|  3603       int blended = Blend(blend_type, dest_scan[2], src_b); |  3594       int blended = Blend(blend_type, dest_scan[2], src_b); | 
|  3604       blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |  3595       blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 
|  3605       dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); |  3596       dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|  3634       src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |  3625       src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 
|  3635     } else { |  3626     } else { | 
|  3636       src_alpha = mask_alpha * src_scan[col] / 255; |  3627       src_alpha = mask_alpha * src_scan[col] / 255; | 
|  3637     } |  3628     } | 
|  3638     if (src_alpha == 0) { |  3629     if (src_alpha == 0) { | 
|  3639       dest_scan += Bpp; |  3630       dest_scan += Bpp; | 
|  3640       continue; |  3631       continue; | 
|  3641     } |  3632     } | 
|  3642     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  3633     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  3643       int blended_colors[3]; |  3634       int blended_colors[3]; | 
|  3644       uint8_t src_scan[3]; |  3635       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  3645       uint8_t dest_scan_o[3]; |  3636                          static_cast<uint8_t>(src_g), | 
|  3646       src_scan[0] = src_b; |  3637                          static_cast<uint8_t>(src_r)}; | 
|  3647       src_scan[1] = src_g; |  3638       uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; | 
|  3648       src_scan[2] = src_r; |  3639       RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); | 
|  3649       dest_scan_o[0] = dest_scan[2]; |  | 
|  3650       dest_scan_o[1] = dest_scan[1]; |  | 
|  3651       dest_scan_o[2] = dest_scan[0]; |  | 
|  3652       RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |  | 
|  3653       dest_scan[2] = |  3640       dest_scan[2] = | 
|  3654           FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); |  3641           FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); | 
|  3655       dest_scan[1] = |  3642       dest_scan[1] = | 
|  3656           FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); |  3643           FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); | 
|  3657       dest_scan[0] = |  3644       dest_scan[0] = | 
|  3658           FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); |  3645           FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); | 
|  3659     } else if (blend_type) { |  3646     } else if (blend_type) { | 
|  3660       int blended = Blend(blend_type, dest_scan[2], src_b); |  3647       int blended = Blend(blend_type, dest_scan[2], src_b); | 
|  3661       dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, src_alpha); |  3648       dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, src_alpha); | 
|  3662       blended = Blend(blend_type, dest_scan[1], src_g); |  3649       blended = Blend(blend_type, dest_scan[1], src_g); | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3708       FXARGB_SETRGBORDERDIB(dest_scan, |  3695       FXARGB_SETRGBORDERDIB(dest_scan, | 
|  3709                             FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); |  3696                             FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); | 
|  3710       dest_scan += 4; |  3697       dest_scan += 4; | 
|  3711       continue; |  3698       continue; | 
|  3712     } |  3699     } | 
|  3713     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |  3700     uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 
|  3714     dest_scan[3] = dest_alpha; |  3701     dest_scan[3] = dest_alpha; | 
|  3715     int alpha_ratio = src_alpha * 255 / dest_alpha; |  3702     int alpha_ratio = src_alpha * 255 / dest_alpha; | 
|  3716     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  3703     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  3717       int blended_colors[3]; |  3704       int blended_colors[3]; | 
|  3718       uint8_t src_scan[3]; |  3705       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  3719       uint8_t dest_scan_o[3]; |  3706                          static_cast<uint8_t>(src_g), | 
|  3720       src_scan[0] = src_b; |  3707                          static_cast<uint8_t>(src_r)}; | 
|  3721       src_scan[1] = src_g; |  3708       uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; | 
|  3722       src_scan[2] = src_r; |  3709       RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); | 
|  3723       dest_scan_o[0] = dest_scan[2]; |  | 
|  3724       dest_scan_o[1] = dest_scan[1]; |  | 
|  3725       dest_scan_o[2] = dest_scan[0]; |  | 
|  3726       RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |  | 
|  3727       dest_scan[2] = |  3710       dest_scan[2] = | 
|  3728           FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); |  3711           FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); | 
|  3729       dest_scan[1] = |  3712       dest_scan[1] = | 
|  3730           FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); |  3713           FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); | 
|  3731       dest_scan[0] = |  3714       dest_scan[0] = | 
|  3732           FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); |  3715           FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); | 
|  3733     } else if (blend_type) { |  3716     } else if (blend_type) { | 
|  3734       int blended = Blend(blend_type, dest_scan[2], src_b); |  3717       int blended = Blend(blend_type, dest_scan[2], src_b); | 
|  3735       blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |  3718       blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 
|  3736       dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); |  3719       dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3781       src_alpha = mask_alpha * clip_scan[col] / 255; |  3764       src_alpha = mask_alpha * clip_scan[col] / 255; | 
|  3782     } else { |  3765     } else { | 
|  3783       src_alpha = mask_alpha; |  3766       src_alpha = mask_alpha; | 
|  3784     } |  3767     } | 
|  3785     if (src_alpha == 0) { |  3768     if (src_alpha == 0) { | 
|  3786       dest_scan += Bpp; |  3769       dest_scan += Bpp; | 
|  3787       continue; |  3770       continue; | 
|  3788     } |  3771     } | 
|  3789     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |  3772     if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 
|  3790       int blended_colors[3]; |  3773       int blended_colors[3]; | 
|  3791       uint8_t src_scan[3]; |  3774       uint8_t scan[3] = {static_cast<uint8_t>(src_b), | 
|  3792       uint8_t dest_scan_o[3]; |  3775                          static_cast<uint8_t>(src_g), | 
|  3793       src_scan[0] = src_b; |  3776                          static_cast<uint8_t>(src_r)}; | 
|  3794       src_scan[1] = src_g; |  3777       uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; | 
|  3795       src_scan[2] = src_r; |  3778       RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); | 
|  3796       dest_scan_o[0] = dest_scan[2]; |  | 
|  3797       dest_scan_o[1] = dest_scan[1]; |  | 
|  3798       dest_scan_o[2] = dest_scan[0]; |  | 
|  3799       RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |  | 
|  3800       dest_scan[2] = |  3779       dest_scan[2] = | 
|  3801           FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); |  3780           FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); | 
|  3802       dest_scan[1] = |  3781       dest_scan[1] = | 
|  3803           FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); |  3782           FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); | 
|  3804       dest_scan[0] = |  3783       dest_scan[0] = | 
|  3805           FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); |  3784           FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); | 
|  3806     } else if (blend_type) { |  3785     } else if (blend_type) { | 
|  3807       int back_color = dest_scan[2]; |  3786       int back_color = dest_scan[2]; | 
|  3808       int blended = Blend(blend_type, back_color, src_b); |  3787       int blended = Blend(blend_type, back_color, src_b); | 
|  3809       dest_scan[2] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |  3788       dest_scan[2] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4703           dest_scan++; |  4682           dest_scan++; | 
|  4704         } |  4683         } | 
|  4705       } |  4684       } | 
|  4706     } |  4685     } | 
|  4707     return TRUE; |  4686     return TRUE; | 
|  4708   } |  4687   } | 
|  4709   if (m_bpp == 1) { |  4688   if (m_bpp == 1) { | 
|  4710     ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); |  4689     ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); | 
|  4711     int left_shift = rect.left % 8; |  4690     int left_shift = rect.left % 8; | 
|  4712     int right_shift = rect.right % 8; |  4691     int right_shift = rect.right % 8; | 
|  4713     int width = rect.right / 8 - rect.left / 8; |  4692     int new_width = rect.right / 8 - rect.left / 8; | 
|  4714     int index = 0; |  4693     int index = 0; | 
|  4715     if (m_pPalette) { |  4694     if (m_pPalette) { | 
|  4716       for (int i = 0; i < 2; i++) { |  4695       for (int i = 0; i < 2; i++) { | 
|  4717         if (m_pPalette[i] == color) { |  4696         if (m_pPalette[i] == color) { | 
|  4718           index = i; |  4697           index = i; | 
|  4719         } |  4698         } | 
|  4720       } |  4699       } | 
|  4721     } else { |  4700     } else { | 
|  4722       index = ((uint8_t)color == 0xff) ? 1 : 0; |  4701       index = ((uint8_t)color == 0xff) ? 1 : 0; | 
|  4723     } |  4702     } | 
|  4724     for (int row = rect.top; row < rect.bottom; row++) { |  4703     for (int row = rect.top; row < rect.bottom; row++) { | 
|  4725       uint8_t* dest_scan_top = (uint8_t*)GetScanline(row) + rect.left / 8; |  4704       uint8_t* dest_scan_top = (uint8_t*)GetScanline(row) + rect.left / 8; | 
|  4726       uint8_t* dest_scan_top_r = (uint8_t*)GetScanline(row) + rect.right / 8; |  4705       uint8_t* dest_scan_top_r = (uint8_t*)GetScanline(row) + rect.right / 8; | 
|  4727       uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift)); |  4706       uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift)); | 
|  4728       uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift); |  4707       uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift); | 
|  4729       if (width) { |  4708       if (new_width) { | 
|  4730         FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, width - 1); |  4709         FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, new_width - 1); | 
|  4731         if (!index) { |  4710         if (!index) { | 
|  4732           *dest_scan_top &= left_flag; |  4711           *dest_scan_top &= left_flag; | 
|  4733           *dest_scan_top_r &= right_flag; |  4712           *dest_scan_top_r &= right_flag; | 
|  4734         } else { |  4713         } else { | 
|  4735           *dest_scan_top |= ~left_flag; |  4714           *dest_scan_top |= ~left_flag; | 
|  4736           *dest_scan_top_r |= ~right_flag; |  4715           *dest_scan_top_r |= ~right_flag; | 
|  4737         } |  4716         } | 
|  4738       } else { |  4717       } else { | 
|  4739         if (!index) { |  4718         if (!index) { | 
|  4740           *dest_scan_top &= left_flag | right_flag; |  4719           *dest_scan_top &= left_flag | right_flag; | 
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5050   } |  5029   } | 
|  5051   src_alpha_scan = m_pScanlineAlphaV; |  5030   src_alpha_scan = m_pScanlineAlphaV; | 
|  5052   dest_alpha_scan = dest_alpha_buf; |  5031   dest_alpha_scan = dest_alpha_buf; | 
|  5053   if (dest_alpha_scan) { |  5032   if (dest_alpha_scan) { | 
|  5054     for (i = 0; i < m_DestHeight; i++) { |  5033     for (i = 0; i < m_DestHeight; i++) { | 
|  5055       *dest_alpha_scan = *src_alpha_scan++; |  5034       *dest_alpha_scan = *src_alpha_scan++; | 
|  5056       dest_alpha_scan += y_alpha_step; |  5035       dest_alpha_scan += y_alpha_step; | 
|  5057     } |  5036     } | 
|  5058   } |  5037   } | 
|  5059 } |  5038 } | 
| OLD | NEW |