Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fxcodec/include/fx_codec.h" | 7 #include "core/fxcodec/include/fx_codec.h" |
| 8 #include "core/fxge/dib/dib_int.h" | 8 #include "core/fxge/dib/dib_int.h" |
| 9 #include "core/fxge/include/fx_ge.h" | 9 #include "core/fxge/include/fx_ge.h" |
| 10 | 10 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 } | 280 } |
| 281 } | 281 } |
| 282 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, | 282 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, |
| 283 const uint8_t* src_scan, | 283 const uint8_t* src_scan, |
| 284 int pixel_count, | 284 int pixel_count, |
| 285 int blend_type, | 285 int blend_type, |
| 286 const uint8_t* clip_scan, | 286 const uint8_t* clip_scan, |
| 287 const uint8_t* src_alpha_scan, | 287 const uint8_t* src_alpha_scan, |
| 288 uint8_t* dst_alpha_scan, | 288 uint8_t* dst_alpha_scan, |
| 289 void* pIccTransform) { | 289 void* pIccTransform) { |
| 290 ICodec_IccModule* pIccModule = nullptr; | 290 CCodec_IccModule* pIccModule = nullptr; |
| 291 if (pIccTransform) | 291 if (pIccTransform) |
| 292 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 292 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 293 | 293 |
| 294 if (blend_type) { | 294 if (blend_type) { |
| 295 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 295 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 296 if (src_alpha_scan) { | 296 if (src_alpha_scan) { |
| 297 for (int col = 0; col < pixel_count; col++) { | 297 for (int col = 0; col < pixel_count; col++) { |
| 298 uint8_t back_alpha = *dst_alpha_scan; | 298 uint8_t back_alpha = *dst_alpha_scan; |
| 299 if (back_alpha == 0) { | 299 if (back_alpha == 0) { |
| 300 int src_alpha = *src_alpha_scan++; | 300 int src_alpha = *src_alpha_scan++; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, | 486 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, |
| 487 const uint8_t* src_scan, | 487 const uint8_t* src_scan, |
| 488 int pixel_count, | 488 int pixel_count, |
| 489 int blend_type, | 489 int blend_type, |
| 490 const uint8_t* clip_scan, | 490 const uint8_t* clip_scan, |
| 491 const uint8_t* src_alpha_scan, | 491 const uint8_t* src_alpha_scan, |
| 492 void* pIccTransform) { | 492 void* pIccTransform) { |
| 493 ICodec_IccModule* pIccModule = NULL; | 493 CCodec_IccModule* pIccModule = nullptr; |
| 494 uint8_t gray; | 494 uint8_t gray; |
| 495 if (pIccTransform) | 495 if (pIccTransform) |
| 496 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 496 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 497 | 497 |
| 498 if (blend_type) { | 498 if (blend_type) { |
| 499 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 499 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 500 if (src_alpha_scan) { | 500 if (src_alpha_scan) { |
| 501 for (int col = 0; col < pixel_count; col++) { | 501 for (int col = 0; col < pixel_count; col++) { |
| 502 int src_alpha = *src_alpha_scan++; | 502 int src_alpha = *src_alpha_scan++; |
| 503 if (clip_scan) | 503 if (clip_scan) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 } | 579 } |
| 580 } | 580 } |
| 581 | 581 |
| 582 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, | 582 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, |
| 583 const uint8_t* src_scan, | 583 const uint8_t* src_scan, |
| 584 int src_Bpp, | 584 int src_Bpp, |
| 585 int pixel_count, | 585 int pixel_count, |
| 586 int blend_type, | 586 int blend_type, |
| 587 const uint8_t* clip_scan, | 587 const uint8_t* clip_scan, |
| 588 void* pIccTransform) { | 588 void* pIccTransform) { |
| 589 ICodec_IccModule* pIccModule = NULL; | 589 CCodec_IccModule* pIccModule = nullptr; |
| 590 uint8_t gray; | 590 uint8_t gray; |
| 591 if (pIccTransform) { | 591 if (pIccTransform) { |
| 592 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 592 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 593 } | 593 } |
| 594 if (blend_type) { | 594 if (blend_type) { |
| 595 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 595 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 596 for (int col = 0; col < pixel_count; col++) { | 596 for (int col = 0; col < pixel_count; col++) { |
| 597 if (pIccTransform) { | 597 if (pIccTransform) { |
| 598 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 598 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 599 } else { | 599 } else { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 629 } | 629 } |
| 630 } | 630 } |
| 631 void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, | 631 void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, |
| 632 const uint8_t* src_scan, | 632 const uint8_t* src_scan, |
| 633 int src_Bpp, | 633 int src_Bpp, |
| 634 int pixel_count, | 634 int pixel_count, |
| 635 int blend_type, | 635 int blend_type, |
| 636 const uint8_t* clip_scan, | 636 const uint8_t* clip_scan, |
| 637 uint8_t* dest_alpha_scan, | 637 uint8_t* dest_alpha_scan, |
| 638 void* pIccTransform) { | 638 void* pIccTransform) { |
| 639 ICodec_IccModule* pIccModule = NULL; | 639 CCodec_IccModule* pIccModule = nullptr; |
| 640 if (pIccTransform) { | 640 if (pIccTransform) { |
| 641 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 641 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 642 } | 642 } |
| 643 if (blend_type) { | 643 if (blend_type) { |
| 644 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 644 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 645 for (int col = 0; col < pixel_count; col++) { | 645 for (int col = 0; col < pixel_count; col++) { |
| 646 int back_alpha = *dest_alpha_scan; | 646 int back_alpha = *dest_alpha_scan; |
| 647 if (back_alpha == 0) { | 647 if (back_alpha == 0) { |
| 648 if (pIccTransform) { | 648 if (pIccTransform) { |
| 649 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); | 649 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1435 void _CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, | 1435 void _CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, |
| 1436 const uint8_t* src_scan, | 1436 const uint8_t* src_scan, |
| 1437 int pixel_count, | 1437 int pixel_count, |
| 1438 int blend_type, | 1438 int blend_type, |
| 1439 const uint8_t* clip_scan, | 1439 const uint8_t* clip_scan, |
| 1440 uint8_t* dest_alpha_scan, | 1440 uint8_t* dest_alpha_scan, |
| 1441 const uint8_t* src_alpha_scan, | 1441 const uint8_t* src_alpha_scan, |
| 1442 uint8_t* src_cache_scan, | 1442 uint8_t* src_cache_scan, |
| 1443 void* pIccTransform) { | 1443 void* pIccTransform) { |
| 1444 uint8_t* dp = src_cache_scan; | 1444 uint8_t* dp = src_cache_scan; |
| 1445 ICodec_IccModule* pIccModule = | 1445 CCodec_IccModule* pIccModule = |
| 1446 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1446 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1447 if (src_alpha_scan) { | 1447 if (src_alpha_scan) { |
| 1448 if (dest_alpha_scan) { | 1448 if (dest_alpha_scan) { |
| 1449 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, pixel_count); | 1449 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, pixel_count); |
| 1450 } else { | 1450 } else { |
| 1451 for (int col = 0; col < pixel_count; col++) { | 1451 for (int col = 0; col < pixel_count; col++) { |
| 1452 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1452 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1453 dp[3] = *src_alpha_scan++; | 1453 dp[3] = *src_alpha_scan++; |
| 1454 src_scan += 3; | 1454 src_scan += 3; |
| 1455 dp += 4; | 1455 dp += 4; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1529 clip_scan, dest_alpha_scan, src_alpha_scan); | 1529 clip_scan, dest_alpha_scan, src_alpha_scan); |
| 1530 } | 1530 } |
| 1531 void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(uint8_t* dest_scan, | 1531 void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(uint8_t* dest_scan, |
| 1532 const uint8_t* src_scan, | 1532 const uint8_t* src_scan, |
| 1533 int width, | 1533 int width, |
| 1534 int blend_type, | 1534 int blend_type, |
| 1535 int src_Bpp, | 1535 int src_Bpp, |
| 1536 uint8_t* dest_alpha_scan, | 1536 uint8_t* dest_alpha_scan, |
| 1537 uint8_t* src_cache_scan, | 1537 uint8_t* src_cache_scan, |
| 1538 void* pIccTransform) { | 1538 void* pIccTransform) { |
| 1539 ICodec_IccModule* pIccModule = | 1539 CCodec_IccModule* pIccModule = |
| 1540 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1540 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1541 if (src_Bpp == 3) { | 1541 if (src_Bpp == 3) { |
| 1542 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1542 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1543 width); | 1543 width); |
| 1544 } else { | 1544 } else { |
| 1545 uint8_t* dp = src_cache_scan; | 1545 uint8_t* dp = src_cache_scan; |
| 1546 for (int col = 0; col < width; col++) { | 1546 for (int col = 0; col < width; col++) { |
| 1547 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1547 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1548 src_scan += 4; | 1548 src_scan += 4; |
| 1549 dp += 3; | 1549 dp += 3; |
| 1550 } | 1550 } |
| 1551 } | 1551 } |
| 1552 _CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width, | 1552 _CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width, |
| 1553 blend_type, 3, dest_alpha_scan); | 1553 blend_type, 3, dest_alpha_scan); |
| 1554 } | 1554 } |
| 1555 inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform( | 1555 inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform( |
| 1556 uint8_t* dest_scan, | 1556 uint8_t* dest_scan, |
| 1557 const uint8_t* src_scan, | 1557 const uint8_t* src_scan, |
| 1558 int width, | 1558 int width, |
| 1559 int blend_type, | 1559 int blend_type, |
| 1560 int src_Bpp, | 1560 int src_Bpp, |
| 1561 const uint8_t* clip_scan, | 1561 const uint8_t* clip_scan, |
| 1562 uint8_t* dest_alpha_scan, | 1562 uint8_t* dest_alpha_scan, |
| 1563 uint8_t* src_cache_scan, | 1563 uint8_t* src_cache_scan, |
| 1564 void* pIccTransform) { | 1564 void* pIccTransform) { |
| 1565 ICodec_IccModule* pIccModule = | 1565 CCodec_IccModule* pIccModule = |
| 1566 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1566 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1567 if (src_Bpp == 3) { | 1567 if (src_Bpp == 3) { |
| 1568 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1568 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1569 width); | 1569 width); |
| 1570 } else { | 1570 } else { |
| 1571 uint8_t* dp = src_cache_scan; | 1571 uint8_t* dp = src_cache_scan; |
| 1572 for (int col = 0; col < width; col++) { | 1572 for (int col = 0; col < width; col++) { |
| 1573 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1573 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1574 src_scan += 4; | 1574 src_scan += 4; |
| 1575 dp += 3; | 1575 dp += 3; |
| 1576 } | 1576 } |
| 1577 } | 1577 } |
| 1578 _CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, | 1578 _CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, |
| 1579 blend_type, 3, clip_scan, dest_alpha_scan); | 1579 blend_type, 3, clip_scan, dest_alpha_scan); |
| 1580 } | 1580 } |
| 1581 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform( | 1581 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform( |
| 1582 uint8_t* dest_scan, | 1582 uint8_t* dest_scan, |
| 1583 const uint8_t* src_scan, | 1583 const uint8_t* src_scan, |
| 1584 int width, | 1584 int width, |
| 1585 int src_Bpp, | 1585 int src_Bpp, |
| 1586 const uint8_t* clip_scan, | 1586 const uint8_t* clip_scan, |
| 1587 uint8_t* dest_alpha_scan, | 1587 uint8_t* dest_alpha_scan, |
| 1588 uint8_t* src_cache_scan, | 1588 uint8_t* src_cache_scan, |
| 1589 void* pIccTransform) { | 1589 void* pIccTransform) { |
| 1590 ICodec_IccModule* pIccModule = | 1590 CCodec_IccModule* pIccModule = |
| 1591 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1591 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1592 if (src_Bpp == 3) { | 1592 if (src_Bpp == 3) { |
| 1593 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1593 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1594 width); | 1594 width); |
| 1595 } else { | 1595 } else { |
| 1596 uint8_t* dp = src_cache_scan; | 1596 uint8_t* dp = src_cache_scan; |
| 1597 for (int col = 0; col < width; col++) { | 1597 for (int col = 0; col < width; col++) { |
| 1598 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1598 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1599 src_scan += 4; | 1599 src_scan += 4; |
| 1600 dp += 3; | 1600 dp += 3; |
| 1601 } | 1601 } |
| 1602 } | 1602 } |
| 1603 _CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3, | 1603 _CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3, |
| 1604 clip_scan, dest_alpha_scan); | 1604 clip_scan, dest_alpha_scan); |
| 1605 } | 1605 } |
| 1606 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform( | 1606 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform( |
| 1607 uint8_t* dest_scan, | 1607 uint8_t* dest_scan, |
| 1608 const uint8_t* src_scan, | 1608 const uint8_t* src_scan, |
| 1609 int width, | 1609 int width, |
| 1610 int src_Bpp, | 1610 int src_Bpp, |
| 1611 uint8_t* dest_alpha_scan, | 1611 uint8_t* dest_alpha_scan, |
| 1612 uint8_t* src_cache_scan, | 1612 uint8_t* src_cache_scan, |
| 1613 void* pIccTransform) { | 1613 void* pIccTransform) { |
| 1614 ICodec_IccModule* pIccModule = | 1614 CCodec_IccModule* pIccModule = |
| 1615 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1615 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1616 if (src_Bpp == 3) { | 1616 if (src_Bpp == 3) { |
| 1617 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1617 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1618 width); | 1618 width); |
| 1619 } else { | 1619 } else { |
| 1620 uint8_t* dp = src_cache_scan; | 1620 uint8_t* dp = src_cache_scan; |
| 1621 for (int col = 0; col < width; col++) { | 1621 for (int col = 0; col < width; col++) { |
| 1622 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1622 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1623 src_scan += 4; | 1623 src_scan += 4; |
| 1624 dp += 3; | 1624 dp += 3; |
| 1625 } | 1625 } |
| 1626 } | 1626 } |
| 1627 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, | 1627 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, |
| 1628 dest_alpha_scan); | 1628 dest_alpha_scan); |
| 1629 } | 1629 } |
| 1630 inline void _CompositeRow_Argb2Rgb_Blend_Transform( | 1630 inline void _CompositeRow_Argb2Rgb_Blend_Transform( |
| 1631 uint8_t* dest_scan, | 1631 uint8_t* dest_scan, |
| 1632 const uint8_t* src_scan, | 1632 const uint8_t* src_scan, |
| 1633 int width, | 1633 int width, |
| 1634 int blend_type, | 1634 int blend_type, |
| 1635 int dest_Bpp, | 1635 int dest_Bpp, |
| 1636 const uint8_t* clip_scan, | 1636 const uint8_t* clip_scan, |
| 1637 const uint8_t* src_alpha_scan, | 1637 const uint8_t* src_alpha_scan, |
| 1638 uint8_t* src_cache_scan, | 1638 uint8_t* src_cache_scan, |
| 1639 void* pIccTransform) { | 1639 void* pIccTransform) { |
| 1640 ICodec_IccModule* pIccModule = | 1640 CCodec_IccModule* pIccModule = |
| 1641 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1641 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1642 if (src_alpha_scan) { | 1642 if (src_alpha_scan) { |
| 1643 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1643 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1644 width); | 1644 width); |
| 1645 } else { | 1645 } else { |
| 1646 int blended_colors[3]; | 1646 int blended_colors[3]; |
| 1647 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1647 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1648 int dest_gap = dest_Bpp - 3; | 1648 int dest_gap = dest_Bpp - 3; |
| 1649 for (int col = 0; col < width; col++) { | 1649 for (int col = 0; col < width; col++) { |
| 1650 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); | 1650 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1681 } | 1681 } |
| 1682 inline void _CompositeRow_Argb2Rgb_NoBlend_Transform( | 1682 inline void _CompositeRow_Argb2Rgb_NoBlend_Transform( |
| 1683 uint8_t* dest_scan, | 1683 uint8_t* dest_scan, |
| 1684 const uint8_t* src_scan, | 1684 const uint8_t* src_scan, |
| 1685 int width, | 1685 int width, |
| 1686 int dest_Bpp, | 1686 int dest_Bpp, |
| 1687 const uint8_t* clip_scan, | 1687 const uint8_t* clip_scan, |
| 1688 const uint8_t* src_alpha_scan, | 1688 const uint8_t* src_alpha_scan, |
| 1689 uint8_t* src_cache_scan, | 1689 uint8_t* src_cache_scan, |
| 1690 void* pIccTransform) { | 1690 void* pIccTransform) { |
| 1691 ICodec_IccModule* pIccModule = | 1691 CCodec_IccModule* pIccModule = |
| 1692 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1692 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1693 if (src_alpha_scan) { | 1693 if (src_alpha_scan) { |
| 1694 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1694 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1695 width); | 1695 width); |
| 1696 } else { | 1696 } else { |
| 1697 int dest_gap = dest_Bpp - 3; | 1697 int dest_gap = dest_Bpp - 3; |
| 1698 for (int col = 0; col < width; col++) { | 1698 for (int col = 0; col < width; col++) { |
| 1699 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); | 1699 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); |
| 1700 uint8_t src_alpha; | 1700 uint8_t src_alpha; |
| 1701 if (clip_scan) { | 1701 if (clip_scan) { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 1730 } | 1730 } |
| 1731 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform( | 1731 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform( |
| 1732 uint8_t* dest_scan, | 1732 uint8_t* dest_scan, |
| 1733 const uint8_t* src_scan, | 1733 const uint8_t* src_scan, |
| 1734 int width, | 1734 int width, |
| 1735 int blend_type, | 1735 int blend_type, |
| 1736 int dest_Bpp, | 1736 int dest_Bpp, |
| 1737 int src_Bpp, | 1737 int src_Bpp, |
| 1738 uint8_t* src_cache_scan, | 1738 uint8_t* src_cache_scan, |
| 1739 void* pIccTransform) { | 1739 void* pIccTransform) { |
| 1740 ICodec_IccModule* pIccModule = | 1740 CCodec_IccModule* pIccModule = |
| 1741 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1741 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1742 if (src_Bpp == 3) { | 1742 if (src_Bpp == 3) { |
| 1743 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1743 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1744 width); | 1744 width); |
| 1745 } else { | 1745 } else { |
| 1746 uint8_t* dp = src_cache_scan; | 1746 uint8_t* dp = src_cache_scan; |
| 1747 for (int col = 0; col < width; col++) { | 1747 for (int col = 0; col < width; col++) { |
| 1748 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1748 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1749 src_scan += 4; | 1749 src_scan += 4; |
| 1750 dp += 3; | 1750 dp += 3; |
| 1751 } | 1751 } |
| 1752 } | 1752 } |
| 1753 _CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width, | 1753 _CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width, |
| 1754 blend_type, dest_Bpp, 3); | 1754 blend_type, dest_Bpp, 3); |
| 1755 } | 1755 } |
| 1756 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(uint8_t* dest_scan, | 1756 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(uint8_t* dest_scan, |
| 1757 const uint8_t* src_scan, | 1757 const uint8_t* src_scan, |
| 1758 int width, | 1758 int width, |
| 1759 int blend_type, | 1759 int blend_type, |
| 1760 int dest_Bpp, | 1760 int dest_Bpp, |
| 1761 int src_Bpp, | 1761 int src_Bpp, |
| 1762 const uint8_t* clip_scan, | 1762 const uint8_t* clip_scan, |
| 1763 uint8_t* src_cache_scan, | 1763 uint8_t* src_cache_scan, |
| 1764 void* pIccTransform) { | 1764 void* pIccTransform) { |
| 1765 ICodec_IccModule* pIccModule = | 1765 CCodec_IccModule* pIccModule = |
| 1766 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1766 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1767 if (src_Bpp == 3) { | 1767 if (src_Bpp == 3) { |
| 1768 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1768 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1769 width); | 1769 width); |
| 1770 } else { | 1770 } else { |
| 1771 uint8_t* dp = src_cache_scan; | 1771 uint8_t* dp = src_cache_scan; |
| 1772 for (int col = 0; col < width; col++) { | 1772 for (int col = 0; col < width; col++) { |
| 1773 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1773 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1774 src_scan += 4; | 1774 src_scan += 4; |
| 1775 dp += 3; | 1775 dp += 3; |
| 1776 } | 1776 } |
| 1777 } | 1777 } |
| 1778 _CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, | 1778 _CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, |
| 1779 dest_Bpp, 3, clip_scan); | 1779 dest_Bpp, 3, clip_scan); |
| 1780 } | 1780 } |
| 1781 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform( | 1781 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform( |
| 1782 uint8_t* dest_scan, | 1782 uint8_t* dest_scan, |
| 1783 const uint8_t* src_scan, | 1783 const uint8_t* src_scan, |
| 1784 int width, | 1784 int width, |
| 1785 int dest_Bpp, | 1785 int dest_Bpp, |
| 1786 int src_Bpp, | 1786 int src_Bpp, |
| 1787 uint8_t* src_cache_scan, | 1787 uint8_t* src_cache_scan, |
| 1788 void* pIccTransform) { | 1788 void* pIccTransform) { |
| 1789 ICodec_IccModule* pIccModule = | 1789 CCodec_IccModule* pIccModule = |
| 1790 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1790 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1791 if (src_Bpp == 3) { | 1791 if (src_Bpp == 3) { |
| 1792 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1792 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1793 width); | 1793 width); |
| 1794 } else { | 1794 } else { |
| 1795 uint8_t* dp = src_cache_scan; | 1795 uint8_t* dp = src_cache_scan; |
| 1796 for (int col = 0; col < width; col++) { | 1796 for (int col = 0; col < width; col++) { |
| 1797 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1797 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1798 src_scan += 4; | 1798 src_scan += 4; |
| 1799 dp += 3; | 1799 dp += 3; |
| 1800 } | 1800 } |
| 1801 } | 1801 } |
| 1802 _CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width, | 1802 _CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width, |
| 1803 dest_Bpp, 3); | 1803 dest_Bpp, 3); |
| 1804 } | 1804 } |
| 1805 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform( | 1805 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform( |
| 1806 uint8_t* dest_scan, | 1806 uint8_t* dest_scan, |
| 1807 const uint8_t* src_scan, | 1807 const uint8_t* src_scan, |
| 1808 int width, | 1808 int width, |
| 1809 int dest_Bpp, | 1809 int dest_Bpp, |
| 1810 int src_Bpp, | 1810 int src_Bpp, |
| 1811 const uint8_t* clip_scan, | 1811 const uint8_t* clip_scan, |
| 1812 uint8_t* src_cache_scan, | 1812 uint8_t* src_cache_scan, |
| 1813 void* pIccTransform) { | 1813 void* pIccTransform) { |
| 1814 ICodec_IccModule* pIccModule = | 1814 CCodec_IccModule* pIccModule = |
| 1815 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1815 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1816 if (src_Bpp == 3) { | 1816 if (src_Bpp == 3) { |
| 1817 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1817 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1818 width); | 1818 width); |
| 1819 } else { | 1819 } else { |
| 1820 uint8_t* dp = src_cache_scan; | 1820 uint8_t* dp = src_cache_scan; |
| 1821 for (int col = 0; col < width; col++) { | 1821 for (int col = 0; col < width; col++) { |
| 1822 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1822 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1823 src_scan += 4; | 1823 src_scan += 4; |
| 1824 dp += 3; | 1824 dp += 3; |
| (...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3958 } | 3958 } |
| 3959 } | 3959 } |
| 3960 inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, | 3960 inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, |
| 3961 int alpha_flag, | 3961 int alpha_flag, |
| 3962 uint32_t mask_color, | 3962 uint32_t mask_color, |
| 3963 int& mask_alpha, | 3963 int& mask_alpha, |
| 3964 int& mask_red, | 3964 int& mask_red, |
| 3965 int& mask_green, | 3965 int& mask_green, |
| 3966 int& mask_blue, | 3966 int& mask_blue, |
| 3967 int& mask_black, | 3967 int& mask_black, |
| 3968 void* icc_module, | 3968 void* icc_module, |
|
Tom Sepez
2016/04/11 17:16:21
can these not be void*'s maybe?
dsinclair
2016/04/11 20:40:40
Done.
| |
| 3969 void* pIccTransform) { | 3969 void* pIccTransform) { |
| 3970 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; | 3970 CCodec_IccModule* pIccModule = static_cast<CCodec_IccModule*>(icc_module); |
|
Tom Sepez
2016/04/11 17:16:21
with the hope of avoiding the cast here.
dsinclair
2016/04/11 20:40:40
Done.
| |
| 3971 if (alpha_flag >> 8) { | 3971 if (alpha_flag >> 8) { |
| 3972 mask_alpha = alpha_flag & 0xff; | 3972 mask_alpha = alpha_flag & 0xff; |
| 3973 mask_red = FXSYS_GetCValue(mask_color); | 3973 mask_red = FXSYS_GetCValue(mask_color); |
| 3974 mask_green = FXSYS_GetMValue(mask_color); | 3974 mask_green = FXSYS_GetMValue(mask_color); |
| 3975 mask_blue = FXSYS_GetYValue(mask_color); | 3975 mask_blue = FXSYS_GetYValue(mask_color); |
| 3976 mask_black = FXSYS_GetKValue(mask_color); | 3976 mask_black = FXSYS_GetKValue(mask_color); |
| 3977 } else { | 3977 } else { |
| 3978 mask_alpha = FXARGB_A(mask_color); | 3978 mask_alpha = FXARGB_A(mask_color); |
| 3979 mask_red = FXARGB_R(mask_color); | 3979 mask_red = FXARGB_R(mask_color); |
| 3980 mask_green = FXARGB_G(mask_color); | 3980 mask_green = FXARGB_G(mask_color); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4023 } | 4023 } |
| 4024 } | 4024 } |
| 4025 return TRUE; | 4025 return TRUE; |
| 4026 } | 4026 } |
| 4027 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, | 4027 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, |
| 4028 FXDIB_Format dest_format, | 4028 FXDIB_Format dest_format, |
| 4029 uint32_t*& pDestPalette, | 4029 uint32_t*& pDestPalette, |
| 4030 uint32_t* pSrcPalette, | 4030 uint32_t* pSrcPalette, |
| 4031 void* icc_module, | 4031 void* icc_module, |
| 4032 void* pIccTransform) { | 4032 void* pIccTransform) { |
| 4033 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; | 4033 CCodec_IccModule* pIccModule = static_cast<CCodec_IccModule*>(icc_module); |
|
Tom Sepez
2016/04/11 17:16:21
same
dsinclair
2016/04/11 20:40:40
Done.
| |
| 4034 FX_BOOL isSrcCmyk = !!(src_format & 0x0400); | 4034 FX_BOOL isSrcCmyk = !!(src_format & 0x0400); |
| 4035 FX_BOOL isDstCmyk = !!(dest_format & 0x0400); | 4035 FX_BOOL isDstCmyk = !!(dest_format & 0x0400); |
| 4036 pDestPalette = NULL; | 4036 pDestPalette = NULL; |
| 4037 if (pIccTransform) { | 4037 if (pIccTransform) { |
| 4038 if (pSrcPalette) { | 4038 if (pSrcPalette) { |
| 4039 if ((dest_format & 0xff) == 8) { | 4039 if ((dest_format & 0xff) == 8) { |
| 4040 int pal_count = 1 << (src_format & 0xff); | 4040 int pal_count = 1 << (src_format & 0xff); |
| 4041 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); | 4041 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); |
| 4042 pDestPalette = (uint32_t*)gray_pal; | 4042 pDestPalette = (uint32_t*)gray_pal; |
| 4043 for (int i = 0; i < pal_count; i++) { | 4043 for (int i = 0; i < pal_count; i++) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4179 uint32_t mask_color, | 4179 uint32_t mask_color, |
| 4180 int blend_type, | 4180 int blend_type, |
| 4181 FX_BOOL bClip, | 4181 FX_BOOL bClip, |
| 4182 FX_BOOL bRgbByteOrder, | 4182 FX_BOOL bRgbByteOrder, |
| 4183 int alpha_flag, | 4183 int alpha_flag, |
| 4184 void* pIccTransform) { | 4184 void* pIccTransform) { |
| 4185 m_SrcFormat = src_format; | 4185 m_SrcFormat = src_format; |
| 4186 m_DestFormat = dest_format; | 4186 m_DestFormat = dest_format; |
| 4187 m_BlendType = blend_type; | 4187 m_BlendType = blend_type; |
| 4188 m_bRgbByteOrder = bRgbByteOrder; | 4188 m_bRgbByteOrder = bRgbByteOrder; |
| 4189 ICodec_IccModule* pIccModule = NULL; | 4189 CCodec_IccModule* pIccModule = nullptr; |
| 4190 if (CFX_GEModule::Get()->GetCodecModule()) { | 4190 if (CFX_GEModule::Get()->GetCodecModule()) { |
| 4191 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 4191 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 4192 } | 4192 } |
| 4193 if (!pIccModule) { | 4193 if (!pIccModule) { |
| 4194 pIccTransform = NULL; | 4194 pIccTransform = NULL; |
| 4195 } | 4195 } |
| 4196 m_pIccTransform = pIccTransform; | 4196 m_pIccTransform = pIccTransform; |
| 4197 if ((dest_format & 0xff) == 1) { | 4197 if ((dest_format & 0xff) == 1) { |
| 4198 return FALSE; | 4198 return FALSE; |
| 4199 } | 4199 } |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4796 dst_color = FXCMYK_TODIB(color); | 4796 dst_color = FXCMYK_TODIB(color); |
| 4797 } else { | 4797 } else { |
| 4798 dst_color = FXARGB_TODIB(color); | 4798 dst_color = FXARGB_TODIB(color); |
| 4799 } | 4799 } |
| 4800 uint8_t* color_p = (uint8_t*)&dst_color; | 4800 uint8_t* color_p = (uint8_t*)&dst_color; |
| 4801 if (m_bpp == 8) { | 4801 if (m_bpp == 8) { |
| 4802 uint8_t gray = 255; | 4802 uint8_t gray = 255; |
| 4803 if (!IsAlphaMask()) { | 4803 if (!IsAlphaMask()) { |
| 4804 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() && | 4804 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() && |
| 4805 CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { | 4805 CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { |
| 4806 ICodec_IccModule* pIccModule = | 4806 CCodec_IccModule* pIccModule = |
| 4807 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 4807 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 4808 pIccModule->TranslateScanline(pIccTransform, &gray, color_p, 1); | 4808 pIccModule->TranslateScanline(pIccTransform, &gray, color_p, 1); |
| 4809 } else { | 4809 } else { |
| 4810 if (alpha_flag >> 8) { | 4810 if (alpha_flag >> 8) { |
| 4811 uint8_t r, g, b; | 4811 uint8_t r, g, b; |
| 4812 AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color_p[3], r, | 4812 AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color_p[3], r, |
| 4813 g, b); | 4813 g, b); |
| 4814 gray = FXRGB2GRAY(r, g, b); | 4814 gray = FXRGB2GRAY(r, g, b); |
| 4815 } else { | 4815 } else { |
| 4816 gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]); | 4816 gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4870 } | 4870 } |
| 4871 } | 4871 } |
| 4872 } | 4872 } |
| 4873 return TRUE; | 4873 return TRUE; |
| 4874 } | 4874 } |
| 4875 ASSERT(m_bpp >= 24); | 4875 ASSERT(m_bpp >= 24); |
| 4876 if (m_bpp < 24) { | 4876 if (m_bpp < 24) { |
| 4877 return FALSE; | 4877 return FALSE; |
| 4878 } | 4878 } |
| 4879 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { | 4879 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { |
| 4880 ICodec_IccModule* pIccModule = | 4880 CCodec_IccModule* pIccModule = |
| 4881 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 4881 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 4882 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); | 4882 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); |
| 4883 } else { | 4883 } else { |
| 4884 if (alpha_flag >> 8 && !IsCmykImage()) { | 4884 if (alpha_flag >> 8 && !IsCmykImage()) { |
| 4885 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), | 4885 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), |
| 4886 FXSYS_GetYValue(color), FXSYS_GetKValue(color), | 4886 FXSYS_GetYValue(color), FXSYS_GetKValue(color), |
| 4887 color_p[2], color_p[1], color_p[0]); | 4887 color_p[2], color_p[1], color_p[0]); |
| 4888 } else if (!(alpha_flag >> 8) && IsCmykImage()) { | 4888 } else if (!(alpha_flag >> 8) && IsCmykImage()) { |
| 4889 return FALSE; | 4889 return FALSE; |
| 4890 } | 4890 } |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5171 } | 5171 } |
| 5172 src_alpha_scan = m_pScanlineAlphaV; | 5172 src_alpha_scan = m_pScanlineAlphaV; |
| 5173 dest_alpha_scan = dest_alpha_buf; | 5173 dest_alpha_scan = dest_alpha_buf; |
| 5174 if (dest_alpha_scan) { | 5174 if (dest_alpha_scan) { |
| 5175 for (i = 0; i < m_DestHeight; i++) { | 5175 for (i = 0; i < m_DestHeight; i++) { |
| 5176 *dest_alpha_scan = *src_alpha_scan++; | 5176 *dest_alpha_scan = *src_alpha_scan++; |
| 5177 dest_alpha_scan += y_alpha_step; | 5177 dest_alpha_scan += y_alpha_step; |
| 5178 } | 5178 } |
| 5179 } | 5179 } |
| 5180 } | 5180 } |
| OLD | NEW |