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

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

Issue 1016823003: Revert "Fix a problem that JP2 image is not displayed because index color space is used" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../../../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
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;
jun_fang 2015/03/17 18:58:32 line 508 to line 511 should be moved to line 513.
509 if (arrSize == 0) {
510 return NULL;
511 }
512 if (pDecode) { 508 if (pDecode) {
513 for (FX_DWORD i = 0; i < m_nComponents; i ++) { 509 for (FX_DWORD i = 0; i < m_nComponents; i ++) {
514 pCompData[i].m_DecodeMin = pDecode->GetNumber((i * 2) % arrSize); 510 pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2);
515 FX_FLOAT max = pDecode->GetNumber((i * 2 + 1) % arrSize); 511 FX_FLOAT max = pDecode->GetNumber(i * 2 + 1);
516 pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_d ata; 512 pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_d ata;
517 FX_FLOAT def_value, def_min, def_max; 513 FX_FLOAT def_value, def_min, def_max;
518 m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); 514 m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max);
519 if (m_Family == PDFCS_INDEXED) { 515 if (m_Family == PDFCS_INDEXED) {
520 def_max = (FX_FLOAT)max_data; 516 def_max = (FX_FLOAT)max_data;
521 } 517 }
522 if (def_min != pCompData[i].m_DecodeMin || def_max != max) { 518 if (def_min != pCompData[i].m_DecodeMin || def_max != max) {
523 bDefaultDecode = FALSE; 519 bDefaultDecode = FALSE;
524 } 520 }
525 } 521 }
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 { 1508 {
1513 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); 1509 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
1514 } 1510 }
1515 CPDF_ImageLoader::~CPDF_ImageLoader() 1511 CPDF_ImageLoader::~CPDF_ImageLoader()
1516 { 1512 {
1517 if (!m_bCached) { 1513 if (!m_bCached) {
1518 delete m_pBitmap; 1514 delete m_pBitmap;
1519 delete m_pMask; 1515 delete m_pMask;
1520 } 1516 }
1521 } 1517 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698