Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp

Issue 1419643005: Merge to XFA: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->IsName()) { 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 (CPDF_Array* pArray = pFilter->AsArray()) {
486 CPDF_Array* pArray = (CPDF_Array*)pFilter;
487 if (pArray->GetString(pArray->GetCount() - 1) == 486 if (pArray->GetString(pArray->GetCount() - 1) ==
488 FX_BSTRC("JPXDecode")) { 487 FX_BSTRC("JPXDecode")) {
489 m_bDoBpcCheck = FALSE; 488 m_bDoBpcCheck = FALSE;
490 return TRUE; 489 return TRUE;
491 } 490 }
492 } 491 }
493 } 492 }
494 } 493 }
495 m_bImageMask = TRUE; 494 m_bImageMask = TRUE;
496 m_bpc = m_nComponents = 1; 495 m_bpc = m_nComponents = 1;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 562 }
564 pCompData[i].m_DecodeStep = 563 pCompData[i].m_DecodeStep =
565 (pCompData[i].m_DecodeStep - pCompData[i].m_DecodeMin) / max_data; 564 (pCompData[i].m_DecodeStep - pCompData[i].m_DecodeMin) / max_data;
566 } 565 }
567 } 566 }
568 if (!m_pDict->KeyExist(FX_BSTRC("SMask"))) { 567 if (!m_pDict->KeyExist(FX_BSTRC("SMask"))) {
569 CPDF_Object* pMask = m_pDict->GetElementValue(FX_BSTRC("Mask")); 568 CPDF_Object* pMask = m_pDict->GetElementValue(FX_BSTRC("Mask"));
570 if (pMask == NULL) { 569 if (pMask == NULL) {
571 return pCompData; 570 return pCompData;
572 } 571 }
573 if (pMask->GetType() == PDFOBJ_ARRAY) { 572 if (CPDF_Array* pArray = pMask->AsArray()) {
574 CPDF_Array* pArray = (CPDF_Array*)pMask;
575 if (pArray->GetCount() >= m_nComponents * 2) { 573 if (pArray->GetCount() >= m_nComponents * 2) {
576 for (FX_DWORD i = 0; i < m_nComponents; i++) { 574 for (FX_DWORD i = 0; i < m_nComponents; i++) {
577 int min_num = pArray->GetInteger(i * 2); 575 int min_num = pArray->GetInteger(i * 2);
578 int max_num = pArray->GetInteger(i * 2 + 1); 576 int max_num = pArray->GetInteger(i * 2 + 1);
579 pCompData[i].m_ColorKeyMin = FX_MAX(min_num, 0); 577 pCompData[i].m_ColorKeyMin = FX_MAX(min_num, 0);
580 pCompData[i].m_ColorKeyMax = FX_MIN(max_num, max_data); 578 pCompData[i].m_ColorKeyMax = FX_MIN(max_num, max_data);
581 } 579 }
582 } 580 }
583 bColorKey = TRUE; 581 bColorKey = TRUE;
584 } 582 }
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 m_bpc = 1; 944 m_bpc = 1;
947 m_nComponents = 1; 945 m_nComponents = 1;
948 } 946 }
949 if (filter == FX_BSTRC("RunLengthDecode")) { 947 if (filter == FX_BSTRC("RunLengthDecode")) {
950 if (m_bpc != 1) { 948 if (m_bpc != 1) {
951 m_bpc = 8; 949 m_bpc = 8;
952 } 950 }
953 } else if (filter == FX_BSTRC("DCTDecode")) { 951 } else if (filter == FX_BSTRC("DCTDecode")) {
954 m_bpc = 8; 952 m_bpc = 8;
955 } 953 }
956 } else if (pFilter->GetType() == PDFOBJ_ARRAY) { 954 } else if (CPDF_Array* pArray = pFilter->AsArray()) {
957 CPDF_Array* pArray = (CPDF_Array*)pFilter;
958 if (pArray->GetString(pArray->GetCount() - 1) == 955 if (pArray->GetString(pArray->GetCount() - 1) ==
959 FX_BSTRC("CCITTFaxDecode") || 956 FX_BSTRC("CCITTFaxDecode") ||
960 pArray->GetString(pArray->GetCount() - 1) == 957 pArray->GetString(pArray->GetCount() - 1) ==
961 FX_BSTRC("JBIG2Decode")) { 958 FX_BSTRC("JBIG2Decode")) {
962 m_bpc = 1; 959 m_bpc = 1;
963 m_nComponents = 1; 960 m_nComponents = 1;
964 } 961 }
965 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("DCTDecode")) { 962 if (pArray->GetString(pArray->GetCount() - 1) == FX_BSTRC("DCTDecode")) {
966 // Previously, pArray->GetString(pArray->GetCount() - 1) == 963 // Previously, pArray->GetString(pArray->GetCount() - 1) ==
967 // FX_BSTRC("RunLengthDecode") was checked in the "if" statement as 964 // FX_BSTRC("RunLengthDecode") was checked in the "if" statement as
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 } 1652 }
1656 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { 1653 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) {
1657 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); 1654 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
1658 } 1655 }
1659 CPDF_ImageLoader::~CPDF_ImageLoader() { 1656 CPDF_ImageLoader::~CPDF_ImageLoader() {
1660 if (!m_bCached) { 1657 if (!m_bCached) {
1661 delete m_pBitmap; 1658 delete m_pBitmap;
1662 delete m_pMask; 1659 delete m_pMask;
1663 } 1660 }
1664 } 1661 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698