| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 CPDF_Dictionary* pPageResources) { | 469 CPDF_Dictionary* pPageResources) { |
| 470 m_bpc_orig = m_pDict->GetInteger(FX_BSTRC("BitsPerComponent")); | 470 m_bpc_orig = m_pDict->GetInteger(FX_BSTRC("BitsPerComponent")); |
| 471 if (m_pDict->GetInteger("ImageMask")) { | 471 if (m_pDict->GetInteger("ImageMask")) { |
| 472 m_bImageMask = TRUE; | 472 m_bImageMask = TRUE; |
| 473 } | 473 } |
| 474 if (m_bImageMask || !m_pDict->KeyExist(FX_BSTRC("ColorSpace"))) { | 474 if (m_bImageMask || !m_pDict->KeyExist(FX_BSTRC("ColorSpace"))) { |
| 475 if (!m_bImageMask) { | 475 if (!m_bImageMask) { |
| 476 CPDF_Object* pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter")); | 476 CPDF_Object* pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter")); |
| 477 if (pFilter) { | 477 if (pFilter) { |
| 478 CFX_ByteString filter; | 478 CFX_ByteString filter; |
| 479 if (pFilter->GetType() == PDFOBJ_NAME) { | 479 if (pFilter->IsName()) { |
| 480 filter = pFilter->GetString(); | 480 filter = pFilter->GetString(); |
| 481 if (filter == FX_BSTRC("JPXDecode")) { | 481 if (filter == FX_BSTRC("JPXDecode")) { |
| 482 m_bDoBpcCheck = FALSE; | 482 m_bDoBpcCheck = FALSE; |
| 483 return TRUE; | 483 return TRUE; |
| 484 } | 484 } |
| 485 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { | 485 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { |
| 486 CPDF_Array* pArray = (CPDF_Array*)pFilter; | 486 CPDF_Array* pArray = (CPDF_Array*)pFilter; |
| 487 if (pArray->GetString(pArray->GetCount() - 1) == | 487 if (pArray->GetString(pArray->GetCount() - 1) == |
| 488 FX_BSTRC("JPXDecode")) { | 488 FX_BSTRC("JPXDecode")) { |
| 489 m_bDoBpcCheck = FALSE; | 489 m_bDoBpcCheck = FALSE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 507 m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pFormResources); | 507 m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pFormResources); |
| 508 } | 508 } |
| 509 if (m_pColorSpace == NULL) { | 509 if (m_pColorSpace == NULL) { |
| 510 m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pPageResources); | 510 m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pPageResources); |
| 511 } | 511 } |
| 512 if (m_pColorSpace == NULL) { | 512 if (m_pColorSpace == NULL) { |
| 513 return FALSE; | 513 return FALSE; |
| 514 } | 514 } |
| 515 m_Family = m_pColorSpace->GetFamily(); | 515 m_Family = m_pColorSpace->GetFamily(); |
| 516 m_nComponents = m_pColorSpace->CountComponents(); | 516 m_nComponents = m_pColorSpace->CountComponents(); |
| 517 if (m_Family == PDFCS_ICCBASED && pCSObj->GetType() == PDFOBJ_NAME) { | 517 if (m_Family == PDFCS_ICCBASED && pCSObj->IsName()) { |
| 518 CFX_ByteString cs = pCSObj->GetString(); | 518 CFX_ByteString cs = pCSObj->GetString(); |
| 519 if (cs == FX_BSTRC("DeviceGray")) { | 519 if (cs == FX_BSTRC("DeviceGray")) { |
| 520 m_nComponents = 1; | 520 m_nComponents = 1; |
| 521 } else if (cs == FX_BSTRC("DeviceRGB")) { | 521 } else if (cs == FX_BSTRC("DeviceRGB")) { |
| 522 m_nComponents = 3; | 522 m_nComponents = 3; |
| 523 } else if (cs == FX_BSTRC("DeviceCMYK")) { | 523 } else if (cs == FX_BSTRC("DeviceCMYK")) { |
| 524 m_nComponents = 4; | 524 m_nComponents = 4; |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 ValidateDictParam(); | 527 ValidateDictParam(); |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 } | 932 } |
| 933 SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255), | 933 SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255), |
| 934 FXSYS_round(G * 255), FXSYS_round(B * 255))); | 934 FXSYS_round(G * 255), FXSYS_round(B * 255))); |
| 935 } | 935 } |
| 936 } | 936 } |
| 937 } | 937 } |
| 938 void CPDF_DIBSource::ValidateDictParam() { | 938 void CPDF_DIBSource::ValidateDictParam() { |
| 939 m_bpc = m_bpc_orig; | 939 m_bpc = m_bpc_orig; |
| 940 CPDF_Object* pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter")); | 940 CPDF_Object* pFilter = m_pDict->GetElementValue(FX_BSTRC("Filter")); |
| 941 if (pFilter) { | 941 if (pFilter) { |
| 942 if (pFilter->GetType() == PDFOBJ_NAME) { | 942 if (pFilter->IsName()) { |
| 943 CFX_ByteString filter = pFilter->GetString(); | 943 CFX_ByteString filter = pFilter->GetString(); |
| 944 if (filter == FX_BSTRC("CCITTFaxDecode") || | 944 if (filter == FX_BSTRC("CCITTFaxDecode") || |
| 945 filter == FX_BSTRC("JBIG2Decode")) { | 945 filter == FX_BSTRC("JBIG2Decode")) { |
| 946 m_bpc = 1; | 946 m_bpc = 1; |
| 947 m_nComponents = 1; | 947 m_nComponents = 1; |
| 948 } | 948 } |
| 949 if (filter == FX_BSTRC("RunLengthDecode")) { | 949 if (filter == FX_BSTRC("RunLengthDecode")) { |
| 950 if (m_bpc != 1) { | 950 if (m_bpc != 1) { |
| 951 m_bpc = 8; | 951 m_bpc = 8; |
| 952 } | 952 } |
| (...skipping 702 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 |