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/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 m_Status = 2; | 374 m_Status = 2; |
375 } | 375 } |
376 if (ret1 == 2) { | 376 if (ret1 == 2) { |
377 return ret1; | 377 return ret1; |
378 } | 378 } |
379 if (m_pColorSpace && m_bStdCS) { | 379 if (m_pColorSpace && m_bStdCS) { |
380 m_pColorSpace->EnableStdConversion(FALSE); | 380 m_pColorSpace->EnableStdConversion(FALSE); |
381 } | 381 } |
382 return ret1; | 382 return ret1; |
383 } | 383 } |
384 FXCODEC_STATUS ret = pJbig2Module->ContinueDecode(m_pJbig2Context, pPause); | 384 ret = pJbig2Module->ContinueDecode(m_pJbig2Context, pPause); |
385 if (ret < 0) { | 385 if (ret < 0) { |
386 m_pCachedBitmap.reset(); | 386 m_pCachedBitmap.reset(); |
387 m_pGlobalStream.reset(); | 387 m_pGlobalStream.reset(); |
388 pJbig2Module->DestroyJbig2Context(m_pJbig2Context); | 388 pJbig2Module->DestroyJbig2Context(m_pJbig2Context); |
389 m_pJbig2Context = nullptr; | 389 m_pJbig2Context = nullptr; |
390 return 0; | 390 return 0; |
391 } | 391 } |
392 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { | 392 if (ret == FXCODEC_STATUS_DECODE_TOBECONTINUE) { |
393 return 2; | 393 return 2; |
394 } | 394 } |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 int encoded_component = color_data % (1 << m_bpc); | 857 int encoded_component = color_data % (1 << m_bpc); |
858 color_data /= 1 << m_bpc; | 858 color_data /= 1 << m_bpc; |
859 color_value[j] = m_pCompData[j].m_DecodeMin + | 859 color_value[j] = m_pCompData[j].m_DecodeMin + |
860 m_pCompData[j].m_DecodeStep * encoded_component; | 860 m_pCompData[j].m_DecodeStep * encoded_component; |
861 } | 861 } |
862 FX_FLOAT R = 0, G = 0, B = 0; | 862 FX_FLOAT R = 0, G = 0, B = 0; |
863 if (m_nComponents == 1 && m_Family == PDFCS_ICCBASED && | 863 if (m_nComponents == 1 && m_Family == PDFCS_ICCBASED && |
864 m_pColorSpace->CountComponents() > 1) { | 864 m_pColorSpace->CountComponents() > 1) { |
865 int nComponents = m_pColorSpace->CountComponents(); | 865 int nComponents = m_pColorSpace->CountComponents(); |
866 std::vector<FX_FLOAT> temp_buf(nComponents); | 866 std::vector<FX_FLOAT> temp_buf(nComponents); |
867 for (int i = 0; i < nComponents; i++) { | 867 for (int k = 0; k < nComponents; k++) { |
868 temp_buf[i] = *color_value; | 868 temp_buf[k] = *color_value; |
869 } | 869 } |
870 m_pColorSpace->GetRGB(temp_buf.data(), R, G, B); | 870 m_pColorSpace->GetRGB(temp_buf.data(), R, G, B); |
871 } else { | 871 } else { |
872 m_pColorSpace->GetRGB(color_value, R, G, B); | 872 m_pColorSpace->GetRGB(color_value, R, G, B); |
873 } | 873 } |
874 SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255), | 874 SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255), |
875 FXSYS_round(G * 255), FXSYS_round(B * 255))); | 875 FXSYS_round(G * 255), FXSYS_round(B * 255))); |
876 } | 876 } |
877 } | 877 } |
878 } | 878 } |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 IFX_Pause* pPause) { | 1571 IFX_Pause* pPause) { |
1572 return LoadHandle->Continue(pPause); | 1572 return LoadHandle->Continue(pPause); |
1573 } | 1573 } |
1574 | 1574 |
1575 CPDF_ImageLoader::~CPDF_ImageLoader() { | 1575 CPDF_ImageLoader::~CPDF_ImageLoader() { |
1576 if (!m_bCached) { | 1576 if (!m_bCached) { |
1577 delete m_pBitmap; | 1577 delete m_pBitmap; |
1578 delete m_pMask; | 1578 delete m_pMask; |
1579 } | 1579 } |
1580 } | 1580 } |
OLD | NEW |