Chromium Code Reviews| 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]; |
| 2516 src_scan[0] = src_b; | 2516 scan[0] = src_b; |
| 2517 src_scan[1] = src_g; | 2517 scan[1] = src_g; |
| 2518 src_scan[2] = src_r; | 2518 scan[2] = src_r; |
| 2519 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2519 RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
| 2520 *dest_scan = | 2520 *dest_scan = |
| 2521 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 2521 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
| 2522 dest_scan++; | 2522 dest_scan++; |
| 2523 *dest_scan = | 2523 *dest_scan = |
| 2524 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 2524 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |
| 2525 dest_scan++; | 2525 dest_scan++; |
| 2526 *dest_scan = | 2526 *dest_scan = |
| 2527 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 2527 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |
| 2528 } else if (blend_type) { | 2528 } else if (blend_type) { |
| 2529 int blended = Blend(blend_type, *dest_scan, src_b); | 2529 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) { | 2576 if (src_alpha == 0) { |
| 2577 dest_scan += 3; | 2577 dest_scan += 3; |
| 2578 dest_alpha_scan++; | 2578 dest_alpha_scan++; |
| 2579 continue; | 2579 continue; |
| 2580 } | 2580 } |
| 2581 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2581 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2582 *dest_alpha_scan++ = dest_alpha; | 2582 *dest_alpha_scan++ = dest_alpha; |
| 2583 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2583 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2584 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2584 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2585 int blended_colors[3]; | 2585 int blended_colors[3]; |
| 2586 uint8_t src_scan[3]; | 2586 uint8_t scan[3]; |
| 2587 src_scan[0] = src_b; | 2587 scan[0] = src_b; |
| 2588 src_scan[1] = src_g; | 2588 scan[1] = src_g; |
| 2589 src_scan[2] = src_r; | 2589 scan[2] = src_r; |
| 2590 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2590 RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
| 2591 *dest_scan = | 2591 *dest_scan = |
| 2592 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 2592 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
| 2593 dest_scan++; | 2593 dest_scan++; |
| 2594 *dest_scan = | 2594 *dest_scan = |
| 2595 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 2595 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |
| 2596 dest_scan++; | 2596 dest_scan++; |
| 2597 *dest_scan = | 2597 *dest_scan = |
| 2598 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 2598 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |
| 2599 dest_scan++; | 2599 dest_scan++; |
| 2600 } else if (blend_type) { | 2600 } 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; | 2637 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 2638 } else { | 2638 } else { |
| 2639 src_alpha = mask_alpha * src_scan[col] / 255; | 2639 src_alpha = mask_alpha * src_scan[col] / 255; |
| 2640 } | 2640 } |
| 2641 if (src_alpha == 0) { | 2641 if (src_alpha == 0) { |
| 2642 dest_scan += Bpp; | 2642 dest_scan += Bpp; |
| 2643 continue; | 2643 continue; |
| 2644 } | 2644 } |
| 2645 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2645 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2646 int blended_colors[3]; | 2646 int blended_colors[3]; |
| 2647 uint8_t src_scan[3]; | 2647 uint8_t scan[3]; |
| 2648 src_scan[0] = src_b; | 2648 scan[0] = src_b; |
| 2649 src_scan[1] = src_g; | 2649 scan[1] = src_g; |
| 2650 src_scan[2] = src_r; | 2650 scan[2] = src_r; |
| 2651 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2651 RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
| 2652 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); | 2652 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); |
| 2653 dest_scan++; | 2653 dest_scan++; |
| 2654 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); | 2654 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); |
| 2655 dest_scan++; | 2655 dest_scan++; |
| 2656 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); | 2656 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); |
| 2657 } else if (blend_type) { | 2657 } else if (blend_type) { |
| 2658 int blended = Blend(blend_type, *dest_scan, src_b); | 2658 int blended = Blend(blend_type, *dest_scan, src_b); |
| 2659 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 2659 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |
| 2660 dest_scan++; | 2660 dest_scan++; |
| 2661 blended = Blend(blend_type, *dest_scan, src_g); | 2661 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) { | 2784 if (back_alpha == 0) { |
| 2785 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); | 2785 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); |
| 2786 dest_scan += 4; | 2786 dest_scan += 4; |
| 2787 continue; | 2787 continue; |
| 2788 } | 2788 } |
| 2789 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2789 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2790 dest_scan[3] = dest_alpha; | 2790 dest_scan[3] = dest_alpha; |
| 2791 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2791 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2792 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2792 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2793 int blended_colors[3]; | 2793 int blended_colors[3]; |
| 2794 uint8_t src_scan[3]; | 2794 uint8_t scan[3]; |
| 2795 src_scan[0] = src_b; | 2795 scan[0] = src_b; |
| 2796 src_scan[1] = src_g; | 2796 scan[1] = src_g; |
| 2797 src_scan[2] = src_r; | 2797 scan[2] = src_r; |
| 2798 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2798 RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
| 2799 *dest_scan = | 2799 *dest_scan = |
| 2800 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 2800 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
| 2801 dest_scan++; | 2801 dest_scan++; |
| 2802 *dest_scan = | 2802 *dest_scan = |
| 2803 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 2803 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |
| 2804 dest_scan++; | 2804 dest_scan++; |
| 2805 *dest_scan = | 2805 *dest_scan = |
| 2806 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 2806 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |
| 2807 } else if (blend_type) { | 2807 } else if (blend_type) { |
| 2808 int blended = Blend(blend_type, *dest_scan, src_b); | 2808 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; | 2859 src_alpha = mask_alpha * clip_scan[col] / 255; |
| 2860 } else { | 2860 } else { |
| 2861 src_alpha = mask_alpha; | 2861 src_alpha = mask_alpha; |
| 2862 } | 2862 } |
| 2863 if (src_alpha == 0) { | 2863 if (src_alpha == 0) { |
| 2864 dest_scan += Bpp; | 2864 dest_scan += Bpp; |
| 2865 continue; | 2865 continue; |
| 2866 } | 2866 } |
| 2867 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2867 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2868 int blended_colors[3]; | 2868 int blended_colors[3]; |
| 2869 uint8_t src_scan[3]; | 2869 uint8_t scan[3]; |
| 2870 src_scan[0] = src_b; | 2870 scan[0] = src_b; |
| 2871 src_scan[1] = src_g; | 2871 scan[1] = src_g; |
| 2872 src_scan[2] = src_r; | 2872 scan[2] = src_r; |
| 2873 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2873 RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
| 2874 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); | 2874 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); |
| 2875 dest_scan++; | 2875 dest_scan++; |
| 2876 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); | 2876 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); |
| 2877 dest_scan++; | 2877 dest_scan++; |
| 2878 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); | 2878 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); |
| 2879 } else if (blend_type) { | 2879 } else if (blend_type) { |
| 2880 int blended = Blend(blend_type, *dest_scan, src_b); | 2880 int blended = Blend(blend_type, *dest_scan, src_b); |
| 2881 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 2881 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |
| 2882 dest_scan++; | 2882 dest_scan++; |
| 2883 blended = Blend(blend_type, *dest_scan, src_g); | 2883 blended = Blend(blend_type, *dest_scan, src_g); |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3577 } | 3577 } |
| 3578 if (src_alpha == 0) { | 3578 if (src_alpha == 0) { |
| 3579 dest_scan += 4; | 3579 dest_scan += 4; |
| 3580 continue; | 3580 continue; |
| 3581 } | 3581 } |
| 3582 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 3582 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3583 dest_scan[3] = dest_alpha; | 3583 dest_scan[3] = dest_alpha; |
| 3584 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3584 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 3585 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 3585 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 3586 int blended_colors[3]; | 3586 int blended_colors[3]; |
| 3587 uint8_t src_scan[3]; | 3587 uint8_t scan[3]; |
| 3588 uint8_t dest_scan_o[3]; | 3588 scan[0] = src_b; |
| 3589 src_scan[0] = src_b; | 3589 scan[1] = src_g; |
| 3590 src_scan[1] = src_g; | 3590 scan[2] = src_r; |
| 3591 src_scan[2] = src_r; | 3591 uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; |
|
Tom Sepez
2016/06/01 22:49:21
nit: can we be consistent about initializer syntax
Wei Li
2016/06/01 23:40:13
Sure, since src_{b,g,r} are of int type, it may no
| |
| 3592 dest_scan_o[0] = dest_scan[2]; | 3592 RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); |
| 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] = | 3593 dest_scan[2] = |
| 3597 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); | 3594 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); |
| 3598 dest_scan[1] = | 3595 dest_scan[1] = |
| 3599 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); | 3596 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); |
| 3600 dest_scan[0] = | 3597 dest_scan[0] = |
| 3601 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); | 3598 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); |
| 3602 } else if (blend_type) { | 3599 } else if (blend_type) { |
| 3603 int blended = Blend(blend_type, dest_scan[2], src_b); | 3600 int blended = Blend(blend_type, dest_scan[2], src_b); |
| 3604 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 3601 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |
| 3605 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); | 3602 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; | 3631 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 3635 } else { | 3632 } else { |
| 3636 src_alpha = mask_alpha * src_scan[col] / 255; | 3633 src_alpha = mask_alpha * src_scan[col] / 255; |
| 3637 } | 3634 } |
| 3638 if (src_alpha == 0) { | 3635 if (src_alpha == 0) { |
| 3639 dest_scan += Bpp; | 3636 dest_scan += Bpp; |
| 3640 continue; | 3637 continue; |
| 3641 } | 3638 } |
| 3642 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 3639 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 3643 int blended_colors[3]; | 3640 int blended_colors[3]; |
| 3644 uint8_t src_scan[3]; | 3641 uint8_t scan[3]; |
| 3645 uint8_t dest_scan_o[3]; | 3642 scan[0] = src_b; |
| 3646 src_scan[0] = src_b; | 3643 scan[1] = src_g; |
| 3647 src_scan[1] = src_g; | 3644 scan[2] = src_r; |
| 3648 src_scan[2] = src_r; | 3645 uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; |
| 3649 dest_scan_o[0] = dest_scan[2]; | 3646 RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); |
| 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] = | 3647 dest_scan[2] = |
| 3654 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); | 3648 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); |
| 3655 dest_scan[1] = | 3649 dest_scan[1] = |
| 3656 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); | 3650 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); |
| 3657 dest_scan[0] = | 3651 dest_scan[0] = |
| 3658 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); | 3652 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); |
| 3659 } else if (blend_type) { | 3653 } else if (blend_type) { |
| 3660 int blended = Blend(blend_type, dest_scan[2], src_b); | 3654 int blended = Blend(blend_type, dest_scan[2], src_b); |
| 3661 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, src_alpha); | 3655 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, src_alpha); |
| 3662 blended = Blend(blend_type, dest_scan[1], src_g); | 3656 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, | 3702 FXARGB_SETRGBORDERDIB(dest_scan, |
| 3709 FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); | 3703 FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); |
| 3710 dest_scan += 4; | 3704 dest_scan += 4; |
| 3711 continue; | 3705 continue; |
| 3712 } | 3706 } |
| 3713 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 3707 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3714 dest_scan[3] = dest_alpha; | 3708 dest_scan[3] = dest_alpha; |
| 3715 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3709 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 3716 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 3710 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 3717 int blended_colors[3]; | 3711 int blended_colors[3]; |
| 3718 uint8_t src_scan[3]; | 3712 uint8_t scan[3]; |
| 3719 uint8_t dest_scan_o[3]; | 3713 scan[0] = src_b; |
| 3720 src_scan[0] = src_b; | 3714 scan[1] = src_g; |
| 3721 src_scan[1] = src_g; | 3715 scan[2] = src_r; |
| 3722 src_scan[2] = src_r; | 3716 uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; |
| 3723 dest_scan_o[0] = dest_scan[2]; | 3717 RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); |
| 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] = | 3718 dest_scan[2] = |
| 3728 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); | 3719 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); |
| 3729 dest_scan[1] = | 3720 dest_scan[1] = |
| 3730 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); | 3721 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); |
| 3731 dest_scan[0] = | 3722 dest_scan[0] = |
| 3732 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); | 3723 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); |
| 3733 } else if (blend_type) { | 3724 } else if (blend_type) { |
| 3734 int blended = Blend(blend_type, dest_scan[2], src_b); | 3725 int blended = Blend(blend_type, dest_scan[2], src_b); |
| 3735 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 3726 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |
| 3736 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); | 3727 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; | 3772 src_alpha = mask_alpha * clip_scan[col] / 255; |
| 3782 } else { | 3773 } else { |
| 3783 src_alpha = mask_alpha; | 3774 src_alpha = mask_alpha; |
| 3784 } | 3775 } |
| 3785 if (src_alpha == 0) { | 3776 if (src_alpha == 0) { |
| 3786 dest_scan += Bpp; | 3777 dest_scan += Bpp; |
| 3787 continue; | 3778 continue; |
| 3788 } | 3779 } |
| 3789 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 3780 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 3790 int blended_colors[3]; | 3781 int blended_colors[3]; |
| 3791 uint8_t src_scan[3]; | 3782 uint8_t scan[3]; |
| 3792 uint8_t dest_scan_o[3]; | 3783 scan[0] = src_b; |
| 3793 src_scan[0] = src_b; | 3784 scan[1] = src_g; |
| 3794 src_scan[1] = src_g; | 3785 scan[2] = src_r; |
| 3795 src_scan[2] = src_r; | 3786 uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; |
| 3796 dest_scan_o[0] = dest_scan[2]; | 3787 RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); |
| 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] = | 3788 dest_scan[2] = |
| 3801 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); | 3789 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); |
| 3802 dest_scan[1] = | 3790 dest_scan[1] = |
| 3803 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); | 3791 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); |
| 3804 dest_scan[0] = | 3792 dest_scan[0] = |
| 3805 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); | 3793 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); |
| 3806 } else if (blend_type) { | 3794 } else if (blend_type) { |
| 3807 int back_color = dest_scan[2]; | 3795 int back_color = dest_scan[2]; |
| 3808 int blended = Blend(blend_type, back_color, src_b); | 3796 int blended = Blend(blend_type, back_color, src_b); |
| 3809 dest_scan[2] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 3797 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++; | 4691 dest_scan++; |
| 4704 } | 4692 } |
| 4705 } | 4693 } |
| 4706 } | 4694 } |
| 4707 return TRUE; | 4695 return TRUE; |
| 4708 } | 4696 } |
| 4709 if (m_bpp == 1) { | 4697 if (m_bpp == 1) { |
| 4710 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); | 4698 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); |
| 4711 int left_shift = rect.left % 8; | 4699 int left_shift = rect.left % 8; |
| 4712 int right_shift = rect.right % 8; | 4700 int right_shift = rect.right % 8; |
| 4713 int width = rect.right / 8 - rect.left / 8; | 4701 int new_width = rect.right / 8 - rect.left / 8; |
| 4714 int index = 0; | 4702 int index = 0; |
| 4715 if (m_pPalette) { | 4703 if (m_pPalette) { |
| 4716 for (int i = 0; i < 2; i++) { | 4704 for (int i = 0; i < 2; i++) { |
| 4717 if (m_pPalette[i] == color) { | 4705 if (m_pPalette[i] == color) { |
| 4718 index = i; | 4706 index = i; |
| 4719 } | 4707 } |
| 4720 } | 4708 } |
| 4721 } else { | 4709 } else { |
| 4722 index = ((uint8_t)color == 0xff) ? 1 : 0; | 4710 index = ((uint8_t)color == 0xff) ? 1 : 0; |
| 4723 } | 4711 } |
| 4724 for (int row = rect.top; row < rect.bottom; row++) { | 4712 for (int row = rect.top; row < rect.bottom; row++) { |
| 4725 uint8_t* dest_scan_top = (uint8_t*)GetScanline(row) + rect.left / 8; | 4713 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; | 4714 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)); | 4715 uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift)); |
| 4728 uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift); | 4716 uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift); |
| 4729 if (width) { | 4717 if (new_width) { |
| 4730 FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, width - 1); | 4718 FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, new_width - 1); |
| 4731 if (!index) { | 4719 if (!index) { |
| 4732 *dest_scan_top &= left_flag; | 4720 *dest_scan_top &= left_flag; |
| 4733 *dest_scan_top_r &= right_flag; | 4721 *dest_scan_top_r &= right_flag; |
| 4734 } else { | 4722 } else { |
| 4735 *dest_scan_top |= ~left_flag; | 4723 *dest_scan_top |= ~left_flag; |
| 4736 *dest_scan_top_r |= ~right_flag; | 4724 *dest_scan_top_r |= ~right_flag; |
| 4737 } | 4725 } |
| 4738 } else { | 4726 } else { |
| 4739 if (!index) { | 4727 if (!index) { |
| 4740 *dest_scan_top &= left_flag | right_flag; | 4728 *dest_scan_top &= left_flag | right_flag; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5050 } | 5038 } |
| 5051 src_alpha_scan = m_pScanlineAlphaV; | 5039 src_alpha_scan = m_pScanlineAlphaV; |
| 5052 dest_alpha_scan = dest_alpha_buf; | 5040 dest_alpha_scan = dest_alpha_buf; |
| 5053 if (dest_alpha_scan) { | 5041 if (dest_alpha_scan) { |
| 5054 for (i = 0; i < m_DestHeight; i++) { | 5042 for (i = 0; i < m_DestHeight; i++) { |
| 5055 *dest_alpha_scan = *src_alpha_scan++; | 5043 *dest_alpha_scan = *src_alpha_scan++; |
| 5056 dest_alpha_scan += y_alpha_step; | 5044 dest_alpha_scan += y_alpha_step; |
| 5057 } | 5045 } |
| 5058 } | 5046 } |
| 5059 } | 5047 } |
| OLD | NEW |