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 "../../../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 9 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
10 #include "../../../include/fpdfapi/fpdf_render.h" | 10 #include "../../../include/fpdfapi/fpdf_render.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
479 if (pFilter) { | 479 if (pFilter) { |
480 CFX_ByteString filter; | 480 CFX_ByteString filter; |
481 if (pFilter->GetType() == PDFOBJ_NAME) { | 481 if (pFilter->GetType() == PDFOBJ_NAME) { |
482 filter = pFilter->GetString(); | 482 filter = pFilter->GetString(); |
483 if (filter == FX_BSTRC("JPXDecode")) { | 483 if (filter == FX_BSTRC("JPXDecode")) { |
484 m_bDoBpcCheck = FALSE; | 484 m_bDoBpcCheck = FALSE; |
485 return TRUE; | 485 return TRUE; |
486 } | 486 } |
487 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { | 487 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { |
488 CPDF_Array* pArray = (CPDF_Array*)pFilter; | 488 CPDF_Array* pArray = (CPDF_Array*)pFilter; |
489 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("J PXDecode")) { | 489 int count = pArray->GetCount() - 1; |
490 if (pArray->GetStringAt(count) == "JPXDecode") { | |
490 m_bDoBpcCheck = FALSE; | 491 m_bDoBpcCheck = FALSE; |
491 return TRUE; | 492 return TRUE; |
492 } | 493 } |
493 } | 494 } |
494 } | 495 } |
495 } | 496 } |
496 m_bImageMask = TRUE; | 497 m_bImageMask = TRUE; |
497 m_bpc = m_nComponents = 1; | 498 m_bpc = m_nComponents = 1; |
498 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); | 499 CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode")); |
499 m_bDefaultDecode = pDecode == NULL || pDecode->GetInteger(0) == 0; | 500 m_bDefaultDecode = pDecode == NULL || pDecode->GetInteger(0) == 0; |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
937 CFX_ByteString filter = pFilter->GetString(); | 938 CFX_ByteString filter = pFilter->GetString(); |
938 if (filter == FX_BSTRC("CCITTFaxDecode") || filter == FX_BSTRC("JBIG 2Decode")) { | 939 if (filter == FX_BSTRC("CCITTFaxDecode") || filter == FX_BSTRC("JBIG 2Decode")) { |
939 m_bpc = 1; | 940 m_bpc = 1; |
940 m_nComponents = 1; | 941 m_nComponents = 1; |
941 } | 942 } |
942 if (filter == FX_BSTRC("RunLengthDecode") || filter == FX_BSTRC("DCT Decode")) { | 943 if (filter == FX_BSTRC("RunLengthDecode") || filter == FX_BSTRC("DCT Decode")) { |
943 m_bpc = 8; | 944 m_bpc = 8; |
944 } | 945 } |
945 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { | 946 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { |
946 CPDF_Array *pArray = (CPDF_Array *)pFilter; | 947 CPDF_Array *pArray = (CPDF_Array *)pFilter; |
947 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("CCITTFaxD ecode") || | 948 int count = pArray->GetCount() - 1; |
948 pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("JBIG2 Decode")) { | 949 if (pArray->GetStringAt(count) == "CCITTFaxDecode" || |
950 pArray->GetStringAt(count) == "JBIG2Decode") { | |
949 m_bpc = 1; | 951 m_bpc = 1; |
950 m_nComponents = 1; | 952 m_nComponents = 1; |
951 } | 953 } |
952 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("DCTDecode ")) { | 954 if (pArray->GetStringAt(count) == "DCTDecode") { |
Tom Sepez
2015/07/16 20:24:46
nit: is this |else if|?
| |
953 // Previously, pArray->GetString(pArray->GetCount() - 1) == FX_B STRC("RunLengthDecode") was checked in the "if" statement as well, | 955 // Previously, pArray->GetString(pArray->GetCount() - 1) == FX_B STRC("RunLengthDecode") was checked in the "if" statement as well, |
954 // but too many documents don't conform to it. | 956 // but too many documents don't conform to it. |
955 m_bpc = 8; | 957 m_bpc = 8; |
956 } | 958 } |
957 } | 959 } |
958 } | 960 } |
959 if (m_bpc != 1 && m_bpc != 2 && m_bpc != 4 && m_bpc != 8 && m_bpc != 16) { | 961 if (m_bpc != 1 && m_bpc != 2 && m_bpc != 4 && m_bpc != 8 && m_bpc != 16) { |
960 m_bpc = 0; | 962 m_bpc = 0; |
961 } | 963 } |
962 } | 964 } |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1550 { | 1552 { |
1551 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); | 1553 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); |
1552 } | 1554 } |
1553 CPDF_ImageLoader::~CPDF_ImageLoader() | 1555 CPDF_ImageLoader::~CPDF_ImageLoader() |
1554 { | 1556 { |
1555 if (!m_bCached) { | 1557 if (!m_bCached) { |
1556 delete m_pBitmap; | 1558 delete m_pBitmap; |
1557 delete m_pMask; | 1559 delete m_pMask; |
1558 } | 1560 } |
1559 } | 1561 } |
OLD | NEW |