| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fxcodec/fx_codec.h" | 7 #include "core/fxcodec/fx_codec.h" |
| 8 #include "core/fxge/cfx_gemodule.h" | 8 #include "core/fxge/cfx_gemodule.h" |
| 9 #include "core/fxge/dib/dib_int.h" | 9 #include "core/fxge/dib/dib_int.h" |
| 10 #include "core/fxge/ge/cfx_cliprgn.h" | 10 #include "core/fxge/ge/cfx_cliprgn.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 int blend_type, | 300 int blend_type, |
| 301 const uint8_t* clip_scan, | 301 const uint8_t* clip_scan, |
| 302 const uint8_t* src_alpha_scan, | 302 const uint8_t* src_alpha_scan, |
| 303 uint8_t* dst_alpha_scan, | 303 uint8_t* dst_alpha_scan, |
| 304 void* pIccTransform) { | 304 void* pIccTransform) { |
| 305 CCodec_IccModule* pIccModule = nullptr; | 305 CCodec_IccModule* pIccModule = nullptr; |
| 306 if (pIccTransform) | 306 if (pIccTransform) |
| 307 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 307 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 308 | 308 |
| 309 if (blend_type) { | 309 if (blend_type) { |
| 310 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 310 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 311 if (src_alpha_scan) { | 311 if (src_alpha_scan) { |
| 312 for (int col = 0; col < pixel_count; col++) { | 312 for (int col = 0; col < pixel_count; col++) { |
| 313 uint8_t back_alpha = *dst_alpha_scan; | 313 uint8_t back_alpha = *dst_alpha_scan; |
| 314 if (back_alpha == 0) { | 314 if (back_alpha == 0) { |
| 315 int src_alpha = *src_alpha_scan++; | 315 int src_alpha = *src_alpha_scan++; |
| 316 if (clip_scan) | 316 if (clip_scan) |
| 317 src_alpha = clip_scan[col] * src_alpha / 255; | 317 src_alpha = clip_scan[col] * src_alpha / 255; |
| 318 | 318 |
| 319 if (src_alpha) { | 319 if (src_alpha) { |
| 320 if (pIccTransform) { | 320 if (pIccTransform) { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 int blend_type, | 504 int blend_type, |
| 505 const uint8_t* clip_scan, | 505 const uint8_t* clip_scan, |
| 506 const uint8_t* src_alpha_scan, | 506 const uint8_t* src_alpha_scan, |
| 507 void* pIccTransform) { | 507 void* pIccTransform) { |
| 508 CCodec_IccModule* pIccModule = nullptr; | 508 CCodec_IccModule* pIccModule = nullptr; |
| 509 uint8_t gray; | 509 uint8_t gray; |
| 510 if (pIccTransform) | 510 if (pIccTransform) |
| 511 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 511 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 512 | 512 |
| 513 if (blend_type) { | 513 if (blend_type) { |
| 514 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 514 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 515 if (src_alpha_scan) { | 515 if (src_alpha_scan) { |
| 516 for (int col = 0; col < pixel_count; col++) { | 516 for (int col = 0; col < pixel_count; col++) { |
| 517 int src_alpha = *src_alpha_scan++; | 517 int src_alpha = *src_alpha_scan++; |
| 518 if (clip_scan) | 518 if (clip_scan) |
| 519 src_alpha = clip_scan[col] * src_alpha / 255; | 519 src_alpha = clip_scan[col] * src_alpha / 255; |
| 520 | 520 |
| 521 if (src_alpha) { | 521 if (src_alpha) { |
| 522 if (pIccTransform) | 522 if (pIccTransform) |
| 523 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 523 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 524 else | 524 else |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 int pixel_count, | 600 int pixel_count, |
| 601 int blend_type, | 601 int blend_type, |
| 602 const uint8_t* clip_scan, | 602 const uint8_t* clip_scan, |
| 603 void* pIccTransform) { | 603 void* pIccTransform) { |
| 604 CCodec_IccModule* pIccModule = nullptr; | 604 CCodec_IccModule* pIccModule = nullptr; |
| 605 uint8_t gray; | 605 uint8_t gray; |
| 606 if (pIccTransform) { | 606 if (pIccTransform) { |
| 607 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 607 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 608 } | 608 } |
| 609 if (blend_type) { | 609 if (blend_type) { |
| 610 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 610 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 611 for (int col = 0; col < pixel_count; col++) { | 611 for (int col = 0; col < pixel_count; col++) { |
| 612 if (pIccTransform) { | 612 if (pIccTransform) { |
| 613 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 613 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 614 } else { | 614 } else { |
| 615 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 615 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 616 } | 616 } |
| 617 if (bNonseparableBlend) | 617 if (bNonseparableBlend) |
| 618 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 618 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 619 else | 619 else |
| 620 gray = Blend(blend_type, *dest_scan, gray); | 620 gray = Blend(blend_type, *dest_scan, gray); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 650 int pixel_count, | 650 int pixel_count, |
| 651 int blend_type, | 651 int blend_type, |
| 652 const uint8_t* clip_scan, | 652 const uint8_t* clip_scan, |
| 653 uint8_t* dest_alpha_scan, | 653 uint8_t* dest_alpha_scan, |
| 654 void* pIccTransform) { | 654 void* pIccTransform) { |
| 655 CCodec_IccModule* pIccModule = nullptr; | 655 CCodec_IccModule* pIccModule = nullptr; |
| 656 if (pIccTransform) { | 656 if (pIccTransform) { |
| 657 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 657 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 658 } | 658 } |
| 659 if (blend_type) { | 659 if (blend_type) { |
| 660 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 660 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 661 for (int col = 0; col < pixel_count; col++) { | 661 for (int col = 0; col < pixel_count; col++) { |
| 662 int back_alpha = *dest_alpha_scan; | 662 int back_alpha = *dest_alpha_scan; |
| 663 if (back_alpha == 0) { | 663 if (back_alpha == 0) { |
| 664 if (pIccTransform) { | 664 if (pIccTransform) { |
| 665 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); | 665 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); |
| 666 } else { | 666 } else { |
| 667 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 667 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 668 } | 668 } |
| 669 dest_scan++; | 669 dest_scan++; |
| 670 dest_alpha_scan++; | 670 dest_alpha_scan++; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 } | 740 } |
| 741 | 741 |
| 742 void CompositeRow_Argb2Argb(uint8_t* dest_scan, | 742 void CompositeRow_Argb2Argb(uint8_t* dest_scan, |
| 743 const uint8_t* src_scan, | 743 const uint8_t* src_scan, |
| 744 int pixel_count, | 744 int pixel_count, |
| 745 int blend_type, | 745 int blend_type, |
| 746 const uint8_t* clip_scan, | 746 const uint8_t* clip_scan, |
| 747 uint8_t* dest_alpha_scan, | 747 uint8_t* dest_alpha_scan, |
| 748 const uint8_t* src_alpha_scan) { | 748 const uint8_t* src_alpha_scan) { |
| 749 int blended_colors[3]; | 749 int blended_colors[3]; |
| 750 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 750 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 751 if (!dest_alpha_scan) { | 751 if (!dest_alpha_scan) { |
| 752 if (!src_alpha_scan) { | 752 if (!src_alpha_scan) { |
| 753 uint8_t back_alpha = 0; | 753 uint8_t back_alpha = 0; |
| 754 for (int col = 0; col < pixel_count; col++) { | 754 for (int col = 0; col < pixel_count; col++) { |
| 755 back_alpha = dest_scan[3]; | 755 back_alpha = dest_scan[3]; |
| 756 if (back_alpha == 0) { | 756 if (back_alpha == 0) { |
| 757 if (clip_scan) { | 757 if (clip_scan) { |
| 758 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 758 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
| 759 FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xffffff) | | 759 FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xffffff) | |
| 760 (src_alpha << 24)); | 760 (src_alpha << 24)); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 } | 963 } |
| 964 } | 964 } |
| 965 | 965 |
| 966 void CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, | 966 void CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, |
| 967 const uint8_t* src_scan, | 967 const uint8_t* src_scan, |
| 968 int width, | 968 int width, |
| 969 int blend_type, | 969 int blend_type, |
| 970 int src_Bpp, | 970 int src_Bpp, |
| 971 uint8_t* dest_alpha_scan) { | 971 uint8_t* dest_alpha_scan) { |
| 972 int blended_colors[3]; | 972 int blended_colors[3]; |
| 973 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 973 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 974 int src_gap = src_Bpp - 3; | 974 int src_gap = src_Bpp - 3; |
| 975 if (dest_alpha_scan) { | 975 if (dest_alpha_scan) { |
| 976 for (int col = 0; col < width; col++) { | 976 for (int col = 0; col < width; col++) { |
| 977 uint8_t back_alpha = *dest_alpha_scan; | 977 uint8_t back_alpha = *dest_alpha_scan; |
| 978 if (back_alpha == 0) { | 978 if (back_alpha == 0) { |
| 979 *dest_scan++ = *src_scan++; | 979 *dest_scan++ = *src_scan++; |
| 980 *dest_scan++ = *src_scan++; | 980 *dest_scan++ = *src_scan++; |
| 981 *dest_scan++ = *src_scan++; | 981 *dest_scan++ = *src_scan++; |
| 982 *dest_alpha_scan++ = 0xff; | 982 *dest_alpha_scan++ = 0xff; |
| 983 src_scan += src_gap; | 983 src_scan += src_gap; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 void CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, | 1034 void CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, |
| 1035 const uint8_t* src_scan, | 1035 const uint8_t* src_scan, |
| 1036 int width, | 1036 int width, |
| 1037 int blend_type, | 1037 int blend_type, |
| 1038 int src_Bpp, | 1038 int src_Bpp, |
| 1039 const uint8_t* clip_scan, | 1039 const uint8_t* clip_scan, |
| 1040 uint8_t* dest_alpha_scan) { | 1040 uint8_t* dest_alpha_scan) { |
| 1041 int blended_colors[3]; | 1041 int blended_colors[3]; |
| 1042 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1042 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1043 int src_gap = src_Bpp - 3; | 1043 int src_gap = src_Bpp - 3; |
| 1044 if (dest_alpha_scan) { | 1044 if (dest_alpha_scan) { |
| 1045 for (int col = 0; col < width; col++) { | 1045 for (int col = 0; col < width; col++) { |
| 1046 int src_alpha = *clip_scan++; | 1046 int src_alpha = *clip_scan++; |
| 1047 uint8_t back_alpha = *dest_alpha_scan; | 1047 uint8_t back_alpha = *dest_alpha_scan; |
| 1048 if (back_alpha == 0) { | 1048 if (back_alpha == 0) { |
| 1049 *dest_scan++ = *src_scan++; | 1049 *dest_scan++ = *src_scan++; |
| 1050 *dest_scan++ = *src_scan++; | 1050 *dest_scan++ = *src_scan++; |
| 1051 *dest_scan++ = *src_scan++; | 1051 *dest_scan++ = *src_scan++; |
| 1052 src_scan += src_gap; | 1052 src_scan += src_gap; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 void CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, | 1217 void CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, |
| 1218 const uint8_t* src_scan, | 1218 const uint8_t* src_scan, |
| 1219 int width, | 1219 int width, |
| 1220 int blend_type, | 1220 int blend_type, |
| 1221 int dest_Bpp, | 1221 int dest_Bpp, |
| 1222 const uint8_t* clip_scan, | 1222 const uint8_t* clip_scan, |
| 1223 const uint8_t* src_alpha_scan) { | 1223 const uint8_t* src_alpha_scan) { |
| 1224 int blended_colors[3]; | 1224 int blended_colors[3]; |
| 1225 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1225 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1226 int dest_gap = dest_Bpp - 3; | 1226 int dest_gap = dest_Bpp - 3; |
| 1227 if (src_alpha_scan) { | 1227 if (src_alpha_scan) { |
| 1228 for (int col = 0; col < width; col++) { | 1228 for (int col = 0; col < width; col++) { |
| 1229 uint8_t src_alpha; | 1229 uint8_t src_alpha; |
| 1230 if (clip_scan) { | 1230 if (clip_scan) { |
| 1231 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; | 1231 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; |
| 1232 } else { | 1232 } else { |
| 1233 src_alpha = *src_alpha_scan++; | 1233 src_alpha = *src_alpha_scan++; |
| 1234 } | 1234 } |
| 1235 if (src_alpha == 0) { | 1235 if (src_alpha == 0) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 } | 1348 } |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 void CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, | 1351 void CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, |
| 1352 const uint8_t* src_scan, | 1352 const uint8_t* src_scan, |
| 1353 int width, | 1353 int width, |
| 1354 int blend_type, | 1354 int blend_type, |
| 1355 int dest_Bpp, | 1355 int dest_Bpp, |
| 1356 int src_Bpp) { | 1356 int src_Bpp) { |
| 1357 int blended_colors[3]; | 1357 int blended_colors[3]; |
| 1358 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1358 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1359 int dest_gap = dest_Bpp - 3; | 1359 int dest_gap = dest_Bpp - 3; |
| 1360 int src_gap = src_Bpp - 3; | 1360 int src_gap = src_Bpp - 3; |
| 1361 for (int col = 0; col < width; col++) { | 1361 for (int col = 0; col < width; col++) { |
| 1362 if (bNonseparableBlend) { | 1362 if (bNonseparableBlend) { |
| 1363 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1363 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 1364 } | 1364 } |
| 1365 for (int color = 0; color < 3; color++) { | 1365 for (int color = 0; color < 3; color++) { |
| 1366 int back_color = *dest_scan; | 1366 int back_color = *dest_scan; |
| 1367 int src_color = *src_scan; | 1367 int src_color = *src_scan; |
| 1368 int blended = bNonseparableBlend | 1368 int blended = bNonseparableBlend |
| 1369 ? blended_colors[color] | 1369 ? blended_colors[color] |
| 1370 : Blend(blend_type, back_color, src_color); | 1370 : Blend(blend_type, back_color, src_color); |
| 1371 *dest_scan = blended; | 1371 *dest_scan = blended; |
| 1372 dest_scan++; | 1372 dest_scan++; |
| 1373 src_scan++; | 1373 src_scan++; |
| 1374 } | 1374 } |
| 1375 dest_scan += dest_gap; | 1375 dest_scan += dest_gap; |
| 1376 src_scan += src_gap; | 1376 src_scan += src_gap; |
| 1377 } | 1377 } |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 void CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, | 1380 void CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, |
| 1381 const uint8_t* src_scan, | 1381 const uint8_t* src_scan, |
| 1382 int width, | 1382 int width, |
| 1383 int blend_type, | 1383 int blend_type, |
| 1384 int dest_Bpp, | 1384 int dest_Bpp, |
| 1385 int src_Bpp, | 1385 int src_Bpp, |
| 1386 const uint8_t* clip_scan) { | 1386 const uint8_t* clip_scan) { |
| 1387 int blended_colors[3]; | 1387 int blended_colors[3]; |
| 1388 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1388 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1389 int dest_gap = dest_Bpp - 3; | 1389 int dest_gap = dest_Bpp - 3; |
| 1390 int src_gap = src_Bpp - 3; | 1390 int src_gap = src_Bpp - 3; |
| 1391 for (int col = 0; col < width; col++) { | 1391 for (int col = 0; col < width; col++) { |
| 1392 uint8_t src_alpha = *clip_scan++; | 1392 uint8_t src_alpha = *clip_scan++; |
| 1393 if (src_alpha == 0) { | 1393 if (src_alpha == 0) { |
| 1394 dest_scan += dest_Bpp; | 1394 dest_scan += dest_Bpp; |
| 1395 src_scan += src_Bpp; | 1395 src_scan += src_Bpp; |
| 1396 continue; | 1396 continue; |
| 1397 } | 1397 } |
| 1398 if (bNonseparableBlend) { | 1398 if (bNonseparableBlend) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1480 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1481 dp[3] = *src_alpha_scan++; | 1481 dp[3] = *src_alpha_scan++; |
| 1482 src_scan += 3; | 1482 src_scan += 3; |
| 1483 dp += 4; | 1483 dp += 4; |
| 1484 } | 1484 } |
| 1485 src_alpha_scan = nullptr; | 1485 src_alpha_scan = nullptr; |
| 1486 } | 1486 } |
| 1487 } else { | 1487 } else { |
| 1488 if (dest_alpha_scan) { | 1488 if (dest_alpha_scan) { |
| 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 for (int col = 0; col < pixel_count; col++) { | 1491 for (int col = 0; col < pixel_count; col++) { |
| 1492 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1492 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1493 1); | 1493 1); |
| 1494 uint8_t back_alpha = *dest_alpha_scan; | 1494 uint8_t back_alpha = *dest_alpha_scan; |
| 1495 if (back_alpha == 0) { | 1495 if (back_alpha == 0) { |
| 1496 if (clip_scan) { | 1496 if (clip_scan) { |
| 1497 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 1497 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
| 1498 *dest_alpha_scan = src_alpha; | 1498 *dest_alpha_scan = src_alpha; |
| 1499 *dest_scan++ = *src_cache_scan++; | 1499 *dest_scan++ = *src_cache_scan++; |
| 1500 *dest_scan++ = *src_cache_scan++; | 1500 *dest_scan++ = *src_cache_scan++; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 const uint8_t* src_alpha_scan, | 1666 const uint8_t* src_alpha_scan, |
| 1667 uint8_t* src_cache_scan, | 1667 uint8_t* src_cache_scan, |
| 1668 void* pIccTransform) { | 1668 void* pIccTransform) { |
| 1669 CCodec_IccModule* pIccModule = | 1669 CCodec_IccModule* pIccModule = |
| 1670 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1670 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1671 if (src_alpha_scan) { | 1671 if (src_alpha_scan) { |
| 1672 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1672 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1673 width); | 1673 width); |
| 1674 } else { | 1674 } else { |
| 1675 int blended_colors[3]; | 1675 int blended_colors[3]; |
| 1676 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1676 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1677 int dest_gap = dest_Bpp - 3; | 1677 int dest_gap = dest_Bpp - 3; |
| 1678 for (int col = 0; col < width; col++) { | 1678 for (int col = 0; col < width; col++) { |
| 1679 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); | 1679 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); |
| 1680 uint8_t src_alpha; | 1680 uint8_t src_alpha; |
| 1681 if (clip_scan) { | 1681 if (clip_scan) { |
| 1682 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 1682 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
| 1683 } else { | 1683 } else { |
| 1684 src_alpha = src_scan[3]; | 1684 src_alpha = src_scan[3]; |
| 1685 } | 1685 } |
| 1686 src_scan += 4; | 1686 src_scan += 4; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 | 1860 |
| 1861 void CompositeRow_8bppPal2Gray(uint8_t* dest_scan, | 1861 void CompositeRow_8bppPal2Gray(uint8_t* dest_scan, |
| 1862 const uint8_t* src_scan, | 1862 const uint8_t* src_scan, |
| 1863 const uint8_t* pPalette, | 1863 const uint8_t* pPalette, |
| 1864 int pixel_count, | 1864 int pixel_count, |
| 1865 int blend_type, | 1865 int blend_type, |
| 1866 const uint8_t* clip_scan, | 1866 const uint8_t* clip_scan, |
| 1867 const uint8_t* src_alpha_scan) { | 1867 const uint8_t* src_alpha_scan) { |
| 1868 if (src_alpha_scan) { | 1868 if (src_alpha_scan) { |
| 1869 if (blend_type) { | 1869 if (blend_type) { |
| 1870 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1870 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1871 for (int col = 0; col < pixel_count; col++) { | 1871 for (int col = 0; col < pixel_count; col++) { |
| 1872 uint8_t gray = pPalette[*src_scan]; | 1872 uint8_t gray = pPalette[*src_scan]; |
| 1873 int src_alpha = *src_alpha_scan++; | 1873 int src_alpha = *src_alpha_scan++; |
| 1874 if (clip_scan) { | 1874 if (clip_scan) { |
| 1875 src_alpha = clip_scan[col] * src_alpha / 255; | 1875 src_alpha = clip_scan[col] * src_alpha / 255; |
| 1876 } | 1876 } |
| 1877 if (bNonseparableBlend) | 1877 if (bNonseparableBlend) |
| 1878 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 1878 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 1879 else | 1879 else |
| 1880 gray = Blend(blend_type, *dest_scan, gray); | 1880 gray = Blend(blend_type, *dest_scan, gray); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1897 if (src_alpha) { | 1897 if (src_alpha) { |
| 1898 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 1898 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
| 1899 } else { | 1899 } else { |
| 1900 *dest_scan = gray; | 1900 *dest_scan = gray; |
| 1901 } | 1901 } |
| 1902 dest_scan++; | 1902 dest_scan++; |
| 1903 src_scan++; | 1903 src_scan++; |
| 1904 } | 1904 } |
| 1905 } else { | 1905 } else { |
| 1906 if (blend_type) { | 1906 if (blend_type) { |
| 1907 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1907 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1908 for (int col = 0; col < pixel_count; col++) { | 1908 for (int col = 0; col < pixel_count; col++) { |
| 1909 uint8_t gray = pPalette[*src_scan]; | 1909 uint8_t gray = pPalette[*src_scan]; |
| 1910 if (bNonseparableBlend) | 1910 if (bNonseparableBlend) |
| 1911 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 1911 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 1912 else | 1912 else |
| 1913 gray = Blend(blend_type, *dest_scan, gray); | 1913 gray = Blend(blend_type, *dest_scan, gray); |
| 1914 if (clip_scan && clip_scan[col] < 255) { | 1914 if (clip_scan && clip_scan[col] < 255) { |
| 1915 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 1915 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
| 1916 } else { | 1916 } else { |
| 1917 *dest_scan = gray; | 1917 *dest_scan = gray; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1937 void CompositeRow_8bppPal2Graya(uint8_t* dest_scan, | 1937 void CompositeRow_8bppPal2Graya(uint8_t* dest_scan, |
| 1938 const uint8_t* src_scan, | 1938 const uint8_t* src_scan, |
| 1939 const uint8_t* pPalette, | 1939 const uint8_t* pPalette, |
| 1940 int pixel_count, | 1940 int pixel_count, |
| 1941 int blend_type, | 1941 int blend_type, |
| 1942 const uint8_t* clip_scan, | 1942 const uint8_t* clip_scan, |
| 1943 uint8_t* dest_alpha_scan, | 1943 uint8_t* dest_alpha_scan, |
| 1944 const uint8_t* src_alpha_scan) { | 1944 const uint8_t* src_alpha_scan) { |
| 1945 if (src_alpha_scan) { | 1945 if (src_alpha_scan) { |
| 1946 if (blend_type) { | 1946 if (blend_type) { |
| 1947 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1947 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1948 for (int col = 0; col < pixel_count; col++) { | 1948 for (int col = 0; col < pixel_count; col++) { |
| 1949 uint8_t gray = pPalette[*src_scan]; | 1949 uint8_t gray = pPalette[*src_scan]; |
| 1950 src_scan++; | 1950 src_scan++; |
| 1951 uint8_t back_alpha = *dest_alpha_scan; | 1951 uint8_t back_alpha = *dest_alpha_scan; |
| 1952 if (back_alpha == 0) { | 1952 if (back_alpha == 0) { |
| 1953 int src_alpha = *src_alpha_scan++; | 1953 int src_alpha = *src_alpha_scan++; |
| 1954 if (clip_scan) { | 1954 if (clip_scan) { |
| 1955 src_alpha = clip_scan[col] * src_alpha / 255; | 1955 src_alpha = clip_scan[col] * src_alpha / 255; |
| 1956 } | 1956 } |
| 1957 if (src_alpha) { | 1957 if (src_alpha) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2011 continue; | 2011 continue; |
| 2012 } | 2012 } |
| 2013 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2013 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2014 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); | 2014 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); |
| 2015 dest_alpha_scan++; | 2015 dest_alpha_scan++; |
| 2016 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 2016 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 2017 dest_scan++; | 2017 dest_scan++; |
| 2018 } | 2018 } |
| 2019 } else { | 2019 } else { |
| 2020 if (blend_type) { | 2020 if (blend_type) { |
| 2021 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2021 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 2022 for (int col = 0; col < pixel_count; col++) { | 2022 for (int col = 0; col < pixel_count; col++) { |
| 2023 uint8_t gray = pPalette[*src_scan]; | 2023 uint8_t gray = pPalette[*src_scan]; |
| 2024 src_scan++; | 2024 src_scan++; |
| 2025 if (!clip_scan || clip_scan[col] == 255) { | 2025 if (!clip_scan || clip_scan[col] == 255) { |
| 2026 *dest_scan++ = gray; | 2026 *dest_scan++ = gray; |
| 2027 *dest_alpha_scan++ = 255; | 2027 *dest_alpha_scan++ = 255; |
| 2028 continue; | 2028 continue; |
| 2029 } | 2029 } |
| 2030 int src_alpha = clip_scan[col]; | 2030 int src_alpha = clip_scan[col]; |
| 2031 if (src_alpha == 0) { | 2031 if (src_alpha == 0) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 void CompositeRow_1bppPal2Gray(uint8_t* dest_scan, | 2075 void CompositeRow_1bppPal2Gray(uint8_t* dest_scan, |
| 2076 const uint8_t* src_scan, | 2076 const uint8_t* src_scan, |
| 2077 int src_left, | 2077 int src_left, |
| 2078 const uint8_t* pPalette, | 2078 const uint8_t* pPalette, |
| 2079 int pixel_count, | 2079 int pixel_count, |
| 2080 int blend_type, | 2080 int blend_type, |
| 2081 const uint8_t* clip_scan) { | 2081 const uint8_t* clip_scan) { |
| 2082 int reset_gray = pPalette[0]; | 2082 int reset_gray = pPalette[0]; |
| 2083 int set_gray = pPalette[1]; | 2083 int set_gray = pPalette[1]; |
| 2084 if (blend_type) { | 2084 if (blend_type) { |
| 2085 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2085 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 2086 for (int col = 0; col < pixel_count; col++) { | 2086 for (int col = 0; col < pixel_count; col++) { |
| 2087 uint8_t gray = | 2087 uint8_t gray = |
| 2088 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) | 2088 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) |
| 2089 ? set_gray | 2089 ? set_gray |
| 2090 : reset_gray; | 2090 : reset_gray; |
| 2091 if (bNonseparableBlend) | 2091 if (bNonseparableBlend) |
| 2092 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 2092 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 2093 else | 2093 else |
| 2094 gray = Blend(blend_type, *dest_scan, gray); | 2094 gray = Blend(blend_type, *dest_scan, gray); |
| 2095 if (clip_scan && clip_scan[col] < 255) { | 2095 if (clip_scan && clip_scan[col] < 255) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2119 const uint8_t* src_scan, | 2119 const uint8_t* src_scan, |
| 2120 int src_left, | 2120 int src_left, |
| 2121 const uint8_t* pPalette, | 2121 const uint8_t* pPalette, |
| 2122 int pixel_count, | 2122 int pixel_count, |
| 2123 int blend_type, | 2123 int blend_type, |
| 2124 const uint8_t* clip_scan, | 2124 const uint8_t* clip_scan, |
| 2125 uint8_t* dest_alpha_scan) { | 2125 uint8_t* dest_alpha_scan) { |
| 2126 int reset_gray = pPalette[0]; | 2126 int reset_gray = pPalette[0]; |
| 2127 int set_gray = pPalette[1]; | 2127 int set_gray = pPalette[1]; |
| 2128 if (blend_type) { | 2128 if (blend_type) { |
| 2129 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2129 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 2130 for (int col = 0; col < pixel_count; col++) { | 2130 for (int col = 0; col < pixel_count; col++) { |
| 2131 uint8_t gray = | 2131 uint8_t gray = |
| 2132 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) | 2132 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) |
| 2133 ? set_gray | 2133 ? set_gray |
| 2134 : reset_gray; | 2134 : reset_gray; |
| 2135 if (!clip_scan || clip_scan[col] == 255) { | 2135 if (!clip_scan || clip_scan[col] == 255) { |
| 2136 *dest_scan++ = gray; | 2136 *dest_scan++ = gray; |
| 2137 *dest_alpha_scan++ = 255; | 2137 *dest_alpha_scan++ = 255; |
| 2138 continue; | 2138 continue; |
| 2139 } | 2139 } |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2982 dest_scan++; | 2982 dest_scan++; |
| 2983 } | 2983 } |
| 2984 } | 2984 } |
| 2985 | 2985 |
| 2986 void CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, | 2986 void CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, |
| 2987 const uint8_t* src_scan, | 2987 const uint8_t* src_scan, |
| 2988 int pixel_count, | 2988 int pixel_count, |
| 2989 int blend_type, | 2989 int blend_type, |
| 2990 const uint8_t* clip_scan) { | 2990 const uint8_t* clip_scan) { |
| 2991 int blended_colors[3]; | 2991 int blended_colors[3]; |
| 2992 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2992 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 2993 for (int col = 0; col < pixel_count; col++) { | 2993 for (int col = 0; col < pixel_count; col++) { |
| 2994 uint8_t back_alpha = dest_scan[3]; | 2994 uint8_t back_alpha = dest_scan[3]; |
| 2995 if (back_alpha == 0) { | 2995 if (back_alpha == 0) { |
| 2996 if (clip_scan) { | 2996 if (clip_scan) { |
| 2997 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 2997 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
| 2998 dest_scan[3] = src_alpha; | 2998 dest_scan[3] = src_alpha; |
| 2999 dest_scan[0] = src_scan[2]; | 2999 dest_scan[0] = src_scan[2]; |
| 3000 dest_scan[1] = src_scan[1]; | 3000 dest_scan[1] = src_scan[1]; |
| 3001 dest_scan[2] = src_scan[0]; | 3001 dest_scan[2] = src_scan[0]; |
| 3002 } else { | 3002 } else { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 src_scan++; | 3046 src_scan++; |
| 3047 } | 3047 } |
| 3048 } | 3048 } |
| 3049 | 3049 |
| 3050 void CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, | 3050 void CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, |
| 3051 const uint8_t* src_scan, | 3051 const uint8_t* src_scan, |
| 3052 int width, | 3052 int width, |
| 3053 int blend_type, | 3053 int blend_type, |
| 3054 int src_Bpp) { | 3054 int src_Bpp) { |
| 3055 int blended_colors[3]; | 3055 int blended_colors[3]; |
| 3056 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3056 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3057 int src_gap = src_Bpp - 3; | 3057 int src_gap = src_Bpp - 3; |
| 3058 for (int col = 0; col < width; col++) { | 3058 for (int col = 0; col < width; col++) { |
| 3059 uint8_t back_alpha = dest_scan[3]; | 3059 uint8_t back_alpha = dest_scan[3]; |
| 3060 if (back_alpha == 0) { | 3060 if (back_alpha == 0) { |
| 3061 if (src_Bpp == 4) { | 3061 if (src_Bpp == 4) { |
| 3062 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); | 3062 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); |
| 3063 } else { | 3063 } else { |
| 3064 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], | 3064 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], |
| 3065 src_scan[1], src_scan[0])); | 3065 src_scan[1], src_scan[0])); |
| 3066 } | 3066 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3090 } | 3090 } |
| 3091 } | 3091 } |
| 3092 | 3092 |
| 3093 void CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, | 3093 void CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, |
| 3094 const uint8_t* src_scan, | 3094 const uint8_t* src_scan, |
| 3095 int width, | 3095 int width, |
| 3096 int blend_type, | 3096 int blend_type, |
| 3097 int dest_Bpp, | 3097 int dest_Bpp, |
| 3098 const uint8_t* clip_scan) { | 3098 const uint8_t* clip_scan) { |
| 3099 int blended_colors[3]; | 3099 int blended_colors[3]; |
| 3100 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3100 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3101 for (int col = 0; col < width; col++) { | 3101 for (int col = 0; col < width; col++) { |
| 3102 uint8_t src_alpha; | 3102 uint8_t src_alpha; |
| 3103 if (clip_scan) { | 3103 if (clip_scan) { |
| 3104 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 3104 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
| 3105 } else { | 3105 } else { |
| 3106 src_alpha = src_scan[3]; | 3106 src_alpha = src_scan[3]; |
| 3107 } | 3107 } |
| 3108 if (src_alpha == 0) { | 3108 if (src_alpha == 0) { |
| 3109 dest_scan += dest_Bpp; | 3109 dest_scan += dest_Bpp; |
| 3110 src_scan += 4; | 3110 src_scan += 4; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3147 } | 3147 } |
| 3148 } | 3148 } |
| 3149 | 3149 |
| 3150 void CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, | 3150 void CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, |
| 3151 const uint8_t* src_scan, | 3151 const uint8_t* src_scan, |
| 3152 int width, | 3152 int width, |
| 3153 int blend_type, | 3153 int blend_type, |
| 3154 int dest_Bpp, | 3154 int dest_Bpp, |
| 3155 int src_Bpp) { | 3155 int src_Bpp) { |
| 3156 int blended_colors[3]; | 3156 int blended_colors[3]; |
| 3157 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3157 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3158 int src_gap = src_Bpp - 3; | 3158 int src_gap = src_Bpp - 3; |
| 3159 for (int col = 0; col < width; col++) { | 3159 for (int col = 0; col < width; col++) { |
| 3160 if (bNonseparableBlend) { | 3160 if (bNonseparableBlend) { |
| 3161 uint8_t dest_scan_o[3]; | 3161 uint8_t dest_scan_o[3]; |
| 3162 dest_scan_o[0] = dest_scan[2]; | 3162 dest_scan_o[0] = dest_scan[2]; |
| 3163 dest_scan_o[1] = dest_scan[1]; | 3163 dest_scan_o[1] = dest_scan[1]; |
| 3164 dest_scan_o[2] = dest_scan[0]; | 3164 dest_scan_o[2] = dest_scan[0]; |
| 3165 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3165 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3166 } | 3166 } |
| 3167 for (int color = 0; color < 3; color++) { | 3167 for (int color = 0; color < 3; color++) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 } | 3229 } |
| 3230 } | 3230 } |
| 3231 | 3231 |
| 3232 void CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, | 3232 void CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, |
| 3233 const uint8_t* src_scan, | 3233 const uint8_t* src_scan, |
| 3234 int width, | 3234 int width, |
| 3235 int blend_type, | 3235 int blend_type, |
| 3236 int src_Bpp, | 3236 int src_Bpp, |
| 3237 const uint8_t* clip_scan) { | 3237 const uint8_t* clip_scan) { |
| 3238 int blended_colors[3]; | 3238 int blended_colors[3]; |
| 3239 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3239 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3240 int src_gap = src_Bpp - 3; | 3240 int src_gap = src_Bpp - 3; |
| 3241 for (int col = 0; col < width; col++) { | 3241 for (int col = 0; col < width; col++) { |
| 3242 int src_alpha = *clip_scan++; | 3242 int src_alpha = *clip_scan++; |
| 3243 uint8_t back_alpha = dest_scan[3]; | 3243 uint8_t back_alpha = dest_scan[3]; |
| 3244 if (back_alpha == 0) { | 3244 if (back_alpha == 0) { |
| 3245 dest_scan[2] = *src_scan++; | 3245 dest_scan[2] = *src_scan++; |
| 3246 dest_scan[1] = *src_scan++; | 3246 dest_scan[1] = *src_scan++; |
| 3247 dest_scan[0] = *src_scan++; | 3247 dest_scan[0] = *src_scan++; |
| 3248 src_scan += src_gap; | 3248 src_scan += src_gap; |
| 3249 dest_scan += 4; | 3249 dest_scan += 4; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3281 } | 3281 } |
| 3282 | 3282 |
| 3283 void CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, | 3283 void CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, |
| 3284 const uint8_t* src_scan, | 3284 const uint8_t* src_scan, |
| 3285 int width, | 3285 int width, |
| 3286 int blend_type, | 3286 int blend_type, |
| 3287 int dest_Bpp, | 3287 int dest_Bpp, |
| 3288 int src_Bpp, | 3288 int src_Bpp, |
| 3289 const uint8_t* clip_scan) { | 3289 const uint8_t* clip_scan) { |
| 3290 int blended_colors[3]; | 3290 int blended_colors[3]; |
| 3291 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3291 bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3292 int src_gap = src_Bpp - 3; | 3292 int src_gap = src_Bpp - 3; |
| 3293 for (int col = 0; col < width; col++) { | 3293 for (int col = 0; col < width; col++) { |
| 3294 uint8_t src_alpha = *clip_scan++; | 3294 uint8_t src_alpha = *clip_scan++; |
| 3295 if (src_alpha == 0) { | 3295 if (src_alpha == 0) { |
| 3296 dest_scan += dest_Bpp; | 3296 dest_scan += dest_Bpp; |
| 3297 src_scan += src_Bpp; | 3297 src_scan += src_Bpp; |
| 3298 continue; | 3298 continue; |
| 3299 } | 3299 } |
| 3300 if (bNonseparableBlend) { | 3300 if (bNonseparableBlend) { |
| 3301 uint8_t dest_scan_o[3]; | 3301 uint8_t dest_scan_o[3]; |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3795 dest_scan[0] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 3795 dest_scan[0] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 3796 } else { | 3796 } else { |
| 3797 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha); | 3797 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha); |
| 3798 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha); | 3798 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha); |
| 3799 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha); | 3799 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha); |
| 3800 } | 3800 } |
| 3801 dest_scan += Bpp; | 3801 dest_scan += Bpp; |
| 3802 } | 3802 } |
| 3803 } | 3803 } |
| 3804 | 3804 |
| 3805 FX_BOOL ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, | 3805 bool ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, |
| 3806 int alpha_flag, | 3806 int alpha_flag, |
| 3807 uint32_t mask_color, | 3807 uint32_t mask_color, |
| 3808 int& mask_alpha, | 3808 int& mask_alpha, |
| 3809 int& mask_red, | 3809 int& mask_red, |
| 3810 int& mask_green, | 3810 int& mask_green, |
| 3811 int& mask_blue, | 3811 int& mask_blue, |
| 3812 int& mask_black, | 3812 int& mask_black, |
| 3813 CCodec_IccModule* pIccModule, | 3813 CCodec_IccModule* pIccModule, |
| 3814 void* pIccTransform) { | 3814 void* pIccTransform) { |
| 3815 if (alpha_flag >> 8) { | 3815 if (alpha_flag >> 8) { |
| 3816 mask_alpha = alpha_flag & 0xff; | 3816 mask_alpha = alpha_flag & 0xff; |
| 3817 mask_red = FXSYS_GetCValue(mask_color); | 3817 mask_red = FXSYS_GetCValue(mask_color); |
| 3818 mask_green = FXSYS_GetMValue(mask_color); | 3818 mask_green = FXSYS_GetMValue(mask_color); |
| 3819 mask_blue = FXSYS_GetYValue(mask_color); | 3819 mask_blue = FXSYS_GetYValue(mask_color); |
| 3820 mask_black = FXSYS_GetKValue(mask_color); | 3820 mask_black = FXSYS_GetKValue(mask_color); |
| 3821 } else { | 3821 } else { |
| 3822 mask_alpha = FXARGB_A(mask_color); | 3822 mask_alpha = FXARGB_A(mask_color); |
| 3823 mask_red = FXARGB_R(mask_color); | 3823 mask_red = FXARGB_R(mask_color); |
| 3824 mask_green = FXARGB_G(mask_color); | 3824 mask_green = FXARGB_G(mask_color); |
| 3825 mask_blue = FXARGB_B(mask_color); | 3825 mask_blue = FXARGB_B(mask_color); |
| 3826 } | 3826 } |
| 3827 if (dest_format == FXDIB_8bppMask) { | 3827 if (dest_format == FXDIB_8bppMask) { |
| 3828 return TRUE; | 3828 return true; |
| 3829 } | 3829 } |
| 3830 if ((dest_format & 0xff) == 8) { | 3830 if ((dest_format & 0xff) == 8) { |
| 3831 if (pIccTransform) { | 3831 if (pIccTransform) { |
| 3832 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) | 3832 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) |
| 3833 : FXARGB_TODIB(mask_color); | 3833 : FXARGB_TODIB(mask_color); |
| 3834 uint8_t* gray_p = (uint8_t*)&mask_color; | 3834 uint8_t* gray_p = (uint8_t*)&mask_color; |
| 3835 pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); | 3835 pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); |
| 3836 mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; | 3836 mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; |
| 3837 } else { | 3837 } else { |
| 3838 if (alpha_flag >> 8) { | 3838 if (alpha_flag >> 8) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3859 mask_blue = mask_color_p[0]; | 3859 mask_blue = mask_color_p[0]; |
| 3860 } else if (alpha_flag >> 8) { | 3860 } else if (alpha_flag >> 8) { |
| 3861 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2], | 3861 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2], |
| 3862 mask_color_p[3], mask_color_p[2], mask_color_p[1], | 3862 mask_color_p[3], mask_color_p[2], mask_color_p[1], |
| 3863 mask_color_p[0]); | 3863 mask_color_p[0]); |
| 3864 mask_red = mask_color_p[2]; | 3864 mask_red = mask_color_p[2]; |
| 3865 mask_green = mask_color_p[1]; | 3865 mask_green = mask_color_p[1]; |
| 3866 mask_blue = mask_color_p[0]; | 3866 mask_blue = mask_color_p[0]; |
| 3867 } | 3867 } |
| 3868 } | 3868 } |
| 3869 return TRUE; | 3869 return true; |
| 3870 } | 3870 } |
| 3871 | 3871 |
| 3872 void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, | 3872 void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, |
| 3873 FXDIB_Format dest_format, | 3873 FXDIB_Format dest_format, |
| 3874 uint32_t*& pDestPalette, | 3874 uint32_t*& pDestPalette, |
| 3875 uint32_t* pSrcPalette, | 3875 uint32_t* pSrcPalette, |
| 3876 CCodec_IccModule* pIccModule, | 3876 CCodec_IccModule* pIccModule, |
| 3877 void* pIccTransform) { | 3877 void* pIccTransform) { |
| 3878 FX_BOOL isSrcCmyk = !!(src_format & 0x0400); | 3878 bool isSrcCmyk = !!(src_format & 0x0400); |
| 3879 FX_BOOL isDstCmyk = !!(dest_format & 0x0400); | 3879 bool isDstCmyk = !!(dest_format & 0x0400); |
| 3880 pDestPalette = nullptr; | 3880 pDestPalette = nullptr; |
| 3881 if (pIccTransform) { | 3881 if (pIccTransform) { |
| 3882 if (pSrcPalette) { | 3882 if (pSrcPalette) { |
| 3883 if ((dest_format & 0xff) == 8) { | 3883 if ((dest_format & 0xff) == 8) { |
| 3884 int pal_count = 1 << (src_format & 0xff); | 3884 int pal_count = 1 << (src_format & 0xff); |
| 3885 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); | 3885 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); |
| 3886 pDestPalette = (uint32_t*)gray_pal; | 3886 pDestPalette = (uint32_t*)gray_pal; |
| 3887 for (int i = 0; i < pal_count; i++) { | 3887 for (int i = 0; i < pal_count; i++) { |
| 3888 uint32_t color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) | 3888 uint32_t color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) |
| 3889 : FXARGB_TODIB(pSrcPalette[i]); | 3889 : FXARGB_TODIB(pSrcPalette[i]); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4005 } | 4005 } |
| 4006 } | 4006 } |
| 4007 } | 4007 } |
| 4008 | 4008 |
| 4009 } // namespace | 4009 } // namespace |
| 4010 | 4010 |
| 4011 CFX_ScanlineCompositor::CFX_ScanlineCompositor() { | 4011 CFX_ScanlineCompositor::CFX_ScanlineCompositor() { |
| 4012 m_pSrcPalette = nullptr; | 4012 m_pSrcPalette = nullptr; |
| 4013 m_pCacheScanline = nullptr; | 4013 m_pCacheScanline = nullptr; |
| 4014 m_CacheSize = 0; | 4014 m_CacheSize = 0; |
| 4015 m_bRgbByteOrder = FALSE; | 4015 m_bRgbByteOrder = false; |
| 4016 m_BlendType = FXDIB_BLEND_NORMAL; | 4016 m_BlendType = FXDIB_BLEND_NORMAL; |
| 4017 } | 4017 } |
| 4018 | 4018 |
| 4019 CFX_ScanlineCompositor::~CFX_ScanlineCompositor() { | 4019 CFX_ScanlineCompositor::~CFX_ScanlineCompositor() { |
| 4020 FX_Free(m_pSrcPalette); | 4020 FX_Free(m_pSrcPalette); |
| 4021 FX_Free(m_pCacheScanline); | 4021 FX_Free(m_pCacheScanline); |
| 4022 } | 4022 } |
| 4023 | 4023 |
| 4024 FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, | 4024 bool CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, |
| 4025 FXDIB_Format src_format, | 4025 FXDIB_Format src_format, |
| 4026 int32_t width, | 4026 int32_t width, |
| 4027 uint32_t* pSrcPalette, | 4027 uint32_t* pSrcPalette, |
| 4028 uint32_t mask_color, | 4028 uint32_t mask_color, |
| 4029 int blend_type, | 4029 int blend_type, |
| 4030 FX_BOOL bClip, | 4030 bool bClip, |
| 4031 FX_BOOL bRgbByteOrder, | 4031 bool bRgbByteOrder, |
| 4032 int alpha_flag, | 4032 int alpha_flag, |
| 4033 void* pIccTransform) { | 4033 void* pIccTransform) { |
| 4034 m_SrcFormat = src_format; | 4034 m_SrcFormat = src_format; |
| 4035 m_DestFormat = dest_format; | 4035 m_DestFormat = dest_format; |
| 4036 m_BlendType = blend_type; | 4036 m_BlendType = blend_type; |
| 4037 m_bRgbByteOrder = bRgbByteOrder; | 4037 m_bRgbByteOrder = bRgbByteOrder; |
| 4038 CCodec_IccModule* pIccModule = nullptr; | 4038 CCodec_IccModule* pIccModule = nullptr; |
| 4039 if (CFX_GEModule::Get()->GetCodecModule()) { | 4039 if (CFX_GEModule::Get()->GetCodecModule()) { |
| 4040 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 4040 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 4041 } | 4041 } |
| 4042 if (!pIccModule) { | 4042 if (!pIccModule) { |
| 4043 pIccTransform = nullptr; | 4043 pIccTransform = nullptr; |
| 4044 } | 4044 } |
| 4045 m_pIccTransform = pIccTransform; | 4045 m_pIccTransform = pIccTransform; |
| 4046 if ((dest_format & 0xff) == 1) { | 4046 if ((dest_format & 0xff) == 1) { |
| 4047 return FALSE; | 4047 return false; |
| 4048 } | 4048 } |
| 4049 if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { | 4049 if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { |
| 4050 return ScanlineCompositor_InitSourceMask( | 4050 return ScanlineCompositor_InitSourceMask( |
| 4051 dest_format, alpha_flag, mask_color, m_MaskAlpha, m_MaskRed, | 4051 dest_format, alpha_flag, mask_color, m_MaskAlpha, m_MaskRed, |
| 4052 m_MaskGreen, m_MaskBlue, m_MaskBlack, pIccModule, pIccTransform); | 4052 m_MaskGreen, m_MaskBlue, m_MaskBlack, pIccModule, pIccTransform); |
| 4053 } | 4053 } |
| 4054 if (!pIccTransform && (~src_format & 0x0400) && (dest_format & 0x0400)) { | 4054 if (!pIccTransform && (~src_format & 0x0400) && (dest_format & 0x0400)) { |
| 4055 return FALSE; | 4055 return false; |
| 4056 } | 4056 } |
| 4057 if ((m_SrcFormat & 0xff) <= 8) { | 4057 if ((m_SrcFormat & 0xff) <= 8) { |
| 4058 if (dest_format == FXDIB_8bppMask) { | 4058 if (dest_format == FXDIB_8bppMask) { |
| 4059 return TRUE; | 4059 return true; |
| 4060 } | 4060 } |
| 4061 ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPalette, | 4061 ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPalette, |
| 4062 pSrcPalette, pIccModule, | 4062 pSrcPalette, pIccModule, |
| 4063 pIccTransform); | 4063 pIccTransform); |
| 4064 m_Transparency = | 4064 m_Transparency = |
| 4065 (dest_format == FXDIB_Argb ? 1 : 0) + (dest_format & 0x0200 ? 2 : 0) + | 4065 (dest_format == FXDIB_Argb ? 1 : 0) + (dest_format & 0x0200 ? 2 : 0) + |
| 4066 (dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0); | 4066 (dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0); |
| 4067 return TRUE; | 4067 return true; |
| 4068 } | 4068 } |
| 4069 m_Transparency = (src_format & 0x0200 ? 0 : 1) + | 4069 m_Transparency = (src_format & 0x0200 ? 0 : 1) + |
| 4070 (dest_format & 0x0200 ? 0 : 2) + | 4070 (dest_format & 0x0200 ? 0 : 2) + |
| 4071 (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) + | 4071 (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) + |
| 4072 (bClip ? 8 : 0) + (src_format & 0x0400 ? 16 : 0) + | 4072 (bClip ? 8 : 0) + (src_format & 0x0400 ? 16 : 0) + |
| 4073 (dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0); | 4073 (dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0); |
| 4074 return TRUE; | 4074 return true; |
| 4075 } | 4075 } |
| 4076 | 4076 |
| 4077 void CFX_ScanlineCompositor::CompositeRgbBitmapLine( | 4077 void CFX_ScanlineCompositor::CompositeRgbBitmapLine( |
| 4078 uint8_t* dest_scan, | 4078 uint8_t* dest_scan, |
| 4079 const uint8_t* src_scan, | 4079 const uint8_t* src_scan, |
| 4080 int width, | 4080 int width, |
| 4081 const uint8_t* clip_scan, | 4081 const uint8_t* clip_scan, |
| 4082 const uint8_t* src_extra_alpha, | 4082 const uint8_t* src_extra_alpha, |
| 4083 uint8_t* dst_extra_alpha) { | 4083 uint8_t* dst_extra_alpha) { |
| 4084 int src_Bpp = (m_SrcFormat & 0xff) >> 3; | 4084 int src_Bpp = (m_SrcFormat & 0xff) >> 3; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4474 CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | 4474 CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4475 m_MaskGreen, m_MaskBlue, src_left, width, | 4475 m_MaskGreen, m_MaskBlue, src_left, width, |
| 4476 m_BlendType, clip_scan); | 4476 m_BlendType, clip_scan); |
| 4477 } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) { | 4477 } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) { |
| 4478 CompositeRow_BitMask2Rgb( | 4478 CompositeRow_BitMask2Rgb( |
| 4479 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4479 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
| 4480 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); | 4480 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); |
| 4481 } | 4481 } |
| 4482 } | 4482 } |
| 4483 | 4483 |
| 4484 FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, | 4484 bool CFX_DIBitmap::CompositeBitmap(int dest_left, |
| 4485 int dest_top, | 4485 int dest_top, |
| 4486 int width, | 4486 int width, |
| 4487 int height, | 4487 int height, |
| 4488 const CFX_DIBSource* pSrcBitmap, | 4488 const CFX_DIBSource* pSrcBitmap, |
| 4489 int src_left, | 4489 int src_left, |
| 4490 int src_top, | 4490 int src_top, |
| 4491 int blend_type, | 4491 int blend_type, |
| 4492 const CFX_ClipRgn* pClipRgn, | 4492 const CFX_ClipRgn* pClipRgn, |
| 4493 FX_BOOL bRgbByteOrder, | 4493 bool bRgbByteOrder, |
| 4494 void* pIccTransform) { | 4494 void* pIccTransform) { |
| 4495 if (!m_pBuffer) { | 4495 if (!m_pBuffer) { |
| 4496 return FALSE; | 4496 return false; |
| 4497 } | 4497 } |
| 4498 ASSERT(!pSrcBitmap->IsAlphaMask()); | 4498 ASSERT(!pSrcBitmap->IsAlphaMask()); |
| 4499 ASSERT(m_bpp >= 8); | 4499 ASSERT(m_bpp >= 8); |
| 4500 if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { | 4500 if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { |
| 4501 return FALSE; | 4501 return false; |
| 4502 } | 4502 } |
| 4503 GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), | 4503 GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), |
| 4504 pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn); | 4504 pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn); |
| 4505 if (width == 0 || height == 0) { | 4505 if (width == 0 || height == 0) { |
| 4506 return TRUE; | 4506 return true; |
| 4507 } | 4507 } |
| 4508 const CFX_DIBitmap* pClipMask = nullptr; | 4508 const CFX_DIBitmap* pClipMask = nullptr; |
| 4509 FX_RECT clip_box; | 4509 FX_RECT clip_box; |
| 4510 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4510 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
| 4511 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); | 4511 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); |
| 4512 pClipMask = pClipRgn->GetMask().GetObject(); | 4512 pClipMask = pClipRgn->GetMask().GetObject(); |
| 4513 clip_box = pClipRgn->GetBox(); | 4513 clip_box = pClipRgn->GetBox(); |
| 4514 } | 4514 } |
| 4515 CFX_ScanlineCompositor compositor; | 4515 CFX_ScanlineCompositor compositor; |
| 4516 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, | 4516 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, |
| 4517 pSrcBitmap->GetPalette(), 0, blend_type, | 4517 pSrcBitmap->GetPalette(), 0, blend_type, |
| 4518 pClipMask != nullptr, bRgbByteOrder, 0, pIccTransform)) { | 4518 pClipMask != nullptr, bRgbByteOrder, 0, pIccTransform)) { |
| 4519 return FALSE; | 4519 return false; |
| 4520 } | 4520 } |
| 4521 int dest_Bpp = m_bpp / 8; | 4521 int dest_Bpp = m_bpp / 8; |
| 4522 int src_Bpp = pSrcBitmap->GetBPP() / 8; | 4522 int src_Bpp = pSrcBitmap->GetBPP() / 8; |
| 4523 FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); | 4523 bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); |
| 4524 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; | 4524 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; |
| 4525 for (int row = 0; row < height; row++) { | 4525 for (int row = 0; row < height; row++) { |
| 4526 uint8_t* dest_scan = | 4526 uint8_t* dest_scan = |
| 4527 m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; | 4527 m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; |
| 4528 const uint8_t* src_scan = | 4528 const uint8_t* src_scan = |
| 4529 pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp; | 4529 pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp; |
| 4530 const uint8_t* src_scan_extra_alpha = | 4530 const uint8_t* src_scan_extra_alpha = |
| 4531 pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left | 4531 pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left |
| 4532 : nullptr; | 4532 : nullptr; |
| 4533 uint8_t* dst_scan_extra_alpha = | 4533 uint8_t* dst_scan_extra_alpha = |
| 4534 m_pAlphaMask | 4534 m_pAlphaMask |
| 4535 ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left | 4535 ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left |
| 4536 : nullptr; | 4536 : nullptr; |
| 4537 const uint8_t* clip_scan = nullptr; | 4537 const uint8_t* clip_scan = nullptr; |
| 4538 if (pClipMask) { | 4538 if (pClipMask) { |
| 4539 clip_scan = pClipMask->m_pBuffer + | 4539 clip_scan = pClipMask->m_pBuffer + |
| 4540 (dest_top + row - clip_box.top) * pClipMask->m_Pitch + | 4540 (dest_top + row - clip_box.top) * pClipMask->m_Pitch + |
| 4541 (dest_left - clip_box.left); | 4541 (dest_left - clip_box.left); |
| 4542 } | 4542 } |
| 4543 if (bRgb) { | 4543 if (bRgb) { |
| 4544 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_scan, | 4544 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_scan, |
| 4545 src_scan_extra_alpha, | 4545 src_scan_extra_alpha, |
| 4546 dst_scan_extra_alpha); | 4546 dst_scan_extra_alpha); |
| 4547 } else { | 4547 } else { |
| 4548 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, width, | 4548 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, width, |
| 4549 clip_scan, src_scan_extra_alpha, | 4549 clip_scan, src_scan_extra_alpha, |
| 4550 dst_scan_extra_alpha); | 4550 dst_scan_extra_alpha); |
| 4551 } | 4551 } |
| 4552 } | 4552 } |
| 4553 return TRUE; | 4553 return true; |
| 4554 } | 4554 } |
| 4555 | 4555 |
| 4556 FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, | 4556 bool CFX_DIBitmap::CompositeMask(int dest_left, |
| 4557 int dest_top, | 4557 int dest_top, |
| 4558 int width, | 4558 int width, |
| 4559 int height, | 4559 int height, |
| 4560 const CFX_DIBSource* pMask, | 4560 const CFX_DIBSource* pMask, |
| 4561 uint32_t color, | 4561 uint32_t color, |
| 4562 int src_left, | 4562 int src_left, |
| 4563 int src_top, | 4563 int src_top, |
| 4564 int blend_type, | 4564 int blend_type, |
| 4565 const CFX_ClipRgn* pClipRgn, | 4565 const CFX_ClipRgn* pClipRgn, |
| 4566 FX_BOOL bRgbByteOrder, | 4566 bool bRgbByteOrder, |
| 4567 int alpha_flag, | 4567 int alpha_flag, |
| 4568 void* pIccTransform) { | 4568 void* pIccTransform) { |
| 4569 if (!m_pBuffer) { | 4569 if (!m_pBuffer) { |
| 4570 return FALSE; | 4570 return false; |
| 4571 } | 4571 } |
| 4572 ASSERT(pMask->IsAlphaMask()); | 4572 ASSERT(pMask->IsAlphaMask()); |
| 4573 ASSERT(m_bpp >= 8); | 4573 ASSERT(m_bpp >= 8); |
| 4574 if (!pMask->IsAlphaMask() || m_bpp < 8) { | 4574 if (!pMask->IsAlphaMask() || m_bpp < 8) { |
| 4575 return FALSE; | 4575 return false; |
| 4576 } | 4576 } |
| 4577 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), | 4577 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), |
| 4578 pMask->GetHeight(), src_left, src_top, pClipRgn); | 4578 pMask->GetHeight(), src_left, src_top, pClipRgn); |
| 4579 if (width == 0 || height == 0) { | 4579 if (width == 0 || height == 0) { |
| 4580 return TRUE; | 4580 return true; |
| 4581 } | 4581 } |
| 4582 int src_alpha = | 4582 int src_alpha = |
| 4583 (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); | 4583 (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); |
| 4584 if (src_alpha == 0) { | 4584 if (src_alpha == 0) { |
| 4585 return TRUE; | 4585 return true; |
| 4586 } | 4586 } |
| 4587 const CFX_DIBitmap* pClipMask = nullptr; | 4587 const CFX_DIBitmap* pClipMask = nullptr; |
| 4588 FX_RECT clip_box; | 4588 FX_RECT clip_box; |
| 4589 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4589 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
| 4590 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); | 4590 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); |
| 4591 pClipMask = pClipRgn->GetMask().GetObject(); | 4591 pClipMask = pClipRgn->GetMask().GetObject(); |
| 4592 clip_box = pClipRgn->GetBox(); | 4592 clip_box = pClipRgn->GetBox(); |
| 4593 } | 4593 } |
| 4594 int src_bpp = pMask->GetBPP(); | 4594 int src_bpp = pMask->GetBPP(); |
| 4595 int Bpp = GetBPP() / 8; | 4595 int Bpp = GetBPP() / 8; |
| 4596 CFX_ScanlineCompositor compositor; | 4596 CFX_ScanlineCompositor compositor; |
| 4597 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, nullptr, color, | 4597 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, nullptr, color, |
| 4598 blend_type, pClipMask != nullptr, bRgbByteOrder, | 4598 blend_type, pClipMask != nullptr, bRgbByteOrder, |
| 4599 alpha_flag, pIccTransform)) { | 4599 alpha_flag, pIccTransform)) { |
| 4600 return FALSE; | 4600 return false; |
| 4601 } | 4601 } |
| 4602 for (int row = 0; row < height; row++) { | 4602 for (int row = 0; row < height; row++) { |
| 4603 uint8_t* dest_scan = | 4603 uint8_t* dest_scan = |
| 4604 m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; | 4604 m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; |
| 4605 const uint8_t* src_scan = pMask->GetScanline(src_top + row); | 4605 const uint8_t* src_scan = pMask->GetScanline(src_top + row); |
| 4606 uint8_t* dst_scan_extra_alpha = | 4606 uint8_t* dst_scan_extra_alpha = |
| 4607 m_pAlphaMask | 4607 m_pAlphaMask |
| 4608 ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left | 4608 ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left |
| 4609 : nullptr; | 4609 : nullptr; |
| 4610 const uint8_t* clip_scan = nullptr; | 4610 const uint8_t* clip_scan = nullptr; |
| 4611 if (pClipMask) { | 4611 if (pClipMask) { |
| 4612 clip_scan = pClipMask->m_pBuffer + | 4612 clip_scan = pClipMask->m_pBuffer + |
| 4613 (dest_top + row - clip_box.top) * pClipMask->m_Pitch + | 4613 (dest_top + row - clip_box.top) * pClipMask->m_Pitch + |
| 4614 (dest_left - clip_box.left); | 4614 (dest_left - clip_box.left); |
| 4615 } | 4615 } |
| 4616 if (src_bpp == 1) { | 4616 if (src_bpp == 1) { |
| 4617 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width, | 4617 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width, |
| 4618 clip_scan, dst_scan_extra_alpha); | 4618 clip_scan, dst_scan_extra_alpha); |
| 4619 } else { | 4619 } else { |
| 4620 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, width, | 4620 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, width, |
| 4621 clip_scan, dst_scan_extra_alpha); | 4621 clip_scan, dst_scan_extra_alpha); |
| 4622 } | 4622 } |
| 4623 } | 4623 } |
| 4624 return TRUE; | 4624 return true; |
| 4625 } | 4625 } |
| 4626 | 4626 |
| 4627 FX_BOOL CFX_DIBitmap::CompositeRect(int left, | 4627 bool CFX_DIBitmap::CompositeRect(int left, |
| 4628 int top, | 4628 int top, |
| 4629 int width, | 4629 int width, |
| 4630 int height, | 4630 int height, |
| 4631 uint32_t color, | 4631 uint32_t color, |
| 4632 int alpha_flag, | 4632 int alpha_flag, |
| 4633 void* pIccTransform) { | 4633 void* pIccTransform) { |
| 4634 if (!m_pBuffer) { | 4634 if (!m_pBuffer) { |
| 4635 return FALSE; | 4635 return false; |
| 4636 } | 4636 } |
| 4637 int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); | 4637 int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); |
| 4638 if (src_alpha == 0) { | 4638 if (src_alpha == 0) { |
| 4639 return TRUE; | 4639 return true; |
| 4640 } | 4640 } |
| 4641 FX_RECT rect(left, top, left + width, top + height); | 4641 FX_RECT rect(left, top, left + width, top + height); |
| 4642 rect.Intersect(0, 0, m_Width, m_Height); | 4642 rect.Intersect(0, 0, m_Width, m_Height); |
| 4643 if (rect.IsEmpty()) { | 4643 if (rect.IsEmpty()) { |
| 4644 return TRUE; | 4644 return true; |
| 4645 } | 4645 } |
| 4646 width = rect.Width(); | 4646 width = rect.Width(); |
| 4647 uint32_t dst_color; | 4647 uint32_t dst_color; |
| 4648 if (alpha_flag >> 8) { | 4648 if (alpha_flag >> 8) { |
| 4649 dst_color = FXCMYK_TODIB(color); | 4649 dst_color = FXCMYK_TODIB(color); |
| 4650 } else { | 4650 } else { |
| 4651 dst_color = FXARGB_TODIB(color); | 4651 dst_color = FXARGB_TODIB(color); |
| 4652 } | 4652 } |
| 4653 uint8_t* color_p = (uint8_t*)&dst_color; | 4653 uint8_t* color_p = (uint8_t*)&dst_color; |
| 4654 if (m_bpp == 8) { | 4654 if (m_bpp == 8) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4677 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; | 4677 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; |
| 4678 if (src_alpha == 255) { | 4678 if (src_alpha == 255) { |
| 4679 FXSYS_memset(dest_scan, gray, width); | 4679 FXSYS_memset(dest_scan, gray, width); |
| 4680 } else { | 4680 } else { |
| 4681 for (int col = 0; col < width; col++) { | 4681 for (int col = 0; col < width; col++) { |
| 4682 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 4682 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
| 4683 dest_scan++; | 4683 dest_scan++; |
| 4684 } | 4684 } |
| 4685 } | 4685 } |
| 4686 } | 4686 } |
| 4687 return TRUE; | 4687 return true; |
| 4688 } | 4688 } |
| 4689 if (m_bpp == 1) { | 4689 if (m_bpp == 1) { |
| 4690 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); | 4690 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); |
| 4691 int left_shift = rect.left % 8; | 4691 int left_shift = rect.left % 8; |
| 4692 int right_shift = rect.right % 8; | 4692 int right_shift = rect.right % 8; |
| 4693 int new_width = rect.right / 8 - rect.left / 8; | 4693 int new_width = rect.right / 8 - rect.left / 8; |
| 4694 int index = 0; | 4694 int index = 0; |
| 4695 if (m_pPalette) { | 4695 if (m_pPalette) { |
| 4696 for (int i = 0; i < 2; i++) { | 4696 for (int i = 0; i < 2; i++) { |
| 4697 if (m_pPalette.get()[i] == color) { | 4697 if (m_pPalette.get()[i] == color) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4716 *dest_scan_top_r |= ~right_flag; | 4716 *dest_scan_top_r |= ~right_flag; |
| 4717 } | 4717 } |
| 4718 } else { | 4718 } else { |
| 4719 if (!index) { | 4719 if (!index) { |
| 4720 *dest_scan_top &= left_flag | right_flag; | 4720 *dest_scan_top &= left_flag | right_flag; |
| 4721 } else { | 4721 } else { |
| 4722 *dest_scan_top |= ~(left_flag | right_flag); | 4722 *dest_scan_top |= ~(left_flag | right_flag); |
| 4723 } | 4723 } |
| 4724 } | 4724 } |
| 4725 } | 4725 } |
| 4726 return TRUE; | 4726 return true; |
| 4727 } | 4727 } |
| 4728 ASSERT(m_bpp >= 24); | 4728 ASSERT(m_bpp >= 24); |
| 4729 if (m_bpp < 24) { | 4729 if (m_bpp < 24) { |
| 4730 return FALSE; | 4730 return false; |
| 4731 } | 4731 } |
| 4732 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { | 4732 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { |
| 4733 CCodec_IccModule* pIccModule = | 4733 CCodec_IccModule* pIccModule = |
| 4734 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 4734 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 4735 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); | 4735 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); |
| 4736 } else { | 4736 } else { |
| 4737 if (alpha_flag >> 8 && !IsCmykImage()) { | 4737 if (alpha_flag >> 8 && !IsCmykImage()) { |
| 4738 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), | 4738 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), |
| 4739 FXSYS_GetYValue(color), FXSYS_GetKValue(color), | 4739 FXSYS_GetYValue(color), FXSYS_GetKValue(color), |
| 4740 color_p[2], color_p[1], color_p[0]); | 4740 color_p[2], color_p[1], color_p[0]); |
| 4741 } else if (!(alpha_flag >> 8) && IsCmykImage()) { | 4741 } else if (!(alpha_flag >> 8) && IsCmykImage()) { |
| 4742 return FALSE; | 4742 return false; |
| 4743 } | 4743 } |
| 4744 } | 4744 } |
| 4745 if (!IsCmykImage()) { | 4745 if (!IsCmykImage()) { |
| 4746 color_p[3] = (uint8_t)src_alpha; | 4746 color_p[3] = (uint8_t)src_alpha; |
| 4747 } | 4747 } |
| 4748 int Bpp = m_bpp / 8; | 4748 int Bpp = m_bpp / 8; |
| 4749 FX_BOOL bAlpha = HasAlpha(); | 4749 bool bAlpha = HasAlpha(); |
| 4750 bool bArgb = GetFormat() == FXDIB_Argb; | 4750 bool bArgb = GetFormat() == FXDIB_Argb; |
| 4751 if (src_alpha == 255) { | 4751 if (src_alpha == 255) { |
| 4752 for (int row = rect.top; row < rect.bottom; row++) { | 4752 for (int row = rect.top; row < rect.bottom; row++) { |
| 4753 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; | 4753 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; |
| 4754 uint8_t* dest_scan_alpha = | 4754 uint8_t* dest_scan_alpha = |
| 4755 m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left | 4755 m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left |
| 4756 : nullptr; | 4756 : nullptr; |
| 4757 if (dest_scan_alpha) { | 4757 if (dest_scan_alpha) { |
| 4758 FXSYS_memset(dest_scan_alpha, 0xff, width); | 4758 FXSYS_memset(dest_scan_alpha, 0xff, width); |
| 4759 } | 4759 } |
| 4760 if (Bpp == 4) { | 4760 if (Bpp == 4) { |
| 4761 uint32_t* scan = (uint32_t*)dest_scan; | 4761 uint32_t* scan = (uint32_t*)dest_scan; |
| 4762 for (int col = 0; col < width; col++) { | 4762 for (int col = 0; col < width; col++) { |
| 4763 *scan++ = dst_color; | 4763 *scan++ = dst_color; |
| 4764 } | 4764 } |
| 4765 } else { | 4765 } else { |
| 4766 for (int col = 0; col < width; col++) { | 4766 for (int col = 0; col < width; col++) { |
| 4767 *dest_scan++ = color_p[0]; | 4767 *dest_scan++ = color_p[0]; |
| 4768 *dest_scan++ = color_p[1]; | 4768 *dest_scan++ = color_p[1]; |
| 4769 *dest_scan++ = color_p[2]; | 4769 *dest_scan++ = color_p[2]; |
| 4770 } | 4770 } |
| 4771 } | 4771 } |
| 4772 } | 4772 } |
| 4773 return TRUE; | 4773 return true; |
| 4774 } | 4774 } |
| 4775 for (int row = rect.top; row < rect.bottom; row++) { | 4775 for (int row = rect.top; row < rect.bottom; row++) { |
| 4776 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; | 4776 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; |
| 4777 if (bAlpha) { | 4777 if (bAlpha) { |
| 4778 if (bArgb) { | 4778 if (bArgb) { |
| 4779 for (int col = 0; col < width; col++) { | 4779 for (int col = 0; col < width; col++) { |
| 4780 uint8_t back_alpha = dest_scan[3]; | 4780 uint8_t back_alpha = dest_scan[3]; |
| 4781 if (back_alpha == 0) { | 4781 if (back_alpha == 0) { |
| 4782 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[2], | 4782 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[2], |
| 4783 color_p[1], color_p[0])); | 4783 color_p[1], color_p[0])); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4823 if (comps == 3) { | 4823 if (comps == 3) { |
| 4824 *dest_scan++ = 255; | 4824 *dest_scan++ = 255; |
| 4825 continue; | 4825 continue; |
| 4826 } | 4826 } |
| 4827 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], src_alpha); | 4827 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], src_alpha); |
| 4828 dest_scan++; | 4828 dest_scan++; |
| 4829 } | 4829 } |
| 4830 } | 4830 } |
| 4831 } | 4831 } |
| 4832 } | 4832 } |
| 4833 return TRUE; | 4833 return true; |
| 4834 } | 4834 } |
| 4835 | 4835 |
| 4836 CFX_BitmapComposer::CFX_BitmapComposer() { | 4836 CFX_BitmapComposer::CFX_BitmapComposer() { |
| 4837 m_pScanlineV = nullptr; | 4837 m_pScanlineV = nullptr; |
| 4838 m_pScanlineAlphaV = nullptr; | 4838 m_pScanlineAlphaV = nullptr; |
| 4839 m_pClipScanV = nullptr; | 4839 m_pClipScanV = nullptr; |
| 4840 m_pAddClipScan = nullptr; | 4840 m_pAddClipScan = nullptr; |
| 4841 m_bRgbByteOrder = FALSE; | 4841 m_bRgbByteOrder = false; |
| 4842 m_BlendType = FXDIB_BLEND_NORMAL; | 4842 m_BlendType = FXDIB_BLEND_NORMAL; |
| 4843 } | 4843 } |
| 4844 | 4844 |
| 4845 CFX_BitmapComposer::~CFX_BitmapComposer() { | 4845 CFX_BitmapComposer::~CFX_BitmapComposer() { |
| 4846 FX_Free(m_pScanlineV); | 4846 FX_Free(m_pScanlineV); |
| 4847 FX_Free(m_pScanlineAlphaV); | 4847 FX_Free(m_pScanlineAlphaV); |
| 4848 FX_Free(m_pClipScanV); | 4848 FX_Free(m_pClipScanV); |
| 4849 FX_Free(m_pAddClipScan); | 4849 FX_Free(m_pAddClipScan); |
| 4850 } | 4850 } |
| 4851 | 4851 |
| 4852 void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, | 4852 void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, |
| 4853 const CFX_ClipRgn* pClipRgn, | 4853 const CFX_ClipRgn* pClipRgn, |
| 4854 int bitmap_alpha, | 4854 int bitmap_alpha, |
| 4855 uint32_t mask_color, | 4855 uint32_t mask_color, |
| 4856 FX_RECT& dest_rect, | 4856 FX_RECT& dest_rect, |
| 4857 FX_BOOL bVertical, | 4857 bool bVertical, |
| 4858 FX_BOOL bFlipX, | 4858 bool bFlipX, |
| 4859 FX_BOOL bFlipY, | 4859 bool bFlipY, |
| 4860 FX_BOOL bRgbByteOrder, | 4860 bool bRgbByteOrder, |
| 4861 int alpha_flag, | 4861 int alpha_flag, |
| 4862 void* pIccTransform, | 4862 void* pIccTransform, |
| 4863 int blend_type) { | 4863 int blend_type) { |
| 4864 m_pBitmap = pDest; | 4864 m_pBitmap = pDest; |
| 4865 m_pClipRgn = pClipRgn; | 4865 m_pClipRgn = pClipRgn; |
| 4866 m_DestLeft = dest_rect.left; | 4866 m_DestLeft = dest_rect.left; |
| 4867 m_DestTop = dest_rect.top; | 4867 m_DestTop = dest_rect.top; |
| 4868 m_DestWidth = dest_rect.Width(); | 4868 m_DestWidth = dest_rect.Width(); |
| 4869 m_DestHeight = dest_rect.Height(); | 4869 m_DestHeight = dest_rect.Height(); |
| 4870 m_BitmapAlpha = bitmap_alpha; | 4870 m_BitmapAlpha = bitmap_alpha; |
| 4871 m_MaskColor = mask_color; | 4871 m_MaskColor = mask_color; |
| 4872 m_pClipMask = nullptr; | 4872 m_pClipMask = nullptr; |
| 4873 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4873 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
| 4874 m_pClipMask = pClipRgn->GetMask().GetObject(); | 4874 m_pClipMask = pClipRgn->GetMask().GetObject(); |
| 4875 } | 4875 } |
| 4876 m_bVertical = bVertical; | 4876 m_bVertical = bVertical; |
| 4877 m_bFlipX = bFlipX; | 4877 m_bFlipX = bFlipX; |
| 4878 m_bFlipY = bFlipY; | 4878 m_bFlipY = bFlipY; |
| 4879 m_AlphaFlag = alpha_flag; | 4879 m_AlphaFlag = alpha_flag; |
| 4880 m_pIccTransform = pIccTransform; | 4880 m_pIccTransform = pIccTransform; |
| 4881 m_bRgbByteOrder = bRgbByteOrder; | 4881 m_bRgbByteOrder = bRgbByteOrder; |
| 4882 m_BlendType = blend_type; | 4882 m_BlendType = blend_type; |
| 4883 } | 4883 } |
| 4884 FX_BOOL CFX_BitmapComposer::SetInfo(int width, | 4884 bool CFX_BitmapComposer::SetInfo(int width, |
| 4885 int height, | 4885 int height, |
| 4886 FXDIB_Format src_format, | 4886 FXDIB_Format src_format, |
| 4887 uint32_t* pSrcPalette) { | 4887 uint32_t* pSrcPalette) { |
| 4888 m_SrcFormat = src_format; | 4888 m_SrcFormat = src_format; |
| 4889 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette, | 4889 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette, |
| 4890 m_MaskColor, FXDIB_BLEND_NORMAL, | 4890 m_MaskColor, FXDIB_BLEND_NORMAL, |
| 4891 m_pClipMask != nullptr || (m_BitmapAlpha < 255), | 4891 m_pClipMask != nullptr || (m_BitmapAlpha < 255), |
| 4892 m_bRgbByteOrder, m_AlphaFlag, m_pIccTransform)) { | 4892 m_bRgbByteOrder, m_AlphaFlag, m_pIccTransform)) { |
| 4893 return FALSE; | 4893 return false; |
| 4894 } | 4894 } |
| 4895 if (m_bVertical) { | 4895 if (m_bVertical) { |
| 4896 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); | 4896 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); |
| 4897 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); | 4897 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); |
| 4898 if (m_pBitmap->m_pAlphaMask) { | 4898 if (m_pBitmap->m_pAlphaMask) { |
| 4899 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); | 4899 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); |
| 4900 } | 4900 } |
| 4901 } | 4901 } |
| 4902 if (m_BitmapAlpha < 255) { | 4902 if (m_BitmapAlpha < 255) { |
| 4903 m_pAddClipScan = FX_Alloc( | 4903 m_pAddClipScan = FX_Alloc( |
| 4904 uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); | 4904 uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); |
| 4905 } | 4905 } |
| 4906 return TRUE; | 4906 return true; |
| 4907 } | 4907 } |
| 4908 | 4908 |
| 4909 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, | 4909 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, |
| 4910 const uint8_t* src_scan, | 4910 const uint8_t* src_scan, |
| 4911 int dest_width, | 4911 int dest_width, |
| 4912 const uint8_t* clip_scan, | 4912 const uint8_t* clip_scan, |
| 4913 const uint8_t* src_extra_alpha, | 4913 const uint8_t* src_extra_alpha, |
| 4914 uint8_t* dst_extra_alpha) { | 4914 uint8_t* dst_extra_alpha) { |
| 4915 if (m_BitmapAlpha < 255) { | 4915 if (m_BitmapAlpha < 255) { |
| 4916 if (clip_scan) { | 4916 if (clip_scan) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5030 } | 5030 } |
| 5031 src_alpha_scan = m_pScanlineAlphaV; | 5031 src_alpha_scan = m_pScanlineAlphaV; |
| 5032 dest_alpha_scan = dest_alpha_buf; | 5032 dest_alpha_scan = dest_alpha_buf; |
| 5033 if (dest_alpha_scan) { | 5033 if (dest_alpha_scan) { |
| 5034 for (i = 0; i < m_DestHeight; i++) { | 5034 for (i = 0; i < m_DestHeight; i++) { |
| 5035 *dest_alpha_scan = *src_alpha_scan++; | 5035 *dest_alpha_scan = *src_alpha_scan++; |
| 5036 dest_alpha_scan += y_alpha_step; | 5036 dest_alpha_scan += y_alpha_step; |
| 5037 } | 5037 } |
| 5038 } | 5038 } |
| 5039 } | 5039 } |
| OLD | NEW |