Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1335)

Side by Side Diff: core/src/fxge/dib/fx_dib_composite.cpp

Issue 1258093002: FX Bool considered harmful, part 3 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/dib/dib_int.h ('k') | core/src/fxge/dib/fx_dib_convert.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 _color_sqrt[256] = { 10 const uint8_t _color_sqrt[256] = {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 265 }
266 } 266 }
267 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int p ixel_count, int blend_type, const uint8_t* clip_scan, 267 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int p ixel_count, int blend_type, const uint8_t* clip_scan,
268 const uint8_t* src_alpha_scan, uint8_t* dst_alpha_ scan, void* pIccTransform) 268 const uint8_t* src_alpha_scan, uint8_t* dst_alpha_ scan, void* pIccTransform)
269 { 269 {
270 ICodec_IccModule* pIccModule = NULL; 270 ICodec_IccModule* pIccModule = NULL;
271 if (pIccTransform) { 271 if (pIccTransform) {
272 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 272 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
273 } 273 }
274 if (blend_type) { 274 if (blend_type) {
275 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 275 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
276 int blended_color; 276 int blended_color;
277 if (src_alpha_scan) { 277 if (src_alpha_scan) {
278 for (int col = 0; col < pixel_count; col ++) { 278 for (int col = 0; col < pixel_count; col ++) {
279 uint8_t back_alpha = *dst_alpha_scan; 279 uint8_t back_alpha = *dst_alpha_scan;
280 if (back_alpha == 0) { 280 if (back_alpha == 0) {
281 int src_alpha = *src_alpha_scan++; 281 int src_alpha = *src_alpha_scan++;
282 if (clip_scan) { 282 if (clip_scan) {
283 src_alpha = clip_scan[col] * src_alpha / 255; 283 src_alpha = clip_scan[col] * src_alpha / 255;
284 } 284 }
285 if (src_alpha) { 285 if (src_alpha) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count, 460 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int pixel_count,
461 int blend_type, const uint8_t* clip_scan, 461 int blend_type, const uint8_t* clip_scan,
462 const uint8_t* src_alpha_scan, void* pIccTra nsform) 462 const uint8_t* src_alpha_scan, void* pIccTra nsform)
463 { 463 {
464 ICodec_IccModule* pIccModule = NULL; 464 ICodec_IccModule* pIccModule = NULL;
465 uint8_t gray; 465 uint8_t gray;
466 if (pIccTransform) { 466 if (pIccTransform) {
467 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 467 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
468 } 468 }
469 if (blend_type) { 469 if (blend_type) {
470 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 470 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
471 int blended_color; 471 int blended_color;
472 if (src_alpha_scan) { 472 if (src_alpha_scan) {
473 for (int col = 0; col < pixel_count; col ++) { 473 for (int col = 0; col < pixel_count; col ++) {
474 int src_alpha = *src_alpha_scan++; 474 int src_alpha = *src_alpha_scan++;
475 if (clip_scan) { 475 if (clip_scan) {
476 src_alpha = clip_scan[col] * src_alpha / 255; 476 src_alpha = clip_scan[col] * src_alpha / 255;
477 } 477 }
478 if (src_alpha) { 478 if (src_alpha) {
479 if (pIccTransform) { 479 if (pIccTransform) {
480 pIccModule->TranslateScanline(pIccTransform, &gray, src_ scan, 1); 480 pIccModule->TranslateScanline(pIccTransform, &gray, src_ scan, 1);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int src_Bpp, int pixel_count, 551 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int src_Bpp, int pixel_count,
552 int blend_type, const uint8_t* clip_scan, 552 int blend_type, const uint8_t* clip_scan,
553 void* pIccTransform) 553 void* pIccTransform)
554 { 554 {
555 ICodec_IccModule* pIccModule = NULL; 555 ICodec_IccModule* pIccModule = NULL;
556 uint8_t gray; 556 uint8_t gray;
557 if (pIccTransform) { 557 if (pIccTransform) {
558 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 558 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
559 } 559 }
560 if (blend_type) { 560 if (blend_type) {
561 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 561 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
562 int blended_color; 562 int blended_color;
563 for (int col = 0; col < pixel_count; col ++) { 563 for (int col = 0; col < pixel_count; col ++) {
564 if (pIccTransform) { 564 if (pIccTransform) {
565 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1) ; 565 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1) ;
566 } else { 566 } else {
567 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 567 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
568 } 568 }
569 if (bNonseparableBlend) { 569 if (bNonseparableBlend) {
570 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d est_scan; 570 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d est_scan;
571 } 571 }
(...skipping 26 matching lines...) Expand all
598 void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int sr c_Bpp, int pixel_count, 598 void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int sr c_Bpp, int pixel_count,
599 int blend_type, const uint8_t* clip_scan, 599 int blend_type, const uint8_t* clip_scan,
600 uint8_t* dest_alpha_scan, void* pIccTransform) 600 uint8_t* dest_alpha_scan, void* pIccTransform)
601 { 601 {
602 ICodec_IccModule* pIccModule = NULL; 602 ICodec_IccModule* pIccModule = NULL;
603 if (pIccTransform) { 603 if (pIccTransform) {
604 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 604 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
605 } 605 }
606 if (blend_type) { 606 if (blend_type) {
607 int blended_color; 607 int blended_color;
608 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 608 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
609 for (int col = 0; col < pixel_count; col ++) { 609 for (int col = 0; col < pixel_count; col ++) {
610 int back_alpha = *dest_alpha_scan; 610 int back_alpha = *dest_alpha_scan;
611 if (back_alpha == 0) { 611 if (back_alpha == 0) {
612 if (pIccTransform) { 612 if (pIccTransform) {
613 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_ scan, 1); 613 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_ scan, 1);
614 } else { 614 } else {
615 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan) ; 615 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan) ;
616 } 616 }
617 dest_scan ++; 617 dest_scan ++;
618 dest_alpha_scan++; 618 dest_alpha_scan++;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 682 }
683 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 683 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
684 dest_scan ++; 684 dest_scan ++;
685 src_scan += src_Bpp; 685 src_scan += src_Bpp;
686 } 686 }
687 } 687 }
688 void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pi xel_count, int blend_type, const uint8_t* clip_scan, 688 void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pi xel_count, int blend_type, const uint8_t* clip_scan,
689 uint8_t* dest_alpha_scan, const uint8_t* src_alpha_ scan) 689 uint8_t* dest_alpha_scan, const uint8_t* src_alpha_ scan)
690 { 690 {
691 int blended_colors[3]; 691 int blended_colors[3];
692 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 692 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
693 if (dest_alpha_scan == NULL) { 693 if (dest_alpha_scan == NULL) {
694 if (src_alpha_scan == NULL) { 694 if (src_alpha_scan == NULL) {
695 uint8_t back_alpha = 0; 695 uint8_t back_alpha = 0;
696 for (int col = 0; col < pixel_count; col ++) { 696 for (int col = 0; col < pixel_count; col ++) {
697 back_alpha = dest_scan[3]; 697 back_alpha = dest_scan[3];
698 if (back_alpha == 0) { 698 if (back_alpha == 0) {
699 if (clip_scan) { 699 if (clip_scan) {
700 int src_alpha = clip_scan[col] * src_scan[3] / 255; 700 int src_alpha = clip_scan[col] * src_scan[3] / 255;
701 FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xff ffff) | (src_alpha << 24)); 701 FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xff ffff) | (src_alpha << 24));
702 } else { 702 } else {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 889 }
890 src_scan ++; 890 src_scan ++;
891 } 891 }
892 } 892 }
893 } 893 }
894 } 894 }
895 void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_ scan, int width, int blend_type, int src_Bpp, 895 void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_ scan, int width, int blend_type, int src_Bpp,
896 uint8_t* dest_alpha_scan) 896 uint8_t* dest_alpha_scan)
897 { 897 {
898 int blended_colors[3]; 898 int blended_colors[3];
899 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 899 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
900 int src_gap = src_Bpp - 3; 900 int src_gap = src_Bpp - 3;
901 if (dest_alpha_scan == NULL) { 901 if (dest_alpha_scan == NULL) {
902 for (int col = 0; col < width; col ++) { 902 for (int col = 0; col < width; col ++) {
903 uint8_t back_alpha = dest_scan[3]; 903 uint8_t back_alpha = dest_scan[3];
904 if (back_alpha == 0) { 904 if (back_alpha == 0) {
905 if (src_Bpp == 4) { 905 if (src_Bpp == 4) {
906 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan )); 906 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan ));
907 } else { 907 } else {
908 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_ scan[1], src_scan[0])); 908 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_ scan[1], src_scan[0]));
909 } 909 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 src_scan ++; 950 src_scan ++;
951 } 951 }
952 src_scan += src_gap; 952 src_scan += src_gap;
953 } 953 }
954 } 954 }
955 } 955 }
956 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, 956 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,
957 uint8_t* dest_alpha_scan) 957 uint8_t* dest_alpha_scan)
958 { 958 {
959 int blended_colors[3]; 959 int blended_colors[3];
960 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 960 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
961 int src_gap = src_Bpp - 3; 961 int src_gap = src_Bpp - 3;
962 if (dest_alpha_scan == NULL) { 962 if (dest_alpha_scan == NULL) {
963 for (int col = 0; col < width; col ++) { 963 for (int col = 0; col < width; col ++) {
964 int src_alpha = *clip_scan ++; 964 int src_alpha = *clip_scan ++;
965 uint8_t back_alpha = dest_scan[3]; 965 uint8_t back_alpha = dest_scan[3];
966 if (back_alpha == 0) { 966 if (back_alpha == 0) {
967 *dest_scan++ = *src_scan++; 967 *dest_scan++ = *src_scan++;
968 *dest_scan++ = *src_scan++; 968 *dest_scan++ = *src_scan++;
969 *dest_scan++ = *src_scan++; 969 *dest_scan++ = *src_scan++;
970 src_scan += src_gap; 970 src_scan += src_gap;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 *dest_scan++ = *src_scan++; 1114 *dest_scan++ = *src_scan++;
1115 *dest_alpha_scan++ = 0xff; 1115 *dest_alpha_scan++ = 0xff;
1116 src_scan += src_gap; 1116 src_scan += src_gap;
1117 } 1117 }
1118 } 1118 }
1119 } 1119 }
1120 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, 1120 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,
1121 const uint8_t* src_alpha_scan) 1121 const uint8_t* src_alpha_scan)
1122 { 1122 {
1123 int blended_colors[3]; 1123 int blended_colors[3];
1124 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1124 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1125 int dest_gap = dest_Bpp - 3; 1125 int dest_gap = dest_Bpp - 3;
1126 if (src_alpha_scan == NULL) { 1126 if (src_alpha_scan == NULL) {
1127 for (int col = 0; col < width; col ++) { 1127 for (int col = 0; col < width; col ++) {
1128 uint8_t src_alpha; 1128 uint8_t src_alpha;
1129 if (clip_scan) { 1129 if (clip_scan) {
1130 src_alpha = src_scan[3] * (*clip_scan++) / 255; 1130 src_alpha = src_scan[3] * (*clip_scan++) / 255;
1131 } else { 1131 } else {
1132 src_alpha = src_scan[3]; 1132 src_alpha = src_scan[3];
1133 } 1133 }
1134 if (src_alpha == 0) { 1134 if (src_alpha == 0) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 dest_scan ++; 1236 dest_scan ++;
1237 src_scan ++; 1237 src_scan ++;
1238 } 1238 }
1239 dest_scan += dest_gap; 1239 dest_scan += dest_gap;
1240 } 1240 }
1241 } 1241 }
1242 } 1242 }
1243 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) 1243 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)
1244 { 1244 {
1245 int blended_colors[3]; 1245 int blended_colors[3];
1246 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1246 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1247 int dest_gap = dest_Bpp - 3; 1247 int dest_gap = dest_Bpp - 3;
1248 int src_gap = src_Bpp - 3; 1248 int src_gap = src_Bpp - 3;
1249 for (int col = 0; col < width; col ++) { 1249 for (int col = 0; col < width; col ++) {
1250 if (bNonseparableBlend) { 1250 if (bNonseparableBlend) {
1251 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 1251 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
1252 } 1252 }
1253 for (int color = 0; color < 3; color ++) { 1253 for (int color = 0; color < 3; color ++) {
1254 int back_color = *dest_scan; 1254 int back_color = *dest_scan;
1255 int src_color = *src_scan; 1255 int src_color = *src_scan;
1256 int blended = bNonseparableBlend ? blended_colors[color] : 1256 int blended = bNonseparableBlend ? blended_colors[color] :
1257 _BLEND(blend_type, back_color, src_color); 1257 _BLEND(blend_type, back_color, src_color);
1258 *dest_scan = blended; 1258 *dest_scan = blended;
1259 dest_scan ++; 1259 dest_scan ++;
1260 src_scan ++; 1260 src_scan ++;
1261 } 1261 }
1262 dest_scan += dest_gap; 1262 dest_scan += dest_gap;
1263 src_scan += src_gap; 1263 src_scan += src_gap;
1264 } 1264 }
1265 } 1265 }
1266 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) 1266 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)
1267 { 1267 {
1268 int blended_colors[3]; 1268 int blended_colors[3];
1269 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1269 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1270 int dest_gap = dest_Bpp - 3; 1270 int dest_gap = dest_Bpp - 3;
1271 int src_gap = src_Bpp - 3; 1271 int src_gap = src_Bpp - 3;
1272 for (int col = 0; col < width; col ++) { 1272 for (int col = 0; col < width; col ++) {
1273 uint8_t src_alpha = *clip_scan ++; 1273 uint8_t src_alpha = *clip_scan ++;
1274 if (src_alpha == 0) { 1274 if (src_alpha == 0) {
1275 dest_scan += dest_Bpp; 1275 dest_scan += dest_Bpp;
1276 src_scan += src_Bpp; 1276 src_scan += src_Bpp;
1277 continue; 1277 continue;
1278 } 1278 }
1279 if (bNonseparableBlend) { 1279 if (bNonseparableBlend) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 } else { 1350 } else {
1351 if (dest_alpha_scan == NULL) { 1351 if (dest_alpha_scan == NULL) {
1352 for (int col = 0; col < pixel_count; col ++) { 1352 for (int col = 0; col < pixel_count; col ++) {
1353 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); 1353 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
1354 dp[3] = src_scan[3]; 1354 dp[3] = src_scan[3];
1355 src_scan += 4; 1355 src_scan += 4;
1356 dp += 4; 1356 dp += 4;
1357 } 1357 }
1358 } else { 1358 } else {
1359 int blended_colors[3]; 1359 int blended_colors[3];
1360 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1360 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1361 for (int col = 0; col < pixel_count; col ++) { 1361 for (int col = 0; col < pixel_count; col ++) {
1362 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src _scan, 1); 1362 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src _scan, 1);
1363 uint8_t back_alpha = *dest_alpha_scan; 1363 uint8_t back_alpha = *dest_alpha_scan;
1364 if (back_alpha == 0) { 1364 if (back_alpha == 0) {
1365 if (clip_scan) { 1365 if (clip_scan) {
1366 int src_alpha = clip_scan[col] * src_scan[3] / 255; 1366 int src_alpha = clip_scan[col] * src_scan[3] / 255;
1367 *dest_alpha_scan = src_alpha; 1367 *dest_alpha_scan = src_alpha;
1368 *dest_scan++ = *src_cache_scan++; 1368 *dest_scan++ = *src_cache_scan++;
1369 *dest_scan++ = *src_cache_scan++; 1369 *dest_scan++ = *src_cache_scan++;
1370 *dest_scan++ = *src_cache_scan++; 1370 *dest_scan++ = *src_cache_scan++;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, d est_alpha_scan); 1480 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, d est_alpha_scan);
1481 } 1481 }
1482 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, 1482 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,
1483 const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransf orm) 1483 const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransf orm)
1484 { 1484 {
1485 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc Module(); 1485 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc Module();
1486 if (src_alpha_scan) { 1486 if (src_alpha_scan) {
1487 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w idth); 1487 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w idth);
1488 } else { 1488 } else {
1489 int blended_colors[3]; 1489 int blended_colors[3];
1490 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1490 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1491 int dest_gap = dest_Bpp - 3; 1491 int dest_gap = dest_Bpp - 3;
1492 for (int col = 0; col < width; col ++) { 1492 for (int col = 0; col < width; col ++) {
1493 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_sca n, 1); 1493 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_sca n, 1);
1494 uint8_t src_alpha; 1494 uint8_t src_alpha;
1495 if (clip_scan) { 1495 if (clip_scan) {
1496 src_alpha = src_scan[3] * (*clip_scan++) / 255; 1496 src_alpha = src_scan[3] * (*clip_scan++) / 255;
1497 } else { 1497 } else {
1498 src_alpha = src_scan[3]; 1498 src_alpha = src_scan[3];
1499 } 1499 }
1500 src_scan += 4; 1500 src_scan += 4;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 } 1623 }
1624 } 1624 }
1625 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bp p, 3, clip_scan); 1625 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bp p, 3, clip_scan);
1626 } 1626 }
1627 inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc an, const uint8_t* pPalette, int pixel_count, 1627 inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc an, const uint8_t* pPalette, int pixel_count,
1628 int blend_type, const uint8_t* clip_scan, 1628 int blend_type, const uint8_t* clip_scan,
1629 const uint8_t* src_alpha_scan) 1629 const uint8_t* src_alpha_scan)
1630 { 1630 {
1631 if (src_alpha_scan) { 1631 if (src_alpha_scan) {
1632 if (blend_type) { 1632 if (blend_type) {
1633 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1633 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1634 int blended_color; 1634 int blended_color;
1635 for (int col = 0; col < pixel_count; col ++) { 1635 for (int col = 0; col < pixel_count; col ++) {
1636 uint8_t gray = pPalette[*src_scan]; 1636 uint8_t gray = pPalette[*src_scan];
1637 int src_alpha = *src_alpha_scan++; 1637 int src_alpha = *src_alpha_scan++;
1638 if (clip_scan) { 1638 if (clip_scan) {
1639 src_alpha = clip_scan[col] * src_alpha / 255; 1639 src_alpha = clip_scan[col] * src_alpha / 255;
1640 } 1640 }
1641 if (bNonseparableBlend) { 1641 if (bNonseparableBlend) {
1642 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 1642 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
1643 } 1643 }
(...skipping 17 matching lines...) Expand all
1661 if (src_alpha) { 1661 if (src_alpha) {
1662 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 1662 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
1663 } else { 1663 } else {
1664 *dest_scan = gray; 1664 *dest_scan = gray;
1665 } 1665 }
1666 dest_scan ++; 1666 dest_scan ++;
1667 src_scan ++; 1667 src_scan ++;
1668 } 1668 }
1669 } else { 1669 } else {
1670 if (blend_type) { 1670 if (blend_type) {
1671 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1671 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1672 int blended_color; 1672 int blended_color;
1673 for (int col = 0; col < pixel_count; col ++) { 1673 for (int col = 0; col < pixel_count; col ++) {
1674 uint8_t gray = pPalette[*src_scan]; 1674 uint8_t gray = pPalette[*src_scan];
1675 if (bNonseparableBlend) { 1675 if (bNonseparableBlend) {
1676 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 1676 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
1677 } 1677 }
1678 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray); 1678 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray);
1679 if (clip_scan && clip_scan[col] < 255) { 1679 if (clip_scan && clip_scan[col] < 255) {
1680 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[c ol]); 1680 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[c ol]);
1681 } else { 1681 } else {
(...skipping 15 matching lines...) Expand all
1697 src_scan ++; 1697 src_scan ++;
1698 } 1698 }
1699 } 1699 }
1700 } 1700 }
1701 inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s can, const uint8_t* pPalette, int pixel_count, 1701 inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s can, const uint8_t* pPalette, int pixel_count,
1702 int blend_type, const uint8_t* clip_scan , 1702 int blend_type, const uint8_t* clip_scan ,
1703 uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) 1703 uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan)
1704 { 1704 {
1705 if (src_alpha_scan) { 1705 if (src_alpha_scan) {
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 src_scan ++; 1711 src_scan ++;
1712 uint8_t back_alpha = *dest_alpha_scan; 1712 uint8_t back_alpha = *dest_alpha_scan;
1713 if (back_alpha == 0) { 1713 if (back_alpha == 0) {
1714 int src_alpha = *src_alpha_scan ++; 1714 int src_alpha = *src_alpha_scan ++;
1715 if (clip_scan) { 1715 if (clip_scan) {
1716 src_alpha = clip_scan[col] * src_alpha / 255; 1716 src_alpha = clip_scan[col] * src_alpha / 255;
1717 } 1717 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 continue; 1771 continue;
1772 } 1772 }
1773 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; 1773 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
1774 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); 1774 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan);
1775 dest_alpha_scan ++; 1775 dest_alpha_scan ++;
1776 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 1776 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
1777 dest_scan ++; 1777 dest_scan ++;
1778 } 1778 }
1779 } else { 1779 } else {
1780 if (blend_type) { 1780 if (blend_type) {
1781 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1781 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1782 int blended_color; 1782 int blended_color;
1783 for (int col = 0; col < pixel_count; col ++) { 1783 for (int col = 0; col < pixel_count; col ++) {
1784 uint8_t gray = pPalette[*src_scan]; 1784 uint8_t gray = pPalette[*src_scan];
1785 src_scan ++; 1785 src_scan ++;
1786 if (clip_scan == NULL || clip_scan[col] == 255) { 1786 if (clip_scan == NULL || clip_scan[col] == 255) {
1787 *dest_scan++ = gray; 1787 *dest_scan++ = gray;
1788 *dest_alpha_scan++ = 255; 1788 *dest_alpha_scan++ = 255;
1789 continue; 1789 continue;
1790 } 1790 }
1791 int src_alpha = clip_scan[col]; 1791 int src_alpha = clip_scan[col];
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 dest_scan ++; 1829 dest_scan ++;
1830 } 1830 }
1831 } 1831 }
1832 } 1832 }
1833 inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc an, int src_left, 1833 inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc an, int src_left,
1834 const uint8_t* pPalette, int pixel_count, int blend_type, const uint8_t* clip_scan) 1834 const uint8_t* pPalette, int pixel_count, int blend_type, const uint8_t* clip_scan)
1835 { 1835 {
1836 int reset_gray = pPalette[0]; 1836 int reset_gray = pPalette[0];
1837 int set_gray = pPalette[1]; 1837 int set_gray = pPalette[1];
1838 if (blend_type) { 1838 if (blend_type) {
1839 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1839 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1840 int blended_color; 1840 int blended_color;
1841 for (int col = 0; col < pixel_count; col ++) { 1841 for (int col = 0; col < pixel_count; col ++) {
1842 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s rc_left) % 8))) ? set_gray : reset_gray; 1842 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s rc_left) % 8))) ? set_gray : reset_gray;
1843 if (bNonseparableBlend) { 1843 if (bNonseparableBlend) {
1844 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d est_scan; 1844 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d est_scan;
1845 } 1845 }
1846 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest _scan, gray); 1846 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest _scan, gray);
1847 if (clip_scan && clip_scan[col] < 255) { 1847 if (clip_scan && clip_scan[col] < 255) {
1848 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]) ; 1848 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]) ;
1849 } else { 1849 } else {
(...skipping 13 matching lines...) Expand all
1863 dest_scan ++; 1863 dest_scan ++;
1864 } 1864 }
1865 } 1865 }
1866 inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s can, int src_left, 1866 inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s can, int src_left,
1867 const uint8_t* pPalette, int pixel_count , int blend_type, const uint8_t* clip_scan, 1867 const uint8_t* pPalette, int pixel_count , int blend_type, const uint8_t* clip_scan,
1868 uint8_t* dest_alpha_scan) 1868 uint8_t* dest_alpha_scan)
1869 { 1869 {
1870 int reset_gray = pPalette[0]; 1870 int reset_gray = pPalette[0];
1871 int set_gray = pPalette[1]; 1871 int set_gray = pPalette[1];
1872 if (blend_type) { 1872 if (blend_type) {
1873 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1873 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1874 int blended_color; 1874 int blended_color;
1875 for (int col = 0; col < pixel_count; col ++) { 1875 for (int col = 0; col < pixel_count; col ++) {
1876 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s rc_left) % 8))) ? set_gray : reset_gray; 1876 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s rc_left) % 8))) ? set_gray : reset_gray;
1877 if (clip_scan == NULL || clip_scan[col] == 255) { 1877 if (clip_scan == NULL || clip_scan[col] == 255) {
1878 *dest_scan++ = gray; 1878 *dest_scan++ = gray;
1879 *dest_alpha_scan ++ = 255; 1879 *dest_alpha_scan ++ = 255;
1880 continue; 1880 continue;
1881 } 1881 }
1882 int src_alpha = clip_scan[col]; 1882 int src_alpha = clip_scan[col];
1883 if (src_alpha == 0) { 1883 if (src_alpha == 0) {
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 2780 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
2781 *dest_alpha_scan++ = dest_alpha; 2781 *dest_alpha_scan++ = dest_alpha;
2782 int alpha_ratio = src_alpha * 255 / dest_alpha; 2782 int alpha_ratio = src_alpha * 255 / dest_alpha;
2783 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); 2783 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio);
2784 dest_scan ++; 2784 dest_scan ++;
2785 } 2785 }
2786 } 2786 }
2787 void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src _scan, int pixel_count, int blend_type, const uint8_t* clip_scan) 2787 void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src _scan, int pixel_count, int blend_type, const uint8_t* clip_scan)
2788 { 2788 {
2789 int blended_colors[3]; 2789 int blended_colors[3];
2790 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 2790 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
2791 for (int col = 0; col < pixel_count; col ++) { 2791 for (int col = 0; col < pixel_count; col ++) {
2792 uint8_t back_alpha = dest_scan[3]; 2792 uint8_t back_alpha = dest_scan[3];
2793 if (back_alpha == 0) { 2793 if (back_alpha == 0) {
2794 if (clip_scan) { 2794 if (clip_scan) {
2795 int src_alpha = clip_scan[col] * src_scan[3] / 255; 2795 int src_alpha = clip_scan[col] * src_scan[3] / 255;
2796 dest_scan[3] = src_alpha; 2796 dest_scan[3] = src_alpha;
2797 dest_scan[0] = src_scan[2]; 2797 dest_scan[0] = src_scan[2];
2798 dest_scan[1] = src_scan[1]; 2798 dest_scan[1] = src_scan[1];
2799 dest_scan[2] = src_scan[0]; 2799 dest_scan[2] = src_scan[0];
2800 } else { 2800 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 } 2837 }
2838 src_scan ++; 2838 src_scan ++;
2839 } 2839 }
2840 dest_scan += 4; 2840 dest_scan += 4;
2841 src_scan++; 2841 src_scan++;
2842 } 2842 }
2843 } 2843 }
2844 void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp) 2844 void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src_scan, int width, int blend_type, int src_Bpp)
2845 { 2845 {
2846 int blended_colors[3]; 2846 int blended_colors[3];
2847 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 2847 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
2848 int src_gap = src_Bpp - 3; 2848 int src_gap = src_Bpp - 3;
2849 for (int col = 0; col < width; col ++) { 2849 for (int col = 0; col < width; col ++) {
2850 uint8_t back_alpha = dest_scan[3]; 2850 uint8_t back_alpha = dest_scan[3];
2851 if (back_alpha == 0) { 2851 if (back_alpha == 0) {
2852 if (src_Bpp == 4) { 2852 if (src_Bpp == 4) {
2853 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_ scan)); 2853 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_ scan));
2854 } else { 2854 } else {
2855 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0])); 2855 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0]));
2856 } 2856 }
2857 dest_scan += 4; 2857 dest_scan += 4;
(...skipping 16 matching lines...) Expand all
2874 dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha) ; 2874 dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha) ;
2875 src_scan ++; 2875 src_scan ++;
2876 } 2876 }
2877 dest_scan += 4; 2877 dest_scan += 4;
2878 src_scan += src_gap; 2878 src_scan += src_gap;
2879 } 2879 }
2880 } 2880 }
2881 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) 2881 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)
2882 { 2882 {
2883 int blended_colors[3]; 2883 int blended_colors[3];
2884 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 2884 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
2885 for (int col = 0; col < width; col ++) { 2885 for (int col = 0; col < width; col ++) {
2886 uint8_t src_alpha; 2886 uint8_t src_alpha;
2887 if (clip_scan) { 2887 if (clip_scan) {
2888 src_alpha = src_scan[3] * (*clip_scan++) / 255; 2888 src_alpha = src_scan[3] * (*clip_scan++) / 255;
2889 } else { 2889 } else {
2890 src_alpha = src_scan[3]; 2890 src_alpha = src_scan[3];
2891 } 2891 }
2892 if (src_alpha == 0) { 2892 if (src_alpha == 0) {
2893 dest_scan += dest_Bpp; 2893 dest_scan += dest_Bpp;
2894 src_scan += 4; 2894 src_scan += 4;
(...skipping 26 matching lines...) Expand all
2921 } else { 2921 } else {
2922 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_ scan[1], src_scan[0])); 2922 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_ scan[1], src_scan[0]));
2923 } 2923 }
2924 dest_scan += 4; 2924 dest_scan += 4;
2925 src_scan += src_Bpp; 2925 src_scan += src_Bpp;
2926 } 2926 }
2927 } 2927 }
2928 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) 2928 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)
2929 { 2929 {
2930 int blended_colors[3]; 2930 int blended_colors[3];
2931 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 2931 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
2932 int src_gap = src_Bpp - 3; 2932 int src_gap = src_Bpp - 3;
2933 for (int col = 0; col < width; col ++) { 2933 for (int col = 0; col < width; col ++) {
2934 if (bNonseparableBlend) { 2934 if (bNonseparableBlend) {
2935 uint8_t dest_scan_o[3]; 2935 uint8_t dest_scan_o[3];
2936 dest_scan_o[0] = dest_scan[2]; 2936 dest_scan_o[0] = dest_scan[2];
2937 dest_scan_o[1] = dest_scan[1]; 2937 dest_scan_o[1] = dest_scan[1];
2938 dest_scan_o[2] = dest_scan[0]; 2938 dest_scan_o[2] = dest_scan[0];
2939 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 2939 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
2940 } 2940 }
2941 for (int color = 0; color < 3; color ++) { 2941 for (int color = 0; color < 3; color ++) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 dest_scan[2] = src_scan[0]; 2988 dest_scan[2] = src_scan[0];
2989 dest_scan[1] = src_scan[1]; 2989 dest_scan[1] = src_scan[1];
2990 dest_scan[0] = src_scan[2]; 2990 dest_scan[0] = src_scan[2];
2991 dest_scan += dest_Bpp; 2991 dest_scan += dest_Bpp;
2992 src_scan += src_Bpp; 2992 src_scan += src_Bpp;
2993 } 2993 }
2994 } 2994 }
2995 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) 2995 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)
2996 { 2996 {
2997 int blended_colors[3]; 2997 int blended_colors[3];
2998 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 2998 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
2999 int src_gap = src_Bpp - 3; 2999 int src_gap = src_Bpp - 3;
3000 for (int col = 0; col < width; col ++) { 3000 for (int col = 0; col < width; col ++) {
3001 int src_alpha = *clip_scan ++; 3001 int src_alpha = *clip_scan ++;
3002 uint8_t back_alpha = dest_scan[3]; 3002 uint8_t back_alpha = dest_scan[3];
3003 if (back_alpha == 0) { 3003 if (back_alpha == 0) {
3004 dest_scan[2] = FX_GAMMA(*src_scan++); 3004 dest_scan[2] = FX_GAMMA(*src_scan++);
3005 dest_scan[1] = FX_GAMMA(*src_scan++); 3005 dest_scan[1] = FX_GAMMA(*src_scan++);
3006 dest_scan[0] = FX_GAMMA(*src_scan++); 3006 dest_scan[0] = FX_GAMMA(*src_scan++);
3007 src_scan += src_gap; 3007 src_scan += src_gap;
3008 dest_scan += 4; 3008 dest_scan += 4;
(...skipping 23 matching lines...) Expand all
3032 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], blended, alph a_ratio); 3032 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], blended, alph a_ratio);
3033 src_scan ++; 3033 src_scan ++;
3034 } 3034 }
3035 dest_scan += 4; 3035 dest_scan += 4;
3036 src_scan += src_gap; 3036 src_scan += src_gap;
3037 } 3037 }
3038 } 3038 }
3039 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) 3039 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)
3040 { 3040 {
3041 int blended_colors[3]; 3041 int blended_colors[3];
3042 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 3042 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
3043 int src_gap = src_Bpp - 3; 3043 int src_gap = src_Bpp - 3;
3044 for (int col = 0; col < width; col ++) { 3044 for (int col = 0; col < width; col ++) {
3045 uint8_t src_alpha = *clip_scan ++; 3045 uint8_t src_alpha = *clip_scan ++;
3046 if (src_alpha == 0) { 3046 if (src_alpha == 0) {
3047 dest_scan += dest_Bpp; 3047 dest_scan += dest_Bpp;
3048 src_scan += src_Bpp; 3048 src_scan += src_Bpp;
3049 continue; 3049 continue;
3050 } 3050 }
3051 if (bNonseparableBlend) { 3051 if (bNonseparableBlend) {
3052 uint8_t dest_scan_o[3]; 3052 uint8_t dest_scan_o[3];
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
3488 blended = _BLEND(blend_type, back_color, src_r); 3488 blended = _BLEND(blend_type, back_color, src_r);
3489 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blende d, src_alpha)); 3489 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blende d, src_alpha));
3490 } else { 3490 } else {
3491 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan [2]), src_b, src_alpha)); 3491 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan [2]), src_b, src_alpha));
3492 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan [1]), src_g, src_alpha)); 3492 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan [1]), src_g, src_alpha));
3493 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan [0]), src_r, src_alpha)); 3493 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan [0]), src_r, src_alpha));
3494 } 3494 }
3495 dest_scan += Bpp; 3495 dest_scan += Bpp;
3496 } 3496 }
3497 } 3497 }
3498 inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int alpha_flag, FX_DWORD mask_color, int& mask_alpha, 3498 inline bool _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int alp ha_flag, FX_DWORD mask_color, int& mask_alpha,
3499 int& mask_red, int& mask_green, int& mask_blue, int& mask_black, 3499 int& mask_red, int& mask_green, int& mask_blue, int& mask_black,
3500 void* icc_module, void* pIccTransform) 3500 void* icc_module, void* pIccTransform)
3501 { 3501 {
3502 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; 3502 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module;
3503 if (alpha_flag >> 8) { 3503 if (alpha_flag >> 8) {
3504 mask_alpha = alpha_flag & 0xff; 3504 mask_alpha = alpha_flag & 0xff;
3505 mask_red = FXSYS_GetCValue(mask_color); 3505 mask_red = FXSYS_GetCValue(mask_color);
3506 mask_green = FXSYS_GetMValue(mask_color); 3506 mask_green = FXSYS_GetMValue(mask_color);
3507 mask_blue = FXSYS_GetYValue(mask_color); 3507 mask_blue = FXSYS_GetYValue(mask_color);
3508 mask_black = FXSYS_GetKValue(mask_color); 3508 mask_black = FXSYS_GetKValue(mask_color);
3509 } else { 3509 } else {
3510 mask_alpha = FXARGB_A(mask_color); 3510 mask_alpha = FXARGB_A(mask_color);
3511 mask_red = FXARGB_R(mask_color); 3511 mask_red = FXARGB_R(mask_color);
3512 mask_green = FXARGB_G(mask_color); 3512 mask_green = FXARGB_G(mask_color);
3513 mask_blue = FXARGB_B(mask_color); 3513 mask_blue = FXARGB_B(mask_color);
3514 } 3514 }
3515 if (dest_format == FXDIB_8bppMask) { 3515 if (dest_format == FXDIB_8bppMask) {
3516 return TRUE; 3516 return true;
3517 } 3517 }
3518 if ((dest_format & 0xff) == 8) { 3518 if ((dest_format & 0xff) == 8) {
3519 if (pIccTransform) { 3519 if (pIccTransform) {
3520 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_T ODIB(mask_color); 3520 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_T ODIB(mask_color);
3521 uint8_t* gray_p = (uint8_t*)&mask_color; 3521 uint8_t* gray_p = (uint8_t*)&mask_color;
3522 pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); 3522 pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1);
3523 mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; 3523 mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0];
3524 } else { 3524 } else {
3525 if (alpha_flag >> 8) { 3525 if (alpha_flag >> 8) {
3526 uint8_t r, g, b; 3526 uint8_t r, g, b;
(...skipping 16 matching lines...) Expand all
3543 mask_green = mask_color_p[1]; 3543 mask_green = mask_color_p[1];
3544 mask_blue = mask_color_p[0]; 3544 mask_blue = mask_color_p[0];
3545 } else if (alpha_flag >> 8) { 3545 } else if (alpha_flag >> 8) {
3546 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2] , mask_color_p[3], 3546 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2] , mask_color_p[3],
3547 mask_color_p[2], mask_color_p[1], mask_color_p[0] ); 3547 mask_color_p[2], mask_color_p[1], mask_color_p[0] );
3548 mask_red = mask_color_p[2]; 3548 mask_red = mask_color_p[2];
3549 mask_green = mask_color_p[1]; 3549 mask_green = mask_color_p[1];
3550 mask_blue = mask_color_p[0]; 3550 mask_blue = mask_color_p[0];
3551 } 3551 }
3552 } 3552 }
3553 return TRUE; 3553 return true;
3554 } 3554 }
3555 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB _Format dest_format, 3555 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB _Format dest_format,
3556 FX_DWORD*& pDestPalette, FX_DWORD* pSrcPalette, 3556 FX_DWORD*& pDestPalette, FX_DWORD* pSrcPalette,
3557 void* icc_module, void* pIccTransform) 3557 void* icc_module, void* pIccTransform)
3558 { 3558 {
3559 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; 3559 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module;
3560 FX_BOOL isSrcCmyk = src_format & 0x0400 ? TRUE : FALSE; 3560 bool isSrcCmyk = src_format & 0x0400 ? true : false;
3561 FX_BOOL isDstCmyk = dest_format & 0x0400 ? TRUE : FALSE; 3561 bool isDstCmyk = dest_format & 0x0400 ? true : false;
3562 pDestPalette = NULL; 3562 pDestPalette = NULL;
3563 if (pIccTransform) { 3563 if (pIccTransform) {
3564 if (pSrcPalette) { 3564 if (pSrcPalette) {
3565 if ((dest_format & 0xff) == 8) { 3565 if ((dest_format & 0xff) == 8) {
3566 int pal_count = 1 << (src_format & 0xff); 3566 int pal_count = 1 << (src_format & 0xff);
3567 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); 3567 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count);
3568 pDestPalette = (FX_DWORD*)gray_pal; 3568 pDestPalette = (FX_DWORD*)gray_pal;
3569 for (int i = 0; i < pal_count; i ++) { 3569 for (int i = 0; i < pal_count; i ++) {
3570 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); 3570 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]);
3571 pIccModule->TranslateScanline(pIccTransform, gray_pal, (cons t uint8_t*)&color, 1); 3571 pIccModule->TranslateScanline(pIccTransform, gray_pal, (cons t uint8_t*)&color, 1);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3672 } 3672 }
3673 } 3673 }
3674 } 3674 }
3675 } 3675 }
3676 } 3676 }
3677 CFX_ScanlineCompositor::CFX_ScanlineCompositor() 3677 CFX_ScanlineCompositor::CFX_ScanlineCompositor()
3678 { 3678 {
3679 m_pSrcPalette = NULL; 3679 m_pSrcPalette = NULL;
3680 m_pCacheScanline = NULL; 3680 m_pCacheScanline = NULL;
3681 m_CacheSize = 0; 3681 m_CacheSize = 0;
3682 m_bRgbByteOrder = FALSE; 3682 m_bRgbByteOrder = false;
3683 m_BlendType = FXDIB_BLEND_NORMAL; 3683 m_BlendType = FXDIB_BLEND_NORMAL;
3684 } 3684 }
3685 CFX_ScanlineCompositor::~CFX_ScanlineCompositor() 3685 CFX_ScanlineCompositor::~CFX_ScanlineCompositor()
3686 { 3686 {
3687 if (m_pSrcPalette) { 3687 if (m_pSrcPalette) {
3688 FX_Free(m_pSrcPalette); 3688 FX_Free(m_pSrcPalette);
3689 } 3689 }
3690 if (m_pCacheScanline) { 3690 if (m_pCacheScanline) {
3691 FX_Free(m_pCacheScanline); 3691 FX_Free(m_pCacheScanline);
3692 } 3692 }
3693 } 3693 }
3694 FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ format, int32_t width, FX_DWORD* pSrcPalette, 3694 bool CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_for mat, int32_t width, FX_DWORD* pSrcPalette,
3695 FX_DWORD mask_color, int blend_type, FX_BOO L bClip, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) 3695 FX_DWORD mask_color, int blend_type, bool b Clip, bool bRgbByteOrder, int alpha_flag, void* pIccTransform)
3696 { 3696 {
3697 m_SrcFormat = src_format; 3697 m_SrcFormat = src_format;
3698 m_DestFormat = dest_format; 3698 m_DestFormat = dest_format;
3699 m_BlendType = blend_type; 3699 m_BlendType = blend_type;
3700 m_bRgbByteOrder = bRgbByteOrder; 3700 m_bRgbByteOrder = bRgbByteOrder;
3701 ICodec_IccModule* pIccModule = NULL; 3701 ICodec_IccModule* pIccModule = NULL;
3702 if (CFX_GEModule::Get()->GetCodecModule()) { 3702 if (CFX_GEModule::Get()->GetCodecModule()) {
3703 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 3703 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
3704 } 3704 }
3705 if (pIccModule == NULL) { 3705 if (pIccModule == NULL) {
3706 pIccTransform = NULL; 3706 pIccTransform = NULL;
3707 } 3707 }
3708 m_pIccTransform = pIccTransform; 3708 m_pIccTransform = pIccTransform;
3709 if ((dest_format & 0xff) == 1) { 3709 if ((dest_format & 0xff) == 1) {
3710 return FALSE; 3710 return false;
3711 } 3711 }
3712 if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { 3712 if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) {
3713 return _ScanlineCompositor_InitSourceMask(dest_format, alpha_flag, mask_ color, 3713 return _ScanlineCompositor_InitSourceMask(dest_format, alpha_flag, mask_ color,
3714 m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack, 3714 m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack,
3715 pIccModule, pIccTransform); 3715 pIccModule, pIccTransform);
3716 } 3716 }
3717 if (pIccTransform == NULL && (~src_format & 0x0400) && (dest_format & 0x0400 )) { 3717 if (pIccTransform == NULL && (~src_format & 0x0400) && (dest_format & 0x0400 )) {
3718 return FALSE; 3718 return false;
3719 } 3719 }
3720 if ((m_SrcFormat & 0xff) <= 8) { 3720 if ((m_SrcFormat & 0xff) <= 8) {
3721 if (dest_format == FXDIB_8bppMask) { 3721 if (dest_format == FXDIB_8bppMask) {
3722 return TRUE; 3722 return true;
3723 } 3723 }
3724 _ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPal ette, pSrcPalette, 3724 _ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPal ette, pSrcPalette,
3725 pIccModule, pIccTransform); 3725 pIccModule, pIccTransform);
3726 m_Transparency = (dest_format == FXDIB_Argb ? 1 : 0) 3726 m_Transparency = (dest_format == FXDIB_Argb ? 1 : 0)
3727 + (dest_format & 0x0200 ? 2 : 0) 3727 + (dest_format & 0x0200 ? 2 : 0)
3728 + (dest_format & 0x0400 ? 4 : 0) 3728 + (dest_format & 0x0400 ? 4 : 0)
3729 + ((src_format & 0xff) == 1 ? 8 : 0); 3729 + ((src_format & 0xff) == 1 ? 8 : 0);
3730 return TRUE; 3730 return true;
3731 } 3731 }
3732 m_Transparency = (src_format & 0x0200 ? 0 : 1) 3732 m_Transparency = (src_format & 0x0200 ? 0 : 1)
3733 + (dest_format & 0x0200 ? 0 : 2) 3733 + (dest_format & 0x0200 ? 0 : 2)
3734 + (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) 3734 + (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0)
3735 + (bClip ? 8 : 0) 3735 + (bClip ? 8 : 0)
3736 + (src_format & 0x0400 ? 16 : 0) 3736 + (src_format & 0x0400 ? 16 : 0)
3737 + (dest_format & 0x0400 ? 32 : 0) 3737 + (dest_format & 0x0400 ? 32 : 0)
3738 + (pIccTransform ? 64 : 0); 3738 + (pIccTransform ? 64 : 0);
3739 return TRUE; 3739 return true;
3740 } 3740 }
3741 void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const ui nt8_t* src_scan, int width, const uint8_t* clip_scan, 3741 void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const ui nt8_t* src_scan, int width, const uint8_t* clip_scan,
3742 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) 3742 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha)
3743 { 3743 {
3744 int src_Bpp = (m_SrcFormat & 0xff) >> 3; 3744 int src_Bpp = (m_SrcFormat & 0xff) >> 3;
3745 int dest_Bpp = (m_DestFormat & 0xff) >> 3; 3745 int dest_Bpp = (m_DestFormat & 0xff) >> 3;
3746 if (m_bRgbByteOrder) { 3746 if (m_bRgbByteOrder) {
3747 switch (m_Transparency) { 3747 switch (m_Transparency) {
3748 case 0: 3748 case 0:
3749 case 4: 3749 case 4:
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
4052 _CompositeRow_BitMask2Rgb_RgbByteOrder(dest_scan, src_scan, m_MaskAl pha, m_MaskRed, m_MaskGreen, m_MaskBlue, 4052 _CompositeRow_BitMask2Rgb_RgbByteOrder(dest_scan, src_scan, m_MaskAl pha, m_MaskRed, m_MaskGreen, m_MaskBlue,
4053 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); 4053 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
4054 return; 4054 return;
4055 } else if (m_DestFormat == FXDIB_Argb) 4055 } else if (m_DestFormat == FXDIB_Argb)
4056 _CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, 4056 _CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
4057 src_left, width, m_BlendType, clip_scan); 4057 src_left, width, m_BlendType, clip_scan);
4058 else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) 4058 else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32)
4059 _CompositeRow_BitMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m _MaskGreen, m_MaskBlue, 4059 _CompositeRow_BitMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m _MaskGreen, m_MaskBlue,
4060 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); 4060 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
4061 } 4061 }
4062 FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, in t height, 4062 bool CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, int h eight,
4063 const CFX_DIBSource* pSrcBitmap, int src_l eft, int src_top, 4063 const CFX_DIBSource* pSrcBitmap, int src_l eft, int src_top,
4064 int blend_type, const CFX_ClipRgn* pClipRg n, FX_BOOL bRgbByteOrder, void* pIccTransform) 4064 int blend_type, const CFX_ClipRgn* pClipRg n, bool bRgbByteOrder, void* pIccTransform)
4065 { 4065 {
4066 if (m_pBuffer == NULL) { 4066 if (m_pBuffer == NULL) {
4067 return FALSE; 4067 return false;
4068 } 4068 }
4069 ASSERT(!pSrcBitmap->IsAlphaMask()); 4069 ASSERT(!pSrcBitmap->IsAlphaMask());
4070 ASSERT(m_bpp >= 8); 4070 ASSERT(m_bpp >= 8);
4071 if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { 4071 if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) {
4072 return FALSE; 4072 return false;
4073 } 4073 }
4074 GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), p SrcBitmap->GetHeight(), 4074 GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), p SrcBitmap->GetHeight(),
4075 src_left, src_top, pClipRgn); 4075 src_left, src_top, pClipRgn);
4076 if (width == 0 || height == 0) { 4076 if (width == 0 || height == 0) {
4077 return TRUE; 4077 return true;
4078 } 4078 }
4079 const CFX_DIBitmap* pClipMask = NULL; 4079 const CFX_DIBitmap* pClipMask = NULL;
4080 FX_RECT clip_box; 4080 FX_RECT clip_box;
4081 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { 4081 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
4082 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); 4082 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
4083 pClipMask = pClipRgn->GetMask(); 4083 pClipMask = pClipRgn->GetMask();
4084 clip_box = pClipRgn->GetBox(); 4084 clip_box = pClipRgn->GetBox();
4085 } 4085 }
4086 CFX_ScanlineCompositor compositor; 4086 CFX_ScanlineCompositor compositor;
4087 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap ->GetPalette(), 0, blend_type, 4087 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap ->GetPalette(), 0, blend_type,
4088 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { 4088 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) {
4089 return FALSE; 4089 return false;
4090 } 4090 }
4091 int dest_Bpp = m_bpp / 8; 4091 int dest_Bpp = m_bpp / 8;
4092 int src_Bpp = pSrcBitmap->GetBPP() / 8; 4092 int src_Bpp = pSrcBitmap->GetBPP() / 8;
4093 FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); 4093 bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage();
4094 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; 4094 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask;
4095 for (int row = 0; row < height; row ++) { 4095 for (int row = 0; row < height; row ++) {
4096 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; 4096 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp;
4097 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_l eft * src_Bpp; 4097 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_l eft * src_Bpp;
4098 const uint8_t* src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->Get Scanline(src_top + row) + src_left : NULL; 4098 const uint8_t* src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->Get Scanline(src_top + row) + src_left : NULL;
4099 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G etScanline(dest_top + row) + dest_left : NULL; 4099 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G etScanline(dest_top + row) + dest_left : NULL;
4100 const uint8_t* clip_scan = NULL; 4100 const uint8_t* clip_scan = NULL;
4101 if (pClipMask) { 4101 if (pClipMask) {
4102 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) * pClipMask->m_Pitch + (dest_left - clip_box.left); 4102 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) * pClipMask->m_Pitch + (dest_left - clip_box.left);
4103 } 4103 }
4104 if (bRgb) { 4104 if (bRgb) {
4105 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_s can, src_scan_extra_alpha, dst_scan_extra_alpha); 4105 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_s can, src_scan_extra_alpha, dst_scan_extra_alpha);
4106 } else { 4106 } else {
4107 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, wid th, clip_scan, src_scan_extra_alpha, dst_scan_extra_alpha); 4107 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, wid th, clip_scan, src_scan_extra_alpha, dst_scan_extra_alpha);
4108 } 4108 }
4109 } 4109 }
4110 return TRUE; 4110 return true;
4111 } 4111 }
4112 FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int height, 4112 bool CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int hei ght,
4113 const CFX_DIBSource* pMask, FX_DWORD color, int src_left, int src_top, 4113 const CFX_DIBSource* pMask, FX_DWORD color, int src_left, int src_top,
4114 int blend_type, const CFX_ClipRgn* pClipRgn, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) 4114 int blend_type, const CFX_ClipRgn* pClipRgn, bool bRgbByteOrder, int alpha_flag, void* pIccTransform)
4115 { 4115 {
4116 if (m_pBuffer == NULL) { 4116 if (m_pBuffer == NULL) {
4117 return FALSE; 4117 return false;
4118 } 4118 }
4119 ASSERT(pMask->IsAlphaMask()); 4119 ASSERT(pMask->IsAlphaMask());
4120 ASSERT(m_bpp >= 8); 4120 ASSERT(m_bpp >= 8);
4121 if (!pMask->IsAlphaMask() || m_bpp < 8) { 4121 if (!pMask->IsAlphaMask() || m_bpp < 8) {
4122 return FALSE; 4122 return false;
4123 } 4123 }
4124 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask- >GetHeight(), src_left, src_top, pClipRgn); 4124 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask- >GetHeight(), src_left, src_top, pClipRgn);
4125 if (width == 0 || height == 0) { 4125 if (width == 0 || height == 0) {
4126 return TRUE; 4126 return true;
4127 } 4127 }
4128 int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A( color); 4128 int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A( color);
4129 if (src_alpha == 0) { 4129 if (src_alpha == 0) {
4130 return TRUE; 4130 return true;
4131 } 4131 }
4132 const CFX_DIBitmap* pClipMask = NULL; 4132 const CFX_DIBitmap* pClipMask = NULL;
4133 FX_RECT clip_box; 4133 FX_RECT clip_box;
4134 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { 4134 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
4135 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); 4135 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
4136 pClipMask = pClipRgn->GetMask(); 4136 pClipMask = pClipRgn->GetMask();
4137 clip_box = pClipRgn->GetBox(); 4137 clip_box = pClipRgn->GetBox();
4138 } 4138 }
4139 int src_bpp = pMask->GetBPP(); 4139 int src_bpp = pMask->GetBPP();
4140 int Bpp = GetBPP() / 8; 4140 int Bpp = GetBPP() / 8;
4141 CFX_ScanlineCompositor compositor; 4141 CFX_ScanlineCompositor compositor;
4142 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, bl end_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, pIccTransform)) { 4142 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, bl end_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, pIccTransform)) {
4143 return FALSE; 4143 return false;
4144 } 4144 }
4145 for (int row = 0; row < height; row ++) { 4145 for (int row = 0; row < height; row ++) {
4146 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; 4146 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp;
4147 const uint8_t* src_scan = pMask->GetScanline(src_top + row); 4147 const uint8_t* src_scan = pMask->GetScanline(src_top + row);
4148 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G etScanline(dest_top + row) + dest_left : NULL; 4148 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G etScanline(dest_top + row) + dest_left : NULL;
4149 const uint8_t* clip_scan = NULL; 4149 const uint8_t* clip_scan = NULL;
4150 if (pClipMask) { 4150 if (pClipMask) {
4151 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) * pClipMask->m_Pitch + (dest_left - clip_box.left); 4151 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) * pClipMask->m_Pitch + (dest_left - clip_box.left);
4152 } 4152 }
4153 if (src_bpp == 1) { 4153 if (src_bpp == 1) {
4154 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width , clip_scan, dst_scan_extra_alpha); 4154 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width , clip_scan, dst_scan_extra_alpha);
4155 } else { 4155 } else {
4156 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, wid th, clip_scan, dst_scan_extra_alpha); 4156 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, wid th, clip_scan, dst_scan_extra_alpha);
4157 } 4157 }
4158 } 4158 }
4159 return TRUE; 4159 return true;
4160 } 4160 }
4161 FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX _DWORD color, int alpha_flag, void* pIccTransform) 4161 bool CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX_DW ORD color, int alpha_flag, void* pIccTransform)
4162 { 4162 {
4163 if (m_pBuffer == NULL) { 4163 if (m_pBuffer == NULL) {
4164 return FALSE; 4164 return false;
4165 } 4165 }
4166 int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); 4166 int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color);
4167 if (src_alpha == 0) { 4167 if (src_alpha == 0) {
4168 return TRUE; 4168 return true;
4169 } 4169 }
4170 FX_RECT rect(left, top, left + width, top + height); 4170 FX_RECT rect(left, top, left + width, top + height);
4171 rect.Intersect(0, 0, m_Width, m_Height); 4171 rect.Intersect(0, 0, m_Width, m_Height);
4172 if (rect.IsEmpty()) { 4172 if (rect.IsEmpty()) {
4173 return TRUE; 4173 return true;
4174 } 4174 }
4175 width = rect.Width(); 4175 width = rect.Width();
4176 FX_DWORD dst_color; 4176 FX_DWORD dst_color;
4177 if (alpha_flag >> 8) { 4177 if (alpha_flag >> 8) {
4178 dst_color = FXCMYK_TODIB(color); 4178 dst_color = FXCMYK_TODIB(color);
4179 } else { 4179 } else {
4180 dst_color = FXARGB_TODIB(color); 4180 dst_color = FXARGB_TODIB(color);
4181 } 4181 }
4182 uint8_t* color_p = (uint8_t*)&dst_color; 4182 uint8_t* color_p = (uint8_t*)&dst_color;
4183 if (m_bpp == 8) { 4183 if (m_bpp == 8) {
(...skipping 19 matching lines...) Expand all
4203 for (int row = rect.top; row < rect.bottom; row ++) { 4203 for (int row = rect.top; row < rect.bottom; row ++) {
4204 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; 4204 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left;
4205 if (src_alpha == 255) { 4205 if (src_alpha == 255) {
4206 FXSYS_memset(dest_scan, gray, width); 4206 FXSYS_memset(dest_scan, gray, width);
4207 } else 4207 } else
4208 for (int col = 0; col < width; col ++) { 4208 for (int col = 0; col < width; col ++) {
4209 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 4209 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
4210 dest_scan ++; 4210 dest_scan ++;
4211 } 4211 }
4212 } 4212 }
4213 return TRUE; 4213 return true;
4214 } 4214 }
4215 if (m_bpp == 1) { 4215 if (m_bpp == 1) {
4216 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); 4216 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0);
4217 int left_shift = rect.left % 8; 4217 int left_shift = rect.left % 8;
4218 int right_shift = rect.right % 8; 4218 int right_shift = rect.right % 8;
4219 int width = rect.right / 8 - rect.left / 8; 4219 int width = rect.right / 8 - rect.left / 8;
4220 int index = 0; 4220 int index = 0;
4221 if (m_pPalette == NULL) { 4221 if (m_pPalette == NULL) {
4222 index = ((uint8_t)color == 0xff) ? 1 : 0; 4222 index = ((uint8_t)color == 0xff) ? 1 : 0;
4223 } else { 4223 } else {
(...skipping 17 matching lines...) Expand all
4241 *dest_scan_top_r |= ~right_flag; 4241 *dest_scan_top_r |= ~right_flag;
4242 } 4242 }
4243 } else { 4243 } else {
4244 if (!index) { 4244 if (!index) {
4245 *dest_scan_top &= left_flag | right_flag; 4245 *dest_scan_top &= left_flag | right_flag;
4246 } else { 4246 } else {
4247 *dest_scan_top |= ~(left_flag | right_flag); 4247 *dest_scan_top |= ~(left_flag | right_flag);
4248 } 4248 }
4249 } 4249 }
4250 } 4250 }
4251 return TRUE; 4251 return true;
4252 } 4252 }
4253 ASSERT(m_bpp >= 24); 4253 ASSERT(m_bpp >= 24);
4254 if (m_bpp < 24) { 4254 if (m_bpp < 24) {
4255 return FALSE; 4255 return false;
4256 } 4256 }
4257 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { 4257 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) {
4258 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->Ge tIccModule(); 4258 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->Ge tIccModule();
4259 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); 4259 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1);
4260 } else { 4260 } else {
4261 if (alpha_flag >> 8 && !IsCmykImage()) 4261 if (alpha_flag >> 8 && !IsCmykImage())
4262 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), F XSYS_GetYValue(color), FXSYS_GetKValue(color), 4262 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), F XSYS_GetYValue(color), FXSYS_GetKValue(color),
4263 color_p[2], color_p[1], color_p[0]); 4263 color_p[2], color_p[1], color_p[0]);
4264 else if (!(alpha_flag >> 8) && IsCmykImage()) { 4264 else if (!(alpha_flag >> 8) && IsCmykImage()) {
4265 return FALSE; 4265 return false;
4266 } 4266 }
4267 } 4267 }
4268 if(!IsCmykImage()) { 4268 if(!IsCmykImage()) {
4269 color_p[3] = (uint8_t)src_alpha; 4269 color_p[3] = (uint8_t)src_alpha;
4270 } 4270 }
4271 int Bpp = m_bpp / 8; 4271 int Bpp = m_bpp / 8;
4272 FX_BOOL bAlpha = HasAlpha(); 4272 bool bAlpha = HasAlpha();
4273 FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; 4273 bool bArgb = GetFormat() == FXDIB_Argb ? true : false;
4274 if (src_alpha == 255) { 4274 if (src_alpha == 255) {
4275 for (int row = rect.top; row < rect.bottom; row ++) { 4275 for (int row = rect.top; row < rect.bottom; row ++) {
4276 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; 4276 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp;
4277 uint8_t* dest_scan_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->Ge tScanline(row) + rect.left : NULL; 4277 uint8_t* dest_scan_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->Ge tScanline(row) + rect.left : NULL;
4278 if (dest_scan_alpha) { 4278 if (dest_scan_alpha) {
4279 FXSYS_memset(dest_scan_alpha, 0xff, width); 4279 FXSYS_memset(dest_scan_alpha, 0xff, width);
4280 } 4280 }
4281 if (Bpp == 4) { 4281 if (Bpp == 4) {
4282 FX_DWORD* scan = (FX_DWORD*)dest_scan; 4282 FX_DWORD* scan = (FX_DWORD*)dest_scan;
4283 for (int col = 0; col < width; col ++) { 4283 for (int col = 0; col < width; col ++) {
4284 *scan ++ = dst_color; 4284 *scan ++ = dst_color;
4285 } 4285 }
4286 } else { 4286 } else {
4287 for (int col = 0; col < width; col ++) { 4287 for (int col = 0; col < width; col ++) {
4288 *dest_scan ++ = color_p[0]; 4288 *dest_scan ++ = color_p[0];
4289 *dest_scan ++ = color_p[1]; 4289 *dest_scan ++ = color_p[1];
4290 *dest_scan ++ = color_p[2]; 4290 *dest_scan ++ = color_p[2];
4291 } 4291 }
4292 } 4292 }
4293 } 4293 }
4294 return TRUE; 4294 return true;
4295 } 4295 }
4296 for (int row = rect.top; row < rect.bottom; row ++) { 4296 for (int row = rect.top; row < rect.bottom; row ++) {
4297 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; 4297 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp;
4298 if (bAlpha) { 4298 if (bAlpha) {
4299 if (bArgb) { 4299 if (bArgb) {
4300 for (int col = 0; col < width; col ++) { 4300 for (int col = 0; col < width; col ++) {
4301 uint8_t back_alpha = dest_scan[3]; 4301 uint8_t back_alpha = dest_scan[3];
4302 if (back_alpha == 0) { 4302 if (back_alpha == 0) {
4303 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[ 2], color_p[1], color_p[0])); 4303 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[ 2], color_p[1], color_p[0]));
4304 dest_scan += 4; 4304 dest_scan += 4;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4339 if (comps == 3) { 4339 if (comps == 3) {
4340 *dest_scan ++ = 255; 4340 *dest_scan ++ = 255;
4341 continue; 4341 continue;
4342 } 4342 }
4343 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], s rc_alpha); 4343 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], s rc_alpha);
4344 dest_scan ++; 4344 dest_scan ++;
4345 } 4345 }
4346 } 4346 }
4347 } 4347 }
4348 } 4348 }
4349 return TRUE; 4349 return true;
4350 } 4350 }
4351 CFX_BitmapComposer::CFX_BitmapComposer() 4351 CFX_BitmapComposer::CFX_BitmapComposer()
4352 { 4352 {
4353 m_pScanlineV = NULL; 4353 m_pScanlineV = NULL;
4354 m_pScanlineAlphaV = NULL; 4354 m_pScanlineAlphaV = NULL;
4355 m_pClipScanV = NULL; 4355 m_pClipScanV = NULL;
4356 m_pAddClipScan = NULL; 4356 m_pAddClipScan = NULL;
4357 m_bRgbByteOrder = FALSE; 4357 m_bRgbByteOrder = false;
4358 m_BlendType = FXDIB_BLEND_NORMAL; 4358 m_BlendType = FXDIB_BLEND_NORMAL;
4359 } 4359 }
4360 CFX_BitmapComposer::~CFX_BitmapComposer() 4360 CFX_BitmapComposer::~CFX_BitmapComposer()
4361 { 4361 {
4362 if (m_pScanlineV) { 4362 if (m_pScanlineV) {
4363 FX_Free(m_pScanlineV); 4363 FX_Free(m_pScanlineV);
4364 } 4364 }
4365 if (m_pScanlineAlphaV) { 4365 if (m_pScanlineAlphaV) {
4366 FX_Free(m_pScanlineAlphaV); 4366 FX_Free(m_pScanlineAlphaV);
4367 } 4367 }
4368 if (m_pClipScanV) { 4368 if (m_pClipScanV) {
4369 FX_Free(m_pClipScanV); 4369 FX_Free(m_pClipScanV);
4370 } 4370 }
4371 if (m_pAddClipScan) { 4371 if (m_pAddClipScan) {
4372 FX_Free(m_pAddClipScan); 4372 FX_Free(m_pAddClipScan);
4373 } 4373 }
4374 } 4374 }
4375 void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRg n, int bitmap_alpha, 4375 void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRg n, int bitmap_alpha,
4376 FX_DWORD mask_color, FX_RECT& dest_rect, FX_BOO L bVertical, 4376 FX_DWORD mask_color, FX_RECT& dest_rect, bool b Vertical,
4377 FX_BOOL bFlipX, FX_BOOL bFlipY, FX_BOOL bRgbByt eOrder, 4377 bool bFlipX, bool bFlipY, bool bRgbByteOrder,
4378 int alpha_flag, void* pIccTransform, int blend_ type) 4378 int alpha_flag, void* pIccTransform, int blend_ type)
4379 { 4379 {
4380 m_pBitmap = pDest; 4380 m_pBitmap = pDest;
4381 m_pClipRgn = pClipRgn; 4381 m_pClipRgn = pClipRgn;
4382 m_DestLeft = dest_rect.left; 4382 m_DestLeft = dest_rect.left;
4383 m_DestTop = dest_rect.top; 4383 m_DestTop = dest_rect.top;
4384 m_DestWidth = dest_rect.Width(); 4384 m_DestWidth = dest_rect.Width();
4385 m_DestHeight = dest_rect.Height(); 4385 m_DestHeight = dest_rect.Height();
4386 m_BitmapAlpha = bitmap_alpha; 4386 m_BitmapAlpha = bitmap_alpha;
4387 m_MaskColor = mask_color; 4387 m_MaskColor = mask_color;
4388 m_pClipMask = NULL; 4388 m_pClipMask = NULL;
4389 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { 4389 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
4390 m_pClipMask = pClipRgn->GetMask(); 4390 m_pClipMask = pClipRgn->GetMask();
4391 } 4391 }
4392 m_bVertical = bVertical; 4392 m_bVertical = bVertical;
4393 m_bFlipX = bFlipX; 4393 m_bFlipX = bFlipX;
4394 m_bFlipY = bFlipY; 4394 m_bFlipY = bFlipY;
4395 m_AlphaFlag = alpha_flag; 4395 m_AlphaFlag = alpha_flag;
4396 m_pIccTransform = pIccTransform; 4396 m_pIccTransform = pIccTransform;
4397 m_bRgbByteOrder = bRgbByteOrder; 4397 m_bRgbByteOrder = bRgbByteOrder;
4398 m_BlendType = blend_type; 4398 m_BlendType = blend_type;
4399 } 4399 }
4400 FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form at, FX_DWORD* pSrcPalette) 4400 bool CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_format, FX_DWORD* pSrcPalette)
4401 { 4401 {
4402 m_SrcFormat = src_format; 4402 m_SrcFormat = src_format;
4403 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalett e, m_MaskColor, FXDIB_BLEND_NORMAL, 4403 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalett e, m_MaskColor, FXDIB_BLEND_NORMAL,
4404 m_pClipMask != NULL || (m_BitmapAlpha < 255), m_bRgbB yteOrder, m_AlphaFlag, m_pIccTransform)) { 4404 m_pClipMask != NULL || (m_BitmapAlpha < 255), m_bRgbB yteOrder, m_AlphaFlag, m_pIccTransform)) {
4405 return FALSE; 4405 return false;
4406 } 4406 }
4407 if (m_bVertical) { 4407 if (m_bVertical) {
4408 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); 4408 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4);
4409 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); 4409 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight());
4410 if (m_pBitmap->m_pAlphaMask) { 4410 if (m_pBitmap->m_pAlphaMask) {
4411 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); 4411 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4);
4412 } 4412 }
4413 } 4413 }
4414 if (m_BitmapAlpha < 255) { 4414 if (m_BitmapAlpha < 255) {
4415 m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); 4415 m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth());
4416 } 4416 }
4417 return TRUE; 4417 return true;
4418 } 4418 }
4419 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, const uint8_t* src_scan, int dest_width, const uint8_t* clip_scan, 4419 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, const uint8_t* src_scan, int dest_width, const uint8_t* clip_scan,
4420 const uint8_t* src_extra_alpha, uint8_t* dst_ extra_alpha) 4420 const uint8_t* src_extra_alpha, uint8_t* dst_ extra_alpha)
4421 { 4421 {
4422 if (m_BitmapAlpha < 255) { 4422 if (m_BitmapAlpha < 255) {
4423 if (clip_scan) { 4423 if (clip_scan) {
4424 for (int i = 0; i < dest_width; i ++) { 4424 for (int i = 0; i < dest_width; i ++) {
4425 m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255; 4425 m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255;
4426 } 4426 }
4427 } else { 4427 } else {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
4515 } 4515 }
4516 src_alpha_scan = m_pScanlineAlphaV; 4516 src_alpha_scan = m_pScanlineAlphaV;
4517 dest_alpha_scan = dest_alpha_buf; 4517 dest_alpha_scan = dest_alpha_buf;
4518 if (dest_alpha_scan) { 4518 if (dest_alpha_scan) {
4519 for (i = 0; i < m_DestHeight; i ++) { 4519 for (i = 0; i < m_DestHeight; i ++) {
4520 *dest_alpha_scan = *src_alpha_scan++; 4520 *dest_alpha_scan = *src_alpha_scan++;
4521 dest_alpha_scan += y_alpha_step; 4521 dest_alpha_scan += y_alpha_step;
4522 } 4522 }
4523 } 4523 }
4524 } 4524 }
OLDNEW
« no previous file with comments | « core/src/fxge/dib/dib_int.h ('k') | core/src/fxge/dib/fx_dib_convert.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698