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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "../../../../third_party/base/nonstd_unique_ptr.h" | 9 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
10 #include "../../../include/fpdfapi/fpdf_module.h" | 10 #include "../../../include/fpdfapi/fpdf_module.h" |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 format = FXDIB_Rgb; | 731 format = FXDIB_Rgb; |
732 } | 732 } |
733 | 733 |
734 m_pCachedBitmap.reset(new CFX_DIBitmap); | 734 m_pCachedBitmap.reset(new CFX_DIBitmap); |
735 if (!m_pCachedBitmap->Create(width, height, format)) { | 735 if (!m_pCachedBitmap->Create(width, height, format)) { |
736 m_pCachedBitmap.reset(); | 736 m_pCachedBitmap.reset(); |
737 return; | 737 return; |
738 } | 738 } |
739 m_pCachedBitmap->Clear(0xFFFFFFFF); | 739 m_pCachedBitmap->Clear(0xFFFFFFFF); |
740 std::vector<uint8_t> output_offsets(components); | 740 std::vector<uint8_t> output_offsets(components); |
741 for (int i = 0; i < components; ++i) | 741 for (FX_DWORD i = 0; i < components; ++i) |
742 output_offsets[i] = i; | 742 output_offsets[i] = i; |
743 if (bSwapRGB) { | 743 if (bSwapRGB) { |
744 output_offsets[0] = 2; | 744 output_offsets[0] = 2; |
745 output_offsets[2] = 0; | 745 output_offsets[2] = 0; |
746 } | 746 } |
747 if (!pJpxModule->Decode(context->decoder(), m_pCachedBitmap->GetBuffer(), | 747 if (!pJpxModule->Decode(context->decoder(), m_pCachedBitmap->GetBuffer(), |
748 m_pCachedBitmap->GetPitch(), output_offsets)) { | 748 m_pCachedBitmap->GetPitch(), output_offsets)) { |
749 m_pCachedBitmap.reset(); | 749 m_pCachedBitmap.reset(); |
750 return; | 750 return; |
751 } | 751 } |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 temp[j] = (uint8_t)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * | 1477 temp[j] = (uint8_t)(_GetBits8(pSrcPixel, src_bit_pos, m_bpc) * |
1478 unit_To8Bpc); | 1478 unit_To8Bpc); |
1479 src_bit_pos += m_bpc; | 1479 src_bit_pos += m_bpc; |
1480 } | 1480 } |
1481 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, bTransMask); | 1481 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, bTransMask); |
1482 } else { | 1482 } else { |
1483 m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0, | 1483 m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0, |
1484 bTransMask); | 1484 bTransMask); |
1485 } | 1485 } |
1486 } else { | 1486 } else { |
1487 for (int j = 0; j < m_nComponents; ++j) { | 1487 for (FX_DWORD j = 0; j < m_nComponents; ++j) { |
1488 int color_value = | 1488 int color_value = |
1489 (int)((m_pCompData[j].m_DecodeMin + | 1489 (int)((m_pCompData[j].m_DecodeMin + |
1490 m_pCompData[j].m_DecodeStep * (FX_FLOAT)pSrcPixel[j]) * | 1490 m_pCompData[j].m_DecodeStep * (FX_FLOAT)pSrcPixel[j]) * |
1491 255.0f + | 1491 255.0f + |
1492 0.5f); | 1492 0.5f); |
1493 temp[j] = | 1493 temp[j] = |
1494 color_value > 255 ? 255 : (color_value < 0 ? 0 : color_value); | 1494 color_value > 255 ? 255 : (color_value < 0 ? 0 : color_value); |
1495 } | 1495 } |
1496 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, bTransMask); | 1496 m_pColorSpace->TranslateImageLine(color, temp, 1, 0, 0, bTransMask); |
1497 } | 1497 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 } | 1655 } |
1656 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { | 1656 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { |
1657 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); | 1657 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); |
1658 } | 1658 } |
1659 CPDF_ImageLoader::~CPDF_ImageLoader() { | 1659 CPDF_ImageLoader::~CPDF_ImageLoader() { |
1660 if (!m_bCached) { | 1660 if (!m_bCached) { |
1661 delete m_pBitmap; | 1661 delete m_pBitmap; |
1662 delete m_pMask; | 1662 delete m_pMask; |
1663 } | 1663 } |
1664 } | 1664 } |
OLD | NEW |