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 "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
8 #include "../../../include/fxcodec/fx_codec.h" | 8 #include "../../../include/fxcodec/fx_codec.h" |
9 #include "dib_int.h" | 9 #include "dib_int.h" |
10 const uint8_t g_GammaRamp[256] = { | 10 const uint8_t g_GammaRamp[256] = { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 301 } |
302 } | 302 } |
303 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int p
ixel_count, int blend_type, const uint8_t* clip_scan, | 303 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int p
ixel_count, int blend_type, const uint8_t* clip_scan, |
304 const uint8_t* src_alpha_scan, uint8_t* dst_alpha_
scan, void* pIccTransform) | 304 const uint8_t* src_alpha_scan, uint8_t* dst_alpha_
scan, void* pIccTransform) |
305 { | 305 { |
306 ICodec_IccModule* pIccModule = NULL; | 306 ICodec_IccModule* pIccModule = NULL; |
307 if (pIccTransform) { | 307 if (pIccTransform) { |
308 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 308 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
309 } | 309 } |
310 if (blend_type) { | 310 if (blend_type) { |
311 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 311 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
312 int blended_color; | 312 int blended_color; |
313 if (src_alpha_scan) { | 313 if (src_alpha_scan) { |
314 for (int col = 0; col < pixel_count; col ++) { | 314 for (int col = 0; col < pixel_count; col ++) { |
315 uint8_t back_alpha = *dst_alpha_scan; | 315 uint8_t back_alpha = *dst_alpha_scan; |
316 if (back_alpha == 0) { | 316 if (back_alpha == 0) { |
317 int src_alpha = *src_alpha_scan++; | 317 int src_alpha = *src_alpha_scan++; |
318 if (clip_scan) { | 318 if (clip_scan) { |
319 src_alpha = clip_scan[col] * src_alpha / 255; | 319 src_alpha = clip_scan[col] * src_alpha / 255; |
320 } | 320 } |
321 if (src_alpha) { | 321 if (src_alpha) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_scan,
int pixel_count, | 496 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_scan,
int pixel_count, |
497 int blend_type, const uint8_t* clip_scan, | 497 int blend_type, const uint8_t* clip_scan, |
498 const uint8_t* src_alpha_scan, void* pIccTra
nsform) | 498 const uint8_t* src_alpha_scan, void* pIccTra
nsform) |
499 { | 499 { |
500 ICodec_IccModule* pIccModule = NULL; | 500 ICodec_IccModule* pIccModule = NULL; |
501 uint8_t gray; | 501 uint8_t gray; |
502 if (pIccTransform) { | 502 if (pIccTransform) { |
503 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 503 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
504 } | 504 } |
505 if (blend_type) { | 505 if (blend_type) { |
506 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 506 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
507 int blended_color; | 507 int blended_color; |
508 if (src_alpha_scan) { | 508 if (src_alpha_scan) { |
509 for (int col = 0; col < pixel_count; col ++) { | 509 for (int col = 0; col < pixel_count; col ++) { |
510 int src_alpha = *src_alpha_scan++; | 510 int src_alpha = *src_alpha_scan++; |
511 if (clip_scan) { | 511 if (clip_scan) { |
512 src_alpha = clip_scan[col] * src_alpha / 255; | 512 src_alpha = clip_scan[col] * src_alpha / 255; |
513 } | 513 } |
514 if (src_alpha) { | 514 if (src_alpha) { |
515 if (pIccTransform) { | 515 if (pIccTransform) { |
516 pIccModule->TranslateScanline(pIccTransform, &gray, src_
scan, 1); | 516 pIccModule->TranslateScanline(pIccTransform, &gray, src_
scan, 1); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_scan,
int src_Bpp, int pixel_count, | 587 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_scan,
int src_Bpp, int pixel_count, |
588 int blend_type, const uint8_t* clip_scan, | 588 int blend_type, const uint8_t* clip_scan, |
589 void* pIccTransform) | 589 void* pIccTransform) |
590 { | 590 { |
591 ICodec_IccModule* pIccModule = NULL; | 591 ICodec_IccModule* pIccModule = NULL; |
592 uint8_t gray; | 592 uint8_t gray; |
593 if (pIccTransform) { | 593 if (pIccTransform) { |
594 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 594 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
595 } | 595 } |
596 if (blend_type) { | 596 if (blend_type) { |
597 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 597 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
598 int blended_color; | 598 int blended_color; |
599 for (int col = 0; col < pixel_count; col ++) { | 599 for (int col = 0; col < pixel_count; col ++) { |
600 if (pIccTransform) { | 600 if (pIccTransform) { |
601 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1)
; | 601 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1)
; |
602 } else { | 602 } else { |
603 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 603 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
604 } | 604 } |
605 if (bNonseparableBlend) { | 605 if (bNonseparableBlend) { |
606 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d
est_scan; | 606 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d
est_scan; |
607 } | 607 } |
(...skipping 26 matching lines...) Expand all Loading... |
634 void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int sr
c_Bpp, int pixel_count, | 634 void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int sr
c_Bpp, int pixel_count, |
635 int blend_type, const uint8_t* clip_scan, | 635 int blend_type, const uint8_t* clip_scan, |
636 uint8_t* dest_alpha_scan, void* pIccTransform) | 636 uint8_t* dest_alpha_scan, void* pIccTransform) |
637 { | 637 { |
638 ICodec_IccModule* pIccModule = NULL; | 638 ICodec_IccModule* pIccModule = NULL; |
639 if (pIccTransform) { | 639 if (pIccTransform) { |
640 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 640 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
641 } | 641 } |
642 if (blend_type) { | 642 if (blend_type) { |
643 int blended_color; | 643 int blended_color; |
644 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 644 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
645 for (int col = 0; col < pixel_count; col ++) { | 645 for (int col = 0; col < pixel_count; col ++) { |
646 int back_alpha = *dest_alpha_scan; | 646 int back_alpha = *dest_alpha_scan; |
647 if (back_alpha == 0) { | 647 if (back_alpha == 0) { |
648 if (pIccTransform) { | 648 if (pIccTransform) { |
649 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_
scan, 1); | 649 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_
scan, 1); |
650 } else { | 650 } else { |
651 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan)
; | 651 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan)
; |
652 } | 652 } |
653 dest_scan ++; | 653 dest_scan ++; |
654 dest_alpha_scan++; | 654 dest_alpha_scan++; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 } | 718 } |
719 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 719 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
720 dest_scan ++; | 720 dest_scan ++; |
721 src_scan += src_Bpp; | 721 src_scan += src_Bpp; |
722 } | 722 } |
723 } | 723 } |
724 void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pi
xel_count, int blend_type, const uint8_t* clip_scan, | 724 void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pi
xel_count, int blend_type, const uint8_t* clip_scan, |
725 uint8_t* dest_alpha_scan, const uint8_t* src_alpha_
scan) | 725 uint8_t* dest_alpha_scan, const uint8_t* src_alpha_
scan) |
726 { | 726 { |
727 int blended_colors[3]; | 727 int blended_colors[3]; |
728 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 728 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
729 if (dest_alpha_scan == NULL) { | 729 if (dest_alpha_scan == NULL) { |
730 if (src_alpha_scan == NULL) { | 730 if (src_alpha_scan == NULL) { |
731 uint8_t back_alpha = 0; | 731 uint8_t back_alpha = 0; |
732 for (int col = 0; col < pixel_count; col ++) { | 732 for (int col = 0; col < pixel_count; col ++) { |
733 back_alpha = dest_scan[3]; | 733 back_alpha = dest_scan[3]; |
734 if (back_alpha == 0) { | 734 if (back_alpha == 0) { |
735 if (clip_scan) { | 735 if (clip_scan) { |
736 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 736 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
737 FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xff
ffff) | (src_alpha << 24)); | 737 FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xff
ffff) | (src_alpha << 24)); |
738 } else { | 738 } else { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 } | 925 } |
926 src_scan ++; | 926 src_scan ++; |
927 } | 927 } |
928 } | 928 } |
929 } | 929 } |
930 } | 930 } |
931 void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_
scan, int width, int blend_type, int src_Bpp, | 931 void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_
scan, int width, int blend_type, int src_Bpp, |
932 uint8_t* dest_alpha_scan) | 932 uint8_t* dest_alpha_scan) |
933 { | 933 { |
934 int blended_colors[3]; | 934 int blended_colors[3]; |
935 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 935 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
936 int src_gap = src_Bpp - 3; | 936 int src_gap = src_Bpp - 3; |
937 if (dest_alpha_scan == NULL) { | 937 if (dest_alpha_scan == NULL) { |
938 for (int col = 0; col < width; col ++) { | 938 for (int col = 0; col < width; col ++) { |
939 uint8_t back_alpha = dest_scan[3]; | 939 uint8_t back_alpha = dest_scan[3]; |
940 if (back_alpha == 0) { | 940 if (back_alpha == 0) { |
941 if (src_Bpp == 4) { | 941 if (src_Bpp == 4) { |
942 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan
)); | 942 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan
)); |
943 } else { | 943 } else { |
944 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_
scan[1], src_scan[0])); | 944 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_
scan[1], src_scan[0])); |
945 } | 945 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 src_scan ++; | 986 src_scan ++; |
987 } | 987 } |
988 src_scan += src_gap; | 988 src_scan += src_gap; |
989 } | 989 } |
990 } | 990 } |
991 } | 991 } |
992 inline void _CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, const uint8_t*
src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan, | 992 inline void _CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, const uint8_t*
src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan, |
993 uint8_t* dest_alpha_scan) | 993 uint8_t* dest_alpha_scan) |
994 { | 994 { |
995 int blended_colors[3]; | 995 int blended_colors[3]; |
996 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 996 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
997 int src_gap = src_Bpp - 3; | 997 int src_gap = src_Bpp - 3; |
998 if (dest_alpha_scan == NULL) { | 998 if (dest_alpha_scan == NULL) { |
999 for (int col = 0; col < width; col ++) { | 999 for (int col = 0; col < width; col ++) { |
1000 int src_alpha = *clip_scan ++; | 1000 int src_alpha = *clip_scan ++; |
1001 uint8_t back_alpha = dest_scan[3]; | 1001 uint8_t back_alpha = dest_scan[3]; |
1002 if (back_alpha == 0) { | 1002 if (back_alpha == 0) { |
1003 *dest_scan++ = *src_scan++; | 1003 *dest_scan++ = *src_scan++; |
1004 *dest_scan++ = *src_scan++; | 1004 *dest_scan++ = *src_scan++; |
1005 *dest_scan++ = *src_scan++; | 1005 *dest_scan++ = *src_scan++; |
1006 src_scan += src_gap; | 1006 src_scan += src_gap; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 *dest_scan++ = *src_scan++; | 1150 *dest_scan++ = *src_scan++; |
1151 *dest_alpha_scan++ = 0xff; | 1151 *dest_alpha_scan++ = 0xff; |
1152 src_scan += src_gap; | 1152 src_scan += src_gap; |
1153 } | 1153 } |
1154 } | 1154 } |
1155 } | 1155 } |
1156 inline void _CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, const uint8_t* src_
scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan, | 1156 inline void _CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, const uint8_t* src_
scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan, |
1157 const uint8_t* src_alpha_scan) | 1157 const uint8_t* src_alpha_scan) |
1158 { | 1158 { |
1159 int blended_colors[3]; | 1159 int blended_colors[3]; |
1160 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1160 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1161 int dest_gap = dest_Bpp - 3; | 1161 int dest_gap = dest_Bpp - 3; |
1162 if (src_alpha_scan == NULL) { | 1162 if (src_alpha_scan == NULL) { |
1163 for (int col = 0; col < width; col ++) { | 1163 for (int col = 0; col < width; col ++) { |
1164 uint8_t src_alpha; | 1164 uint8_t src_alpha; |
1165 if (clip_scan) { | 1165 if (clip_scan) { |
1166 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 1166 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
1167 } else { | 1167 } else { |
1168 src_alpha = src_scan[3]; | 1168 src_alpha = src_scan[3]; |
1169 } | 1169 } |
1170 if (src_alpha == 0) { | 1170 if (src_alpha == 0) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 dest_scan ++; | 1272 dest_scan ++; |
1273 src_scan ++; | 1273 src_scan ++; |
1274 } | 1274 } |
1275 dest_scan += dest_gap; | 1275 dest_scan += dest_gap; |
1276 } | 1276 } |
1277 } | 1277 } |
1278 } | 1278 } |
1279 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t
* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) | 1279 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t
* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) |
1280 { | 1280 { |
1281 int blended_colors[3]; | 1281 int blended_colors[3]; |
1282 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1282 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1283 int dest_gap = dest_Bpp - 3; | 1283 int dest_gap = dest_Bpp - 3; |
1284 int src_gap = src_Bpp - 3; | 1284 int src_gap = src_Bpp - 3; |
1285 for (int col = 0; col < width; col ++) { | 1285 for (int col = 0; col < width; col ++) { |
1286 if (bNonseparableBlend) { | 1286 if (bNonseparableBlend) { |
1287 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1287 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
1288 } | 1288 } |
1289 for (int color = 0; color < 3; color ++) { | 1289 for (int color = 0; color < 3; color ++) { |
1290 int back_color = *dest_scan; | 1290 int back_color = *dest_scan; |
1291 int src_color = *src_scan; | 1291 int src_color = *src_scan; |
1292 int blended = bNonseparableBlend ? blended_colors[color] : | 1292 int blended = bNonseparableBlend ? blended_colors[color] : |
1293 _BLEND(blend_type, back_color, src_color); | 1293 _BLEND(blend_type, back_color, src_color); |
1294 *dest_scan = blended; | 1294 *dest_scan = blended; |
1295 dest_scan ++; | 1295 dest_scan ++; |
1296 src_scan ++; | 1296 src_scan ++; |
1297 } | 1297 } |
1298 dest_scan += dest_gap; | 1298 dest_scan += dest_gap; |
1299 src_scan += src_gap; | 1299 src_scan += src_gap; |
1300 } | 1300 } |
1301 } | 1301 } |
1302 inline void _CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, const uint8_t*
src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* c
lip_scan) | 1302 inline void _CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, const uint8_t*
src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* c
lip_scan) |
1303 { | 1303 { |
1304 int blended_colors[3]; | 1304 int blended_colors[3]; |
1305 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1305 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1306 int dest_gap = dest_Bpp - 3; | 1306 int dest_gap = dest_Bpp - 3; |
1307 int src_gap = src_Bpp - 3; | 1307 int src_gap = src_Bpp - 3; |
1308 for (int col = 0; col < width; col ++) { | 1308 for (int col = 0; col < width; col ++) { |
1309 uint8_t src_alpha = *clip_scan ++; | 1309 uint8_t src_alpha = *clip_scan ++; |
1310 if (src_alpha == 0) { | 1310 if (src_alpha == 0) { |
1311 dest_scan += dest_Bpp; | 1311 dest_scan += dest_Bpp; |
1312 src_scan += src_Bpp; | 1312 src_scan += src_Bpp; |
1313 continue; | 1313 continue; |
1314 } | 1314 } |
1315 if (bNonseparableBlend) { | 1315 if (bNonseparableBlend) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 } else { | 1386 } else { |
1387 if (dest_alpha_scan == NULL) { | 1387 if (dest_alpha_scan == NULL) { |
1388 for (int col = 0; col < pixel_count; col ++) { | 1388 for (int col = 0; col < pixel_count; col ++) { |
1389 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1389 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1390 dp[3] = src_scan[3]; | 1390 dp[3] = src_scan[3]; |
1391 src_scan += 4; | 1391 src_scan += 4; |
1392 dp += 4; | 1392 dp += 4; |
1393 } | 1393 } |
1394 } else { | 1394 } else { |
1395 int blended_colors[3]; | 1395 int blended_colors[3]; |
1396 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1396 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1397 for (int col = 0; col < pixel_count; col ++) { | 1397 for (int col = 0; col < pixel_count; col ++) { |
1398 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src
_scan, 1); | 1398 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src
_scan, 1); |
1399 uint8_t back_alpha = *dest_alpha_scan; | 1399 uint8_t back_alpha = *dest_alpha_scan; |
1400 if (back_alpha == 0) { | 1400 if (back_alpha == 0) { |
1401 if (clip_scan) { | 1401 if (clip_scan) { |
1402 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 1402 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
1403 *dest_alpha_scan = src_alpha; | 1403 *dest_alpha_scan = src_alpha; |
1404 *dest_scan++ = *src_cache_scan++; | 1404 *dest_scan++ = *src_cache_scan++; |
1405 *dest_scan++ = *src_cache_scan++; | 1405 *dest_scan++ = *src_cache_scan++; |
1406 *dest_scan++ = *src_cache_scan++; | 1406 *dest_scan++ = *src_cache_scan++; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, d
est_alpha_scan); | 1516 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, d
est_alpha_scan); |
1517 } | 1517 } |
1518 inline void _CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, const uin
t8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_sca
n, | 1518 inline void _CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, const uin
t8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_sca
n, |
1519 const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransf
orm) | 1519 const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransf
orm) |
1520 { | 1520 { |
1521 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1521 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1522 if (src_alpha_scan) { | 1522 if (src_alpha_scan) { |
1523 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1523 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1524 } else { | 1524 } else { |
1525 int blended_colors[3]; | 1525 int blended_colors[3]; |
1526 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1526 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1527 int dest_gap = dest_Bpp - 3; | 1527 int dest_gap = dest_Bpp - 3; |
1528 for (int col = 0; col < width; col ++) { | 1528 for (int col = 0; col < width; col ++) { |
1529 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_sca
n, 1); | 1529 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_sca
n, 1); |
1530 uint8_t src_alpha; | 1530 uint8_t src_alpha; |
1531 if (clip_scan) { | 1531 if (clip_scan) { |
1532 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 1532 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
1533 } else { | 1533 } else { |
1534 src_alpha = src_scan[3]; | 1534 src_alpha = src_scan[3]; |
1535 } | 1535 } |
1536 src_scan += 4; | 1536 src_scan += 4; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 } | 1659 } |
1660 } | 1660 } |
1661 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bp
p, 3, clip_scan); | 1661 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bp
p, 3, clip_scan); |
1662 } | 1662 } |
1663 inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc
an, const uint8_t* pPalette, int pixel_count, | 1663 inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc
an, const uint8_t* pPalette, int pixel_count, |
1664 int blend_type, const uint8_t* clip_scan, | 1664 int blend_type, const uint8_t* clip_scan, |
1665 const uint8_t* src_alpha_scan) | 1665 const uint8_t* src_alpha_scan) |
1666 { | 1666 { |
1667 if (src_alpha_scan) { | 1667 if (src_alpha_scan) { |
1668 if (blend_type) { | 1668 if (blend_type) { |
1669 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1669 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1670 int blended_color; | 1670 int blended_color; |
1671 for (int col = 0; col < pixel_count; col ++) { | 1671 for (int col = 0; col < pixel_count; col ++) { |
1672 uint8_t gray = pPalette[*src_scan]; | 1672 uint8_t gray = pPalette[*src_scan]; |
1673 int src_alpha = *src_alpha_scan++; | 1673 int src_alpha = *src_alpha_scan++; |
1674 if (clip_scan) { | 1674 if (clip_scan) { |
1675 src_alpha = clip_scan[col] * src_alpha / 255; | 1675 src_alpha = clip_scan[col] * src_alpha / 255; |
1676 } | 1676 } |
1677 if (bNonseparableBlend) { | 1677 if (bNonseparableBlend) { |
1678 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray
: *dest_scan; | 1678 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray
: *dest_scan; |
1679 } | 1679 } |
(...skipping 17 matching lines...) Expand all Loading... |
1697 if (src_alpha) { | 1697 if (src_alpha) { |
1698 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 1698 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
1699 } else { | 1699 } else { |
1700 *dest_scan = gray; | 1700 *dest_scan = gray; |
1701 } | 1701 } |
1702 dest_scan ++; | 1702 dest_scan ++; |
1703 src_scan ++; | 1703 src_scan ++; |
1704 } | 1704 } |
1705 } else { | 1705 } else { |
1706 if (blend_type) { | 1706 if (blend_type) { |
1707 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1707 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1708 int blended_color; | 1708 int blended_color; |
1709 for (int col = 0; col < pixel_count; col ++) { | 1709 for (int col = 0; col < pixel_count; col ++) { |
1710 uint8_t gray = pPalette[*src_scan]; | 1710 uint8_t gray = pPalette[*src_scan]; |
1711 if (bNonseparableBlend) { | 1711 if (bNonseparableBlend) { |
1712 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray
: *dest_scan; | 1712 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray
: *dest_scan; |
1713 } | 1713 } |
1714 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *
dest_scan, gray); | 1714 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *
dest_scan, gray); |
1715 if (clip_scan && clip_scan[col] < 255) { | 1715 if (clip_scan && clip_scan[col] < 255) { |
1716 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[c
ol]); | 1716 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[c
ol]); |
1717 } else { | 1717 } else { |
(...skipping 15 matching lines...) Expand all Loading... |
1733 src_scan ++; | 1733 src_scan ++; |
1734 } | 1734 } |
1735 } | 1735 } |
1736 } | 1736 } |
1737 inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s
can, const uint8_t* pPalette, int pixel_count, | 1737 inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s
can, const uint8_t* pPalette, int pixel_count, |
1738 int blend_type, const uint8_t* clip_scan
, | 1738 int blend_type, const uint8_t* clip_scan
, |
1739 uint8_t* dest_alpha_scan, const uint8_t*
src_alpha_scan) | 1739 uint8_t* dest_alpha_scan, const uint8_t*
src_alpha_scan) |
1740 { | 1740 { |
1741 if (src_alpha_scan) { | 1741 if (src_alpha_scan) { |
1742 if (blend_type) { | 1742 if (blend_type) { |
1743 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1743 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1744 int blended_color; | 1744 int blended_color; |
1745 for (int col = 0; col < pixel_count; col ++) { | 1745 for (int col = 0; col < pixel_count; col ++) { |
1746 uint8_t gray = pPalette[*src_scan]; | 1746 uint8_t gray = pPalette[*src_scan]; |
1747 src_scan ++; | 1747 src_scan ++; |
1748 uint8_t back_alpha = *dest_alpha_scan; | 1748 uint8_t back_alpha = *dest_alpha_scan; |
1749 if (back_alpha == 0) { | 1749 if (back_alpha == 0) { |
1750 int src_alpha = *src_alpha_scan ++; | 1750 int src_alpha = *src_alpha_scan ++; |
1751 if (clip_scan) { | 1751 if (clip_scan) { |
1752 src_alpha = clip_scan[col] * src_alpha / 255; | 1752 src_alpha = clip_scan[col] * src_alpha / 255; |
1753 } | 1753 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 continue; | 1807 continue; |
1808 } | 1808 } |
1809 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha /
255; | 1809 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha /
255; |
1810 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); | 1810 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); |
1811 dest_alpha_scan ++; | 1811 dest_alpha_scan ++; |
1812 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 1812 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
1813 dest_scan ++; | 1813 dest_scan ++; |
1814 } | 1814 } |
1815 } else { | 1815 } else { |
1816 if (blend_type) { | 1816 if (blend_type) { |
1817 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1817 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1818 int blended_color; | 1818 int blended_color; |
1819 for (int col = 0; col < pixel_count; col ++) { | 1819 for (int col = 0; col < pixel_count; col ++) { |
1820 uint8_t gray = pPalette[*src_scan]; | 1820 uint8_t gray = pPalette[*src_scan]; |
1821 src_scan ++; | 1821 src_scan ++; |
1822 if (clip_scan == NULL || clip_scan[col] == 255) { | 1822 if (clip_scan == NULL || clip_scan[col] == 255) { |
1823 *dest_scan++ = gray; | 1823 *dest_scan++ = gray; |
1824 *dest_alpha_scan++ = 255; | 1824 *dest_alpha_scan++ = 255; |
1825 continue; | 1825 continue; |
1826 } | 1826 } |
1827 int src_alpha = clip_scan[col]; | 1827 int src_alpha = clip_scan[col]; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 dest_scan ++; | 1865 dest_scan ++; |
1866 } | 1866 } |
1867 } | 1867 } |
1868 } | 1868 } |
1869 inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc
an, int src_left, | 1869 inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc
an, int src_left, |
1870 const uint8_t* pPalette, int pixel_count,
int blend_type, const uint8_t* clip_scan) | 1870 const uint8_t* pPalette, int pixel_count,
int blend_type, const uint8_t* clip_scan) |
1871 { | 1871 { |
1872 int reset_gray = pPalette[0]; | 1872 int reset_gray = pPalette[0]; |
1873 int set_gray = pPalette[1]; | 1873 int set_gray = pPalette[1]; |
1874 if (blend_type) { | 1874 if (blend_type) { |
1875 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1875 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1876 int blended_color; | 1876 int blended_color; |
1877 for (int col = 0; col < pixel_count; col ++) { | 1877 for (int col = 0; col < pixel_count; col ++) { |
1878 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s
rc_left) % 8))) ? set_gray : reset_gray; | 1878 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s
rc_left) % 8))) ? set_gray : reset_gray; |
1879 if (bNonseparableBlend) { | 1879 if (bNonseparableBlend) { |
1880 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d
est_scan; | 1880 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d
est_scan; |
1881 } | 1881 } |
1882 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest
_scan, gray); | 1882 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest
_scan, gray); |
1883 if (clip_scan && clip_scan[col] < 255) { | 1883 if (clip_scan && clip_scan[col] < 255) { |
1884 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col])
; | 1884 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col])
; |
1885 } else { | 1885 } else { |
(...skipping 13 matching lines...) Expand all Loading... |
1899 dest_scan ++; | 1899 dest_scan ++; |
1900 } | 1900 } |
1901 } | 1901 } |
1902 inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s
can, int src_left, | 1902 inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s
can, int src_left, |
1903 const uint8_t* pPalette, int pixel_count
, int blend_type, const uint8_t* clip_scan, | 1903 const uint8_t* pPalette, int pixel_count
, int blend_type, const uint8_t* clip_scan, |
1904 uint8_t* dest_alpha_scan) | 1904 uint8_t* dest_alpha_scan) |
1905 { | 1905 { |
1906 int reset_gray = pPalette[0]; | 1906 int reset_gray = pPalette[0]; |
1907 int set_gray = pPalette[1]; | 1907 int set_gray = pPalette[1]; |
1908 if (blend_type) { | 1908 if (blend_type) { |
1909 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1909 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1910 int blended_color; | 1910 int blended_color; |
1911 for (int col = 0; col < pixel_count; col ++) { | 1911 for (int col = 0; col < pixel_count; col ++) { |
1912 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s
rc_left) % 8))) ? set_gray : reset_gray; | 1912 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s
rc_left) % 8))) ? set_gray : reset_gray; |
1913 if (clip_scan == NULL || clip_scan[col] == 255) { | 1913 if (clip_scan == NULL || clip_scan[col] == 255) { |
1914 *dest_scan++ = gray; | 1914 *dest_scan++ = gray; |
1915 *dest_alpha_scan ++ = 255; | 1915 *dest_alpha_scan ++ = 255; |
1916 continue; | 1916 continue; |
1917 } | 1917 } |
1918 int src_alpha = clip_scan[col]; | 1918 int src_alpha = clip_scan[col]; |
1919 if (src_alpha == 0) { | 1919 if (src_alpha == 0) { |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; | 2816 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; |
2817 *dest_alpha_scan++ = dest_alpha; | 2817 *dest_alpha_scan++ = dest_alpha; |
2818 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2818 int alpha_ratio = src_alpha * 255 / dest_alpha; |
2819 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); | 2819 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); |
2820 dest_scan ++; | 2820 dest_scan ++; |
2821 } | 2821 } |
2822 } | 2822 } |
2823 void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src
_scan, int pixel_count, int blend_type, const uint8_t* clip_scan) | 2823 void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src
_scan, int pixel_count, int blend_type, const uint8_t* clip_scan) |
2824 { | 2824 { |
2825 int blended_colors[3]; | 2825 int blended_colors[3]; |
2826 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2826 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
2827 for (int col = 0; col < pixel_count; col ++) { | 2827 for (int col = 0; col < pixel_count; col ++) { |
2828 uint8_t back_alpha = dest_scan[3]; | 2828 uint8_t back_alpha = dest_scan[3]; |
2829 if (back_alpha == 0) { | 2829 if (back_alpha == 0) { |
2830 if (clip_scan) { | 2830 if (clip_scan) { |
2831 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 2831 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
2832 dest_scan[3] = src_alpha; | 2832 dest_scan[3] = src_alpha; |
2833 dest_scan[0] = src_scan[2]; | 2833 dest_scan[0] = src_scan[2]; |
2834 dest_scan[1] = src_scan[1]; | 2834 dest_scan[1] = src_scan[1]; |
2835 dest_scan[2] = src_scan[0]; | 2835 dest_scan[2] = src_scan[0]; |
2836 } else { | 2836 } else { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2873 } | 2873 } |
2874 src_scan ++; | 2874 src_scan ++; |
2875 } | 2875 } |
2876 dest_scan += 4; | 2876 dest_scan += 4; |
2877 src_scan++; | 2877 src_scan++; |
2878 } | 2878 } |
2879 } | 2879 } |
2880 void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const
uint8_t* src_scan, int width, int blend_type, int src_Bpp) | 2880 void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const
uint8_t* src_scan, int width, int blend_type, int src_Bpp) |
2881 { | 2881 { |
2882 int blended_colors[3]; | 2882 int blended_colors[3]; |
2883 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2883 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
2884 int src_gap = src_Bpp - 3; | 2884 int src_gap = src_Bpp - 3; |
2885 for (int col = 0; col < width; col ++) { | 2885 for (int col = 0; col < width; col ++) { |
2886 uint8_t back_alpha = dest_scan[3]; | 2886 uint8_t back_alpha = dest_scan[3]; |
2887 if (back_alpha == 0) { | 2887 if (back_alpha == 0) { |
2888 if (src_Bpp == 4) { | 2888 if (src_Bpp == 4) { |
2889 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_
scan)); | 2889 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_
scan)); |
2890 } else { | 2890 } else { |
2891 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2],
src_scan[1], src_scan[0])); | 2891 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2],
src_scan[1], src_scan[0])); |
2892 } | 2892 } |
2893 dest_scan += 4; | 2893 dest_scan += 4; |
(...skipping 16 matching lines...) Expand all Loading... |
2910 dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha)
; | 2910 dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha)
; |
2911 src_scan ++; | 2911 src_scan ++; |
2912 } | 2912 } |
2913 dest_scan += 4; | 2913 dest_scan += 4; |
2914 src_scan += src_gap; | 2914 src_scan += src_gap; |
2915 } | 2915 } |
2916 } | 2916 } |
2917 inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, const
uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_
scan) | 2917 inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, const
uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_
scan) |
2918 { | 2918 { |
2919 int blended_colors[3]; | 2919 int blended_colors[3]; |
2920 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2920 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
2921 for (int col = 0; col < width; col ++) { | 2921 for (int col = 0; col < width; col ++) { |
2922 uint8_t src_alpha; | 2922 uint8_t src_alpha; |
2923 if (clip_scan) { | 2923 if (clip_scan) { |
2924 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 2924 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
2925 } else { | 2925 } else { |
2926 src_alpha = src_scan[3]; | 2926 src_alpha = src_scan[3]; |
2927 } | 2927 } |
2928 if (src_alpha == 0) { | 2928 if (src_alpha == 0) { |
2929 dest_scan += dest_Bpp; | 2929 dest_scan += dest_Bpp; |
2930 src_scan += 4; | 2930 src_scan += 4; |
(...skipping 26 matching lines...) Expand all Loading... |
2957 } else { | 2957 } else { |
2958 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_
scan[1], src_scan[0])); | 2958 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_
scan[1], src_scan[0])); |
2959 } | 2959 } |
2960 dest_scan += 4; | 2960 dest_scan += 4; |
2961 src_scan += src_Bpp; | 2961 src_scan += src_Bpp; |
2962 } | 2962 } |
2963 } | 2963 } |
2964 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) | 2964 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) |
2965 { | 2965 { |
2966 int blended_colors[3]; | 2966 int blended_colors[3]; |
2967 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2967 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
2968 int src_gap = src_Bpp - 3; | 2968 int src_gap = src_Bpp - 3; |
2969 for (int col = 0; col < width; col ++) { | 2969 for (int col = 0; col < width; col ++) { |
2970 if (bNonseparableBlend) { | 2970 if (bNonseparableBlend) { |
2971 uint8_t dest_scan_o[3]; | 2971 uint8_t dest_scan_o[3]; |
2972 dest_scan_o[0] = dest_scan[2]; | 2972 dest_scan_o[0] = dest_scan[2]; |
2973 dest_scan_o[1] = dest_scan[1]; | 2973 dest_scan_o[1] = dest_scan[1]; |
2974 dest_scan_o[2] = dest_scan[0]; | 2974 dest_scan_o[2] = dest_scan[0]; |
2975 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 2975 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
2976 } | 2976 } |
2977 for (int color = 0; color < 3; color ++) { | 2977 for (int color = 0; color < 3; color ++) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 dest_scan[2] = src_scan[0]; | 3024 dest_scan[2] = src_scan[0]; |
3025 dest_scan[1] = src_scan[1]; | 3025 dest_scan[1] = src_scan[1]; |
3026 dest_scan[0] = src_scan[2]; | 3026 dest_scan[0] = src_scan[2]; |
3027 dest_scan += dest_Bpp; | 3027 dest_scan += dest_Bpp; |
3028 src_scan += src_Bpp; | 3028 src_scan += src_Bpp; |
3029 } | 3029 } |
3030 } | 3030 } |
3031 inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, c
onst uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* c
lip_scan) | 3031 inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, c
onst uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* c
lip_scan) |
3032 { | 3032 { |
3033 int blended_colors[3]; | 3033 int blended_colors[3]; |
3034 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3034 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
3035 int src_gap = src_Bpp - 3; | 3035 int src_gap = src_Bpp - 3; |
3036 for (int col = 0; col < width; col ++) { | 3036 for (int col = 0; col < width; col ++) { |
3037 int src_alpha = *clip_scan ++; | 3037 int src_alpha = *clip_scan ++; |
3038 uint8_t back_alpha = dest_scan[3]; | 3038 uint8_t back_alpha = dest_scan[3]; |
3039 if (back_alpha == 0) { | 3039 if (back_alpha == 0) { |
3040 dest_scan[2] = FX_GAMMA(*src_scan++); | 3040 dest_scan[2] = FX_GAMMA(*src_scan++); |
3041 dest_scan[1] = FX_GAMMA(*src_scan++); | 3041 dest_scan[1] = FX_GAMMA(*src_scan++); |
3042 dest_scan[0] = FX_GAMMA(*src_scan++); | 3042 dest_scan[0] = FX_GAMMA(*src_scan++); |
3043 src_scan += src_gap; | 3043 src_scan += src_gap; |
3044 dest_scan += 4; | 3044 dest_scan += 4; |
(...skipping 23 matching lines...) Expand all Loading... |
3068 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], blended, alph
a_ratio); | 3068 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], blended, alph
a_ratio); |
3069 src_scan ++; | 3069 src_scan ++; |
3070 } | 3070 } |
3071 dest_scan += 4; | 3071 dest_scan += 4; |
3072 src_scan += src_gap; | 3072 src_scan += src_gap; |
3073 } | 3073 } |
3074 } | 3074 } |
3075 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, co
nst uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, con
st uint8_t* clip_scan) | 3075 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, co
nst uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, con
st uint8_t* clip_scan) |
3076 { | 3076 { |
3077 int blended_colors[3]; | 3077 int blended_colors[3]; |
3078 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3078 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
3079 int src_gap = src_Bpp - 3; | 3079 int src_gap = src_Bpp - 3; |
3080 for (int col = 0; col < width; col ++) { | 3080 for (int col = 0; col < width; col ++) { |
3081 uint8_t src_alpha = *clip_scan ++; | 3081 uint8_t src_alpha = *clip_scan ++; |
3082 if (src_alpha == 0) { | 3082 if (src_alpha == 0) { |
3083 dest_scan += dest_Bpp; | 3083 dest_scan += dest_Bpp; |
3084 src_scan += src_Bpp; | 3084 src_scan += src_Bpp; |
3085 continue; | 3085 continue; |
3086 } | 3086 } |
3087 if (bNonseparableBlend) { | 3087 if (bNonseparableBlend) { |
3088 uint8_t dest_scan_o[3]; | 3088 uint8_t dest_scan_o[3]; |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3524 blended = _BLEND(blend_type, back_color, src_r); | 3524 blended = _BLEND(blend_type, back_color, src_r); |
3525 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blende
d, src_alpha)); | 3525 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blende
d, src_alpha)); |
3526 } else { | 3526 } else { |
3527 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[2]), src_b, src_alpha)); | 3527 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[2]), src_b, src_alpha)); |
3528 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[1]), src_g, src_alpha)); | 3528 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[1]), src_g, src_alpha)); |
3529 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[0]), src_r, src_alpha)); | 3529 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[0]), src_r, src_alpha)); |
3530 } | 3530 } |
3531 dest_scan += Bpp; | 3531 dest_scan += Bpp; |
3532 } | 3532 } |
3533 } | 3533 } |
3534 inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int
alpha_flag, FX_DWORD mask_color, int& mask_alpha, | 3534 inline bool _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int alp
ha_flag, FX_DWORD mask_color, int& mask_alpha, |
3535 int& mask_red, int& mask_green, int& mask_blue, int& mask_black, | 3535 int& mask_red, int& mask_green, int& mask_blue, int& mask_black, |
3536 void* icc_module, void* pIccTransform) | 3536 void* icc_module, void* pIccTransform) |
3537 { | 3537 { |
3538 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; | 3538 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; |
3539 if (alpha_flag >> 8) { | 3539 if (alpha_flag >> 8) { |
3540 mask_alpha = alpha_flag & 0xff; | 3540 mask_alpha = alpha_flag & 0xff; |
3541 mask_red = FXSYS_GetCValue(mask_color); | 3541 mask_red = FXSYS_GetCValue(mask_color); |
3542 mask_green = FXSYS_GetMValue(mask_color); | 3542 mask_green = FXSYS_GetMValue(mask_color); |
3543 mask_blue = FXSYS_GetYValue(mask_color); | 3543 mask_blue = FXSYS_GetYValue(mask_color); |
3544 mask_black = FXSYS_GetKValue(mask_color); | 3544 mask_black = FXSYS_GetKValue(mask_color); |
3545 } else { | 3545 } else { |
3546 mask_alpha = FXARGB_A(mask_color); | 3546 mask_alpha = FXARGB_A(mask_color); |
3547 mask_red = FXARGB_R(mask_color); | 3547 mask_red = FXARGB_R(mask_color); |
3548 mask_green = FXARGB_G(mask_color); | 3548 mask_green = FXARGB_G(mask_color); |
3549 mask_blue = FXARGB_B(mask_color); | 3549 mask_blue = FXARGB_B(mask_color); |
3550 } | 3550 } |
3551 if (dest_format == FXDIB_8bppMask) { | 3551 if (dest_format == FXDIB_8bppMask) { |
3552 return TRUE; | 3552 return true; |
3553 } | 3553 } |
3554 if ((dest_format & 0xff) == 8) { | 3554 if ((dest_format & 0xff) == 8) { |
3555 if (pIccTransform) { | 3555 if (pIccTransform) { |
3556 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_T
ODIB(mask_color); | 3556 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_T
ODIB(mask_color); |
3557 uint8_t* gray_p = (uint8_t*)&mask_color; | 3557 uint8_t* gray_p = (uint8_t*)&mask_color; |
3558 pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); | 3558 pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); |
3559 mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; | 3559 mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; |
3560 } else { | 3560 } else { |
3561 if (alpha_flag >> 8) { | 3561 if (alpha_flag >> 8) { |
3562 uint8_t r, g, b; | 3562 uint8_t r, g, b; |
(...skipping 16 matching lines...) Expand all Loading... |
3579 mask_green = mask_color_p[1]; | 3579 mask_green = mask_color_p[1]; |
3580 mask_blue = mask_color_p[0]; | 3580 mask_blue = mask_color_p[0]; |
3581 } else if (alpha_flag >> 8) { | 3581 } else if (alpha_flag >> 8) { |
3582 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2]
, mask_color_p[3], | 3582 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2]
, mask_color_p[3], |
3583 mask_color_p[2], mask_color_p[1], mask_color_p[0]
); | 3583 mask_color_p[2], mask_color_p[1], mask_color_p[0]
); |
3584 mask_red = mask_color_p[2]; | 3584 mask_red = mask_color_p[2]; |
3585 mask_green = mask_color_p[1]; | 3585 mask_green = mask_color_p[1]; |
3586 mask_blue = mask_color_p[0]; | 3586 mask_blue = mask_color_p[0]; |
3587 } | 3587 } |
3588 } | 3588 } |
3589 return TRUE; | 3589 return true; |
3590 } | 3590 } |
3591 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
_Format dest_format, | 3591 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
_Format dest_format, |
3592 FX_DWORD*& pDestPalette, FX_DWORD* pSrcPalette, | 3592 FX_DWORD*& pDestPalette, FX_DWORD* pSrcPalette, |
3593 void* icc_module, void* pIccTransform) | 3593 void* icc_module, void* pIccTransform) |
3594 { | 3594 { |
3595 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; | 3595 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; |
3596 FX_BOOL isSrcCmyk = src_format & 0x0400 ? TRUE : FALSE; | 3596 bool isSrcCmyk = src_format & 0x0400 ? true : false; |
3597 FX_BOOL isDstCmyk = dest_format & 0x0400 ? TRUE : FALSE; | 3597 bool isDstCmyk = dest_format & 0x0400 ? true : false; |
3598 pDestPalette = NULL; | 3598 pDestPalette = NULL; |
3599 if (pIccTransform) { | 3599 if (pIccTransform) { |
3600 if (pSrcPalette) { | 3600 if (pSrcPalette) { |
3601 if ((dest_format & 0xff) == 8) { | 3601 if ((dest_format & 0xff) == 8) { |
3602 int pal_count = 1 << (src_format & 0xff); | 3602 int pal_count = 1 << (src_format & 0xff); |
3603 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); | 3603 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); |
3604 pDestPalette = (FX_DWORD*)gray_pal; | 3604 pDestPalette = (FX_DWORD*)gray_pal; |
3605 for (int i = 0; i < pal_count; i ++) { | 3605 for (int i = 0; i < pal_count; i ++) { |
3606 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) :
FXARGB_TODIB(pSrcPalette[i]); | 3606 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) :
FXARGB_TODIB(pSrcPalette[i]); |
3607 pIccModule->TranslateScanline(pIccTransform, gray_pal, (cons
t uint8_t*)&color, 1); | 3607 pIccModule->TranslateScanline(pIccTransform, gray_pal, (cons
t uint8_t*)&color, 1); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3708 } | 3708 } |
3709 } | 3709 } |
3710 } | 3710 } |
3711 } | 3711 } |
3712 } | 3712 } |
3713 CFX_ScanlineCompositor::CFX_ScanlineCompositor() | 3713 CFX_ScanlineCompositor::CFX_ScanlineCompositor() |
3714 { | 3714 { |
3715 m_pSrcPalette = NULL; | 3715 m_pSrcPalette = NULL; |
3716 m_pCacheScanline = NULL; | 3716 m_pCacheScanline = NULL; |
3717 m_CacheSize = 0; | 3717 m_CacheSize = 0; |
3718 m_bRgbByteOrder = FALSE; | 3718 m_bRgbByteOrder = false; |
3719 m_BlendType = FXDIB_BLEND_NORMAL; | 3719 m_BlendType = FXDIB_BLEND_NORMAL; |
3720 } | 3720 } |
3721 CFX_ScanlineCompositor::~CFX_ScanlineCompositor() | 3721 CFX_ScanlineCompositor::~CFX_ScanlineCompositor() |
3722 { | 3722 { |
3723 if (m_pSrcPalette) { | 3723 if (m_pSrcPalette) { |
3724 FX_Free(m_pSrcPalette); | 3724 FX_Free(m_pSrcPalette); |
3725 } | 3725 } |
3726 if (m_pCacheScanline) { | 3726 if (m_pCacheScanline) { |
3727 FX_Free(m_pCacheScanline); | 3727 FX_Free(m_pCacheScanline); |
3728 } | 3728 } |
3729 } | 3729 } |
3730 FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_
format, int32_t width, FX_DWORD* pSrcPalette, | 3730 bool CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_for
mat, int32_t width, FX_DWORD* pSrcPalette, |
3731 FX_DWORD mask_color, int blend_type, FX_BOO
L bClip, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) | 3731 FX_DWORD mask_color, int blend_type, bool b
Clip, bool bRgbByteOrder, int alpha_flag, void* pIccTransform) |
3732 { | 3732 { |
3733 m_SrcFormat = src_format; | 3733 m_SrcFormat = src_format; |
3734 m_DestFormat = dest_format; | 3734 m_DestFormat = dest_format; |
3735 m_BlendType = blend_type; | 3735 m_BlendType = blend_type; |
3736 m_bRgbByteOrder = bRgbByteOrder; | 3736 m_bRgbByteOrder = bRgbByteOrder; |
3737 ICodec_IccModule* pIccModule = NULL; | 3737 ICodec_IccModule* pIccModule = NULL; |
3738 if (CFX_GEModule::Get()->GetCodecModule()) { | 3738 if (CFX_GEModule::Get()->GetCodecModule()) { |
3739 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 3739 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
3740 } | 3740 } |
3741 if (pIccModule == NULL) { | 3741 if (pIccModule == NULL) { |
3742 pIccTransform = NULL; | 3742 pIccTransform = NULL; |
3743 } | 3743 } |
3744 m_pIccTransform = pIccTransform; | 3744 m_pIccTransform = pIccTransform; |
3745 if ((dest_format & 0xff) == 1) { | 3745 if ((dest_format & 0xff) == 1) { |
3746 return FALSE; | 3746 return false; |
3747 } | 3747 } |
3748 if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { | 3748 if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { |
3749 return _ScanlineCompositor_InitSourceMask(dest_format, alpha_flag, mask_
color, | 3749 return _ScanlineCompositor_InitSourceMask(dest_format, alpha_flag, mask_
color, |
3750 m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack, | 3750 m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack, |
3751 pIccModule, pIccTransform); | 3751 pIccModule, pIccTransform); |
3752 } | 3752 } |
3753 if (pIccTransform == NULL && (~src_format & 0x0400) && (dest_format & 0x0400
)) { | 3753 if (pIccTransform == NULL && (~src_format & 0x0400) && (dest_format & 0x0400
)) { |
3754 return FALSE; | 3754 return false; |
3755 } | 3755 } |
3756 if ((m_SrcFormat & 0xff) <= 8) { | 3756 if ((m_SrcFormat & 0xff) <= 8) { |
3757 if (dest_format == FXDIB_8bppMask) { | 3757 if (dest_format == FXDIB_8bppMask) { |
3758 return TRUE; | 3758 return true; |
3759 } | 3759 } |
3760 _ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPal
ette, pSrcPalette, | 3760 _ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPal
ette, pSrcPalette, |
3761 pIccModule, pIccTransform); | 3761 pIccModule, pIccTransform); |
3762 m_Transparency = (dest_format == FXDIB_Argb ? 1 : 0) | 3762 m_Transparency = (dest_format == FXDIB_Argb ? 1 : 0) |
3763 + (dest_format & 0x0200 ? 2 : 0) | 3763 + (dest_format & 0x0200 ? 2 : 0) |
3764 + (dest_format & 0x0400 ? 4 : 0) | 3764 + (dest_format & 0x0400 ? 4 : 0) |
3765 + ((src_format & 0xff) == 1 ? 8 : 0); | 3765 + ((src_format & 0xff) == 1 ? 8 : 0); |
3766 return TRUE; | 3766 return true; |
3767 } | 3767 } |
3768 m_Transparency = (src_format & 0x0200 ? 0 : 1) | 3768 m_Transparency = (src_format & 0x0200 ? 0 : 1) |
3769 + (dest_format & 0x0200 ? 0 : 2) | 3769 + (dest_format & 0x0200 ? 0 : 2) |
3770 + (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) | 3770 + (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) |
3771 + (bClip ? 8 : 0) | 3771 + (bClip ? 8 : 0) |
3772 + (src_format & 0x0400 ? 16 : 0) | 3772 + (src_format & 0x0400 ? 16 : 0) |
3773 + (dest_format & 0x0400 ? 32 : 0) | 3773 + (dest_format & 0x0400 ? 32 : 0) |
3774 + (pIccTransform ? 64 : 0); | 3774 + (pIccTransform ? 64 : 0); |
3775 return TRUE; | 3775 return true; |
3776 } | 3776 } |
3777 void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const ui
nt8_t* src_scan, int width, const uint8_t* clip_scan, | 3777 void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const ui
nt8_t* src_scan, int width, const uint8_t* clip_scan, |
3778 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) | 3778 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) |
3779 { | 3779 { |
3780 int src_Bpp = (m_SrcFormat & 0xff) >> 3; | 3780 int src_Bpp = (m_SrcFormat & 0xff) >> 3; |
3781 int dest_Bpp = (m_DestFormat & 0xff) >> 3; | 3781 int dest_Bpp = (m_DestFormat & 0xff) >> 3; |
3782 if (m_bRgbByteOrder) { | 3782 if (m_bRgbByteOrder) { |
3783 switch (m_Transparency) { | 3783 switch (m_Transparency) { |
3784 case 0: | 3784 case 0: |
3785 case 4: | 3785 case 4: |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4085 _CompositeRow_BitMask2Rgb_RgbByteOrder(dest_scan, src_scan, m_MaskAl
pha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4085 _CompositeRow_BitMask2Rgb_RgbByteOrder(dest_scan, src_scan, m_MaskAl
pha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
4086 src_left, width, m_BlendType,
(m_DestFormat & 0xff) >> 3, clip_scan); | 4086 src_left, width, m_BlendType,
(m_DestFormat & 0xff) >> 3, clip_scan); |
4087 return; | 4087 return; |
4088 } else if (m_DestFormat == FXDIB_Argb) | 4088 } else if (m_DestFormat == FXDIB_Argb) |
4089 _CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, | 4089 _CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, |
4090 src_left, width, m_BlendType, clip_scan); | 4090 src_left, width, m_BlendType, clip_scan); |
4091 else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) | 4091 else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) |
4092 _CompositeRow_BitMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m
_MaskGreen, m_MaskBlue, | 4092 _CompositeRow_BitMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m
_MaskGreen, m_MaskBlue, |
4093 src_left, width, m_BlendType, (m_DestFormat &
0xff) >> 3, clip_scan); | 4093 src_left, width, m_BlendType, (m_DestFormat &
0xff) >> 3, clip_scan); |
4094 } | 4094 } |
4095 FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, in
t height, | 4095 bool CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, int h
eight, |
4096 const CFX_DIBSource* pSrcBitmap, int src_l
eft, int src_top, | 4096 const CFX_DIBSource* pSrcBitmap, int src_l
eft, int src_top, |
4097 int blend_type, const CFX_ClipRgn* pClipRg
n, FX_BOOL bRgbByteOrder, void* pIccTransform) | 4097 int blend_type, const CFX_ClipRgn* pClipRg
n, bool bRgbByteOrder, void* pIccTransform) |
4098 { | 4098 { |
4099 if (m_pBuffer == NULL) { | 4099 if (m_pBuffer == NULL) { |
4100 return FALSE; | 4100 return false; |
4101 } | 4101 } |
4102 ASSERT(!pSrcBitmap->IsAlphaMask()); | 4102 ASSERT(!pSrcBitmap->IsAlphaMask()); |
4103 ASSERT(m_bpp >= 8); | 4103 ASSERT(m_bpp >= 8); |
4104 if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { | 4104 if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { |
4105 return FALSE; | 4105 return false; |
4106 } | 4106 } |
4107 GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), p
SrcBitmap->GetHeight(), | 4107 GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), p
SrcBitmap->GetHeight(), |
4108 src_left, src_top, pClipRgn); | 4108 src_left, src_top, pClipRgn); |
4109 if (width == 0 || height == 0) { | 4109 if (width == 0 || height == 0) { |
4110 return TRUE; | 4110 return true; |
4111 } | 4111 } |
4112 const CFX_DIBitmap* pClipMask = NULL; | 4112 const CFX_DIBitmap* pClipMask = NULL; |
4113 FX_RECT clip_box; | 4113 FX_RECT clip_box; |
4114 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4114 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
4115 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); | 4115 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); |
4116 pClipMask = pClipRgn->GetMask(); | 4116 pClipMask = pClipRgn->GetMask(); |
4117 clip_box = pClipRgn->GetBox(); | 4117 clip_box = pClipRgn->GetBox(); |
4118 } | 4118 } |
4119 CFX_ScanlineCompositor compositor; | 4119 CFX_ScanlineCompositor compositor; |
4120 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap
->GetPalette(), 0, blend_type, | 4120 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap
->GetPalette(), 0, blend_type, |
4121 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { | 4121 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { |
4122 return FALSE; | 4122 return false; |
4123 } | 4123 } |
4124 int dest_Bpp = m_bpp / 8; | 4124 int dest_Bpp = m_bpp / 8; |
4125 int src_Bpp = pSrcBitmap->GetBPP() / 8; | 4125 int src_Bpp = pSrcBitmap->GetBPP() / 8; |
4126 FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); | 4126 bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); |
4127 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; | 4127 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; |
4128 for (int row = 0; row < height; row ++) { | 4128 for (int row = 0; row < height; row ++) { |
4129 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* dest_Bpp; | 4129 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* dest_Bpp; |
4130 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_l
eft * src_Bpp; | 4130 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_l
eft * src_Bpp; |
4131 const uint8_t* src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->Get
Scanline(src_top + row) + src_left : NULL; | 4131 const uint8_t* src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->Get
Scanline(src_top + row) + src_left : NULL; |
4132 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G
etScanline(dest_top + row) + dest_left : NULL; | 4132 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G
etScanline(dest_top + row) + dest_left : NULL; |
4133 const uint8_t* clip_scan = NULL; | 4133 const uint8_t* clip_scan = NULL; |
4134 if (pClipMask) { | 4134 if (pClipMask) { |
4135 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); | 4135 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); |
4136 } | 4136 } |
4137 if (bRgb) { | 4137 if (bRgb) { |
4138 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_s
can, src_scan_extra_alpha, dst_scan_extra_alpha); | 4138 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_s
can, src_scan_extra_alpha, dst_scan_extra_alpha); |
4139 } else { | 4139 } else { |
4140 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, wid
th, clip_scan, src_scan_extra_alpha, dst_scan_extra_alpha); | 4140 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, wid
th, clip_scan, src_scan_extra_alpha, dst_scan_extra_alpha); |
4141 } | 4141 } |
4142 } | 4142 } |
4143 return TRUE; | 4143 return true; |
4144 } | 4144 } |
4145 FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int
height, | 4145 bool CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int hei
ght, |
4146 const CFX_DIBSource* pMask, FX_DWORD color,
int src_left, int src_top, | 4146 const CFX_DIBSource* pMask, FX_DWORD color,
int src_left, int src_top, |
4147 int blend_type, const CFX_ClipRgn* pClipRgn,
FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) | 4147 int blend_type, const CFX_ClipRgn* pClipRgn,
bool bRgbByteOrder, int alpha_flag, void* pIccTransform) |
4148 { | 4148 { |
4149 if (m_pBuffer == NULL) { | 4149 if (m_pBuffer == NULL) { |
4150 return FALSE; | 4150 return false; |
4151 } | 4151 } |
4152 ASSERT(pMask->IsAlphaMask()); | 4152 ASSERT(pMask->IsAlphaMask()); |
4153 ASSERT(m_bpp >= 8); | 4153 ASSERT(m_bpp >= 8); |
4154 if (!pMask->IsAlphaMask() || m_bpp < 8) { | 4154 if (!pMask->IsAlphaMask() || m_bpp < 8) { |
4155 return FALSE; | 4155 return false; |
4156 } | 4156 } |
4157 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask-
>GetHeight(), src_left, src_top, pClipRgn); | 4157 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask-
>GetHeight(), src_left, src_top, pClipRgn); |
4158 if (width == 0 || height == 0) { | 4158 if (width == 0 || height == 0) { |
4159 return TRUE; | 4159 return true; |
4160 } | 4160 } |
4161 int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(
color); | 4161 int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(
color); |
4162 if (src_alpha == 0) { | 4162 if (src_alpha == 0) { |
4163 return TRUE; | 4163 return true; |
4164 } | 4164 } |
4165 const CFX_DIBitmap* pClipMask = NULL; | 4165 const CFX_DIBitmap* pClipMask = NULL; |
4166 FX_RECT clip_box; | 4166 FX_RECT clip_box; |
4167 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4167 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
4168 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); | 4168 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); |
4169 pClipMask = pClipRgn->GetMask(); | 4169 pClipMask = pClipRgn->GetMask(); |
4170 clip_box = pClipRgn->GetBox(); | 4170 clip_box = pClipRgn->GetBox(); |
4171 } | 4171 } |
4172 int src_bpp = pMask->GetBPP(); | 4172 int src_bpp = pMask->GetBPP(); |
4173 int Bpp = GetBPP() / 8; | 4173 int Bpp = GetBPP() / 8; |
4174 CFX_ScanlineCompositor compositor; | 4174 CFX_ScanlineCompositor compositor; |
4175 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, bl
end_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, pIccTransform)) { | 4175 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, bl
end_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, pIccTransform)) { |
4176 return FALSE; | 4176 return false; |
4177 } | 4177 } |
4178 for (int row = 0; row < height; row ++) { | 4178 for (int row = 0; row < height; row ++) { |
4179 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* Bpp; | 4179 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* Bpp; |
4180 const uint8_t* src_scan = pMask->GetScanline(src_top + row); | 4180 const uint8_t* src_scan = pMask->GetScanline(src_top + row); |
4181 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G
etScanline(dest_top + row) + dest_left : NULL; | 4181 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G
etScanline(dest_top + row) + dest_left : NULL; |
4182 const uint8_t* clip_scan = NULL; | 4182 const uint8_t* clip_scan = NULL; |
4183 if (pClipMask) { | 4183 if (pClipMask) { |
4184 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); | 4184 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); |
4185 } | 4185 } |
4186 if (src_bpp == 1) { | 4186 if (src_bpp == 1) { |
4187 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width
, clip_scan, dst_scan_extra_alpha); | 4187 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width
, clip_scan, dst_scan_extra_alpha); |
4188 } else { | 4188 } else { |
4189 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, wid
th, clip_scan, dst_scan_extra_alpha); | 4189 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, wid
th, clip_scan, dst_scan_extra_alpha); |
4190 } | 4190 } |
4191 } | 4191 } |
4192 return TRUE; | 4192 return true; |
4193 } | 4193 } |
4194 FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX
_DWORD color, int alpha_flag, void* pIccTransform) | 4194 bool CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX_DW
ORD color, int alpha_flag, void* pIccTransform) |
4195 { | 4195 { |
4196 if (m_pBuffer == NULL) { | 4196 if (m_pBuffer == NULL) { |
4197 return FALSE; | 4197 return false; |
4198 } | 4198 } |
4199 int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); | 4199 int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); |
4200 if (src_alpha == 0) { | 4200 if (src_alpha == 0) { |
4201 return TRUE; | 4201 return true; |
4202 } | 4202 } |
4203 FX_RECT rect(left, top, left + width, top + height); | 4203 FX_RECT rect(left, top, left + width, top + height); |
4204 rect.Intersect(0, 0, m_Width, m_Height); | 4204 rect.Intersect(0, 0, m_Width, m_Height); |
4205 if (rect.IsEmpty()) { | 4205 if (rect.IsEmpty()) { |
4206 return TRUE; | 4206 return true; |
4207 } | 4207 } |
4208 width = rect.Width(); | 4208 width = rect.Width(); |
4209 FX_DWORD dst_color; | 4209 FX_DWORD dst_color; |
4210 if (alpha_flag >> 8) { | 4210 if (alpha_flag >> 8) { |
4211 dst_color = FXCMYK_TODIB(color); | 4211 dst_color = FXCMYK_TODIB(color); |
4212 } else { | 4212 } else { |
4213 dst_color = FXARGB_TODIB(color); | 4213 dst_color = FXARGB_TODIB(color); |
4214 } | 4214 } |
4215 uint8_t* color_p = (uint8_t*)&dst_color; | 4215 uint8_t* color_p = (uint8_t*)&dst_color; |
4216 if (m_bpp == 8) { | 4216 if (m_bpp == 8) { |
(...skipping 19 matching lines...) Expand all Loading... |
4236 for (int row = rect.top; row < rect.bottom; row ++) { | 4236 for (int row = rect.top; row < rect.bottom; row ++) { |
4237 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; | 4237 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; |
4238 if (src_alpha == 255) { | 4238 if (src_alpha == 255) { |
4239 FXSYS_memset(dest_scan, gray, width); | 4239 FXSYS_memset(dest_scan, gray, width); |
4240 } else | 4240 } else |
4241 for (int col = 0; col < width; col ++) { | 4241 for (int col = 0; col < width; col ++) { |
4242 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 4242 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
4243 dest_scan ++; | 4243 dest_scan ++; |
4244 } | 4244 } |
4245 } | 4245 } |
4246 return TRUE; | 4246 return true; |
4247 } else if (m_bpp == 1) { | 4247 } else if (m_bpp == 1) { |
4248 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); | 4248 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); |
4249 int left_shift = rect.left % 8; | 4249 int left_shift = rect.left % 8; |
4250 int right_shift = rect.right % 8; | 4250 int right_shift = rect.right % 8; |
4251 int width = rect.right / 8 - rect.left / 8; | 4251 int width = rect.right / 8 - rect.left / 8; |
4252 int index = 0; | 4252 int index = 0; |
4253 if (m_pPalette == NULL) { | 4253 if (m_pPalette == NULL) { |
4254 index = ((uint8_t)color == 0xff) ? 1 : 0; | 4254 index = ((uint8_t)color == 0xff) ? 1 : 0; |
4255 } else { | 4255 } else { |
4256 for (int i = 0; i < 2; i ++) | 4256 for (int i = 0; i < 2; i ++) |
(...skipping 16 matching lines...) Expand all Loading... |
4273 *dest_scan_top_r |= ~right_flag; | 4273 *dest_scan_top_r |= ~right_flag; |
4274 } | 4274 } |
4275 } else { | 4275 } else { |
4276 if (!index) { | 4276 if (!index) { |
4277 *dest_scan_top &= left_flag | right_flag; | 4277 *dest_scan_top &= left_flag | right_flag; |
4278 } else { | 4278 } else { |
4279 *dest_scan_top |= ~(left_flag | right_flag); | 4279 *dest_scan_top |= ~(left_flag | right_flag); |
4280 } | 4280 } |
4281 } | 4281 } |
4282 } | 4282 } |
4283 return TRUE; | 4283 return true; |
4284 } | 4284 } |
4285 ASSERT(m_bpp >= 24); | 4285 ASSERT(m_bpp >= 24); |
4286 if (m_bpp < 24) { | 4286 if (m_bpp < 24) { |
4287 return FALSE; | 4287 return false; |
4288 } | 4288 } |
4289 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { | 4289 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { |
4290 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->Ge
tIccModule(); | 4290 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->Ge
tIccModule(); |
4291 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); | 4291 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); |
4292 } else { | 4292 } else { |
4293 if (alpha_flag >> 8 && !IsCmykImage()) | 4293 if (alpha_flag >> 8 && !IsCmykImage()) |
4294 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), F
XSYS_GetYValue(color), FXSYS_GetKValue(color), | 4294 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), F
XSYS_GetYValue(color), FXSYS_GetKValue(color), |
4295 color_p[2], color_p[1], color_p[0]); | 4295 color_p[2], color_p[1], color_p[0]); |
4296 else if (!(alpha_flag >> 8) && IsCmykImage()) { | 4296 else if (!(alpha_flag >> 8) && IsCmykImage()) { |
4297 return FALSE; | 4297 return false; |
4298 } | 4298 } |
4299 } | 4299 } |
4300 if(!IsCmykImage()) { | 4300 if(!IsCmykImage()) { |
4301 color_p[3] = (uint8_t)src_alpha; | 4301 color_p[3] = (uint8_t)src_alpha; |
4302 } | 4302 } |
4303 int Bpp = m_bpp / 8; | 4303 int Bpp = m_bpp / 8; |
4304 FX_BOOL bAlpha = HasAlpha(); | 4304 bool bAlpha = HasAlpha(); |
4305 FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; | 4305 bool bArgb = GetFormat() == FXDIB_Argb ? true : false; |
4306 if (src_alpha == 255) { | 4306 if (src_alpha == 255) { |
4307 for (int row = rect.top; row < rect.bottom; row ++) { | 4307 for (int row = rect.top; row < rect.bottom; row ++) { |
4308 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; | 4308 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; |
4309 uint8_t* dest_scan_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->Ge
tScanline(row) + rect.left : NULL; | 4309 uint8_t* dest_scan_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->Ge
tScanline(row) + rect.left : NULL; |
4310 if (dest_scan_alpha) { | 4310 if (dest_scan_alpha) { |
4311 FXSYS_memset(dest_scan_alpha, 0xff, width); | 4311 FXSYS_memset(dest_scan_alpha, 0xff, width); |
4312 } | 4312 } |
4313 if (Bpp == 4) { | 4313 if (Bpp == 4) { |
4314 FX_DWORD* scan = (FX_DWORD*)dest_scan; | 4314 FX_DWORD* scan = (FX_DWORD*)dest_scan; |
4315 for (int col = 0; col < width; col ++) { | 4315 for (int col = 0; col < width; col ++) { |
4316 *scan ++ = dst_color; | 4316 *scan ++ = dst_color; |
4317 } | 4317 } |
4318 } else { | 4318 } else { |
4319 for (int col = 0; col < width; col ++) { | 4319 for (int col = 0; col < width; col ++) { |
4320 *dest_scan ++ = color_p[0]; | 4320 *dest_scan ++ = color_p[0]; |
4321 *dest_scan ++ = color_p[1]; | 4321 *dest_scan ++ = color_p[1]; |
4322 *dest_scan ++ = color_p[2]; | 4322 *dest_scan ++ = color_p[2]; |
4323 } | 4323 } |
4324 } | 4324 } |
4325 } | 4325 } |
4326 return TRUE; | 4326 return true; |
4327 } | 4327 } |
4328 for (int row = rect.top; row < rect.bottom; row ++) { | 4328 for (int row = rect.top; row < rect.bottom; row ++) { |
4329 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; | 4329 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; |
4330 if (bAlpha) { | 4330 if (bAlpha) { |
4331 if (bArgb) { | 4331 if (bArgb) { |
4332 for (int col = 0; col < width; col ++) { | 4332 for (int col = 0; col < width; col ++) { |
4333 uint8_t back_alpha = dest_scan[3]; | 4333 uint8_t back_alpha = dest_scan[3]; |
4334 if (back_alpha == 0) { | 4334 if (back_alpha == 0) { |
4335 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[
2], color_p[1], color_p[0])); | 4335 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[
2], color_p[1], color_p[0])); |
4336 dest_scan += 4; | 4336 dest_scan += 4; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4371 if (comps == 3) { | 4371 if (comps == 3) { |
4372 *dest_scan ++ = 255; | 4372 *dest_scan ++ = 255; |
4373 continue; | 4373 continue; |
4374 } | 4374 } |
4375 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], s
rc_alpha); | 4375 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], s
rc_alpha); |
4376 dest_scan ++; | 4376 dest_scan ++; |
4377 } | 4377 } |
4378 } | 4378 } |
4379 } | 4379 } |
4380 } | 4380 } |
4381 return TRUE; | 4381 return true; |
4382 } | 4382 } |
4383 CFX_BitmapComposer::CFX_BitmapComposer() | 4383 CFX_BitmapComposer::CFX_BitmapComposer() |
4384 { | 4384 { |
4385 m_pScanlineV = NULL; | 4385 m_pScanlineV = NULL; |
4386 m_pScanlineAlphaV = NULL; | 4386 m_pScanlineAlphaV = NULL; |
4387 m_pClipScanV = NULL; | 4387 m_pClipScanV = NULL; |
4388 m_pAddClipScan = NULL; | 4388 m_pAddClipScan = NULL; |
4389 m_bRgbByteOrder = FALSE; | 4389 m_bRgbByteOrder = false; |
4390 m_BlendType = FXDIB_BLEND_NORMAL; | 4390 m_BlendType = FXDIB_BLEND_NORMAL; |
4391 } | 4391 } |
4392 CFX_BitmapComposer::~CFX_BitmapComposer() | 4392 CFX_BitmapComposer::~CFX_BitmapComposer() |
4393 { | 4393 { |
4394 if (m_pScanlineV) { | 4394 if (m_pScanlineV) { |
4395 FX_Free(m_pScanlineV); | 4395 FX_Free(m_pScanlineV); |
4396 } | 4396 } |
4397 if (m_pScanlineAlphaV) { | 4397 if (m_pScanlineAlphaV) { |
4398 FX_Free(m_pScanlineAlphaV); | 4398 FX_Free(m_pScanlineAlphaV); |
4399 } | 4399 } |
4400 if (m_pClipScanV) { | 4400 if (m_pClipScanV) { |
4401 FX_Free(m_pClipScanV); | 4401 FX_Free(m_pClipScanV); |
4402 } | 4402 } |
4403 if (m_pAddClipScan) { | 4403 if (m_pAddClipScan) { |
4404 FX_Free(m_pAddClipScan); | 4404 FX_Free(m_pAddClipScan); |
4405 } | 4405 } |
4406 } | 4406 } |
4407 void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRg
n, int bitmap_alpha, | 4407 void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRg
n, int bitmap_alpha, |
4408 FX_DWORD mask_color, FX_RECT& dest_rect, FX_BOO
L bVertical, | 4408 FX_DWORD mask_color, FX_RECT& dest_rect, bool b
Vertical, |
4409 FX_BOOL bFlipX, FX_BOOL bFlipY, FX_BOOL bRgbByt
eOrder, | 4409 bool bFlipX, bool bFlipY, bool bRgbByteOrder, |
4410 int alpha_flag, void* pIccTransform, int blend_
type) | 4410 int alpha_flag, void* pIccTransform, int blend_
type) |
4411 { | 4411 { |
4412 m_pBitmap = pDest; | 4412 m_pBitmap = pDest; |
4413 m_pClipRgn = pClipRgn; | 4413 m_pClipRgn = pClipRgn; |
4414 m_DestLeft = dest_rect.left; | 4414 m_DestLeft = dest_rect.left; |
4415 m_DestTop = dest_rect.top; | 4415 m_DestTop = dest_rect.top; |
4416 m_DestWidth = dest_rect.Width(); | 4416 m_DestWidth = dest_rect.Width(); |
4417 m_DestHeight = dest_rect.Height(); | 4417 m_DestHeight = dest_rect.Height(); |
4418 m_BitmapAlpha = bitmap_alpha; | 4418 m_BitmapAlpha = bitmap_alpha; |
4419 m_MaskColor = mask_color; | 4419 m_MaskColor = mask_color; |
4420 m_pClipMask = NULL; | 4420 m_pClipMask = NULL; |
4421 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4421 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
4422 m_pClipMask = pClipRgn->GetMask(); | 4422 m_pClipMask = pClipRgn->GetMask(); |
4423 } | 4423 } |
4424 m_bVertical = bVertical; | 4424 m_bVertical = bVertical; |
4425 m_bFlipX = bFlipX; | 4425 m_bFlipX = bFlipX; |
4426 m_bFlipY = bFlipY; | 4426 m_bFlipY = bFlipY; |
4427 m_AlphaFlag = alpha_flag; | 4427 m_AlphaFlag = alpha_flag; |
4428 m_pIccTransform = pIccTransform; | 4428 m_pIccTransform = pIccTransform; |
4429 m_bRgbByteOrder = bRgbByteOrder; | 4429 m_bRgbByteOrder = bRgbByteOrder; |
4430 m_BlendType = blend_type; | 4430 m_BlendType = blend_type; |
4431 } | 4431 } |
4432 FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form
at, FX_DWORD* pSrcPalette) | 4432 bool CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_format,
FX_DWORD* pSrcPalette) |
4433 { | 4433 { |
4434 m_SrcFormat = src_format; | 4434 m_SrcFormat = src_format; |
4435 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalett
e, m_MaskColor, FXDIB_BLEND_NORMAL, | 4435 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalett
e, m_MaskColor, FXDIB_BLEND_NORMAL, |
4436 m_pClipMask != NULL || (m_BitmapAlpha < 255), m_bRgbB
yteOrder, m_AlphaFlag, m_pIccTransform)) { | 4436 m_pClipMask != NULL || (m_BitmapAlpha < 255), m_bRgbB
yteOrder, m_AlphaFlag, m_pIccTransform)) { |
4437 return FALSE; | 4437 return false; |
4438 } | 4438 } |
4439 if (m_bVertical) { | 4439 if (m_bVertical) { |
4440 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); | 4440 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); |
4441 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); | 4441 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); |
4442 if (m_pBitmap->m_pAlphaMask) { | 4442 if (m_pBitmap->m_pAlphaMask) { |
4443 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); | 4443 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); |
4444 } | 4444 } |
4445 } | 4445 } |
4446 if (m_BitmapAlpha < 255) { | 4446 if (m_BitmapAlpha < 255) { |
4447 m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight()
: m_pBitmap->GetWidth()); | 4447 m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight()
: m_pBitmap->GetWidth()); |
4448 } | 4448 } |
4449 return TRUE; | 4449 return true; |
4450 } | 4450 } |
4451 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, const uint8_t* src_scan,
int dest_width, const uint8_t* clip_scan, | 4451 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, const uint8_t* src_scan,
int dest_width, const uint8_t* clip_scan, |
4452 const uint8_t* src_extra_alpha, uint8_t* dst_
extra_alpha) | 4452 const uint8_t* src_extra_alpha, uint8_t* dst_
extra_alpha) |
4453 { | 4453 { |
4454 if (m_BitmapAlpha < 255) { | 4454 if (m_BitmapAlpha < 255) { |
4455 if (clip_scan) { | 4455 if (clip_scan) { |
4456 for (int i = 0; i < dest_width; i ++) { | 4456 for (int i = 0; i < dest_width; i ++) { |
4457 m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255; | 4457 m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255; |
4458 } | 4458 } |
4459 } else { | 4459 } else { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4547 } | 4547 } |
4548 src_alpha_scan = m_pScanlineAlphaV; | 4548 src_alpha_scan = m_pScanlineAlphaV; |
4549 dest_alpha_scan = dest_alpha_buf; | 4549 dest_alpha_scan = dest_alpha_buf; |
4550 if (dest_alpha_scan) { | 4550 if (dest_alpha_scan) { |
4551 for (i = 0; i < m_DestHeight; i ++) { | 4551 for (i = 0; i < m_DestHeight; i ++) { |
4552 *dest_alpha_scan = *src_alpha_scan++; | 4552 *dest_alpha_scan = *src_alpha_scan++; |
4553 dest_alpha_scan += y_alpha_step; | 4553 dest_alpha_scan += y_alpha_step; |
4554 } | 4554 } |
4555 } | 4555 } |
4556 } | 4556 } |
OLD | NEW |