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 "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
8 #include "../../../include/fxcodec/fx_codec.h" | 8 #include "../../../include/fxcodec/fx_codec.h" |
9 #include "../../../include/fpdfapi/fpdf_module.h" | 9 #include "../../../include/fpdfapi/fpdf_module.h" |
10 #include "../../../include/fpdfapi/fpdf_render.h" | 10 #include "../../../include/fpdfapi/fpdf_render.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 { | 498 { |
499 if (m_pColorSpace == NULL) { | 499 if (m_pColorSpace == NULL) { |
500 return NULL; | 500 return NULL; |
501 } | 501 } |
502 DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents); | 502 DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents); |
503 if (pCompData == NULL) { | 503 if (pCompData == NULL) { |
504 return NULL; | 504 return NULL; |
505 } | 505 } |
506 int max_data = (1 << m_bpc) - 1; | 506 int max_data = (1 << m_bpc) - 1; |
507 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); | 507 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); |
| 508 FX_DWORD arrSize = pDecode ? pDecode->GetCount() : 0; |
| 509 if (arrSize == 0) { |
| 510 return NULL; |
| 511 } |
508 if (pDecode) { | 512 if (pDecode) { |
509 for (FX_DWORD i = 0; i < m_nComponents; i ++) { | 513 for (FX_DWORD i = 0; i < m_nComponents; i ++) { |
510 pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2); | 514 pCompData[i].m_DecodeMin = pDecode->GetNumber((i * 2) % arrSize); |
511 FX_FLOAT max = pDecode->GetNumber(i * 2 + 1); | 515 FX_FLOAT max = pDecode->GetNumber((i * 2 + 1) % arrSize); |
512 pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_d
ata; | 516 pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_d
ata; |
513 FX_FLOAT def_value, def_min, def_max; | 517 FX_FLOAT def_value, def_min, def_max; |
514 m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); | 518 m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); |
515 if (m_Family == PDFCS_INDEXED) { | 519 if (m_Family == PDFCS_INDEXED) { |
516 def_max = (FX_FLOAT)max_data; | 520 def_max = (FX_FLOAT)max_data; |
517 } | 521 } |
518 if (def_min != pCompData[i].m_DecodeMin || def_max != max) { | 522 if (def_min != pCompData[i].m_DecodeMin || def_max != max) { |
519 bDefaultDecode = FALSE; | 523 bDefaultDecode = FALSE; |
520 } | 524 } |
521 } | 525 } |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 { | 1512 { |
1509 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); | 1513 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); |
1510 } | 1514 } |
1511 CPDF_ImageLoader::~CPDF_ImageLoader() | 1515 CPDF_ImageLoader::~CPDF_ImageLoader() |
1512 { | 1516 { |
1513 if (!m_bCached) { | 1517 if (!m_bCached) { |
1514 delete m_pBitmap; | 1518 delete m_pBitmap; |
1515 delete m_pMask; | 1519 delete m_pMask; |
1516 } | 1520 } |
1517 } | 1521 } |
OLD | NEW |