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

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

Issue 1436153003: Merge to XFA: Clear decoders after the image decoder in the /Filter array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month 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_parser/fpdf_parser_objects.cpp ('k') | testing/resources/bug_552046.in » ('j') | 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 "render_int.h" 7 #include "render_int.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 } 1077 }
1078 } 1078 }
1079 uint8_t* CPDF_DIBSource::GetBuffer() const { 1079 uint8_t* CPDF_DIBSource::GetBuffer() const {
1080 if (m_pCachedBitmap) { 1080 if (m_pCachedBitmap) {
1081 return m_pCachedBitmap->GetBuffer(); 1081 return m_pCachedBitmap->GetBuffer();
1082 } 1082 }
1083 return NULL; 1083 return NULL;
1084 } 1084 }
1085 const uint8_t* CPDF_DIBSource::GetScanline(int line) const { 1085 const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
1086 if (m_bpc == 0) { 1086 if (m_bpc == 0) {
1087 return NULL; 1087 return nullptr;
1088 } 1088 }
1089 FX_SAFE_DWORD src_pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width); 1089 FX_SAFE_DWORD src_pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width);
1090 if (!src_pitch.IsValid()) 1090 if (!src_pitch.IsValid())
1091 return NULL; 1091 return nullptr;
1092 FX_DWORD src_pitch_value = src_pitch.ValueOrDie(); 1092 FX_DWORD src_pitch_value = src_pitch.ValueOrDie();
1093 const uint8_t* pSrcLine = NULL; 1093 const uint8_t* pSrcLine = nullptr;
1094 if (m_pCachedBitmap) { 1094 if (m_pCachedBitmap && src_pitch_value <= m_pCachedBitmap->GetPitch()) {
1095 if (line >= m_pCachedBitmap->GetHeight()) { 1095 if (line >= m_pCachedBitmap->GetHeight()) {
1096 line = m_pCachedBitmap->GetHeight() - 1; 1096 line = m_pCachedBitmap->GetHeight() - 1;
1097 } 1097 }
1098 pSrcLine = m_pCachedBitmap->GetScanline(line); 1098 pSrcLine = m_pCachedBitmap->GetScanline(line);
1099 } else if (m_pDecoder) { 1099 } else if (m_pDecoder) {
1100 pSrcLine = m_pDecoder->GetScanline(line); 1100 pSrcLine = m_pDecoder->GetScanline(line);
1101 } else { 1101 } else {
1102 if (m_pStreamAcc->GetSize() >= (line + 1) * src_pitch_value) { 1102 if (m_pStreamAcc->GetSize() >= (line + 1) * src_pitch_value) {
1103 pSrcLine = m_pStreamAcc->GetData() + line * src_pitch_value; 1103 pSrcLine = m_pStreamAcc->GetData() + line * src_pitch_value;
1104 } 1104 }
1105 } 1105 }
1106 if (pSrcLine == NULL) { 1106 if (!pSrcLine) {
1107 uint8_t* pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf; 1107 uint8_t* pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf;
1108 FXSYS_memset(pLineBuf, 0xFF, m_Pitch); 1108 FXSYS_memset(pLineBuf, 0xFF, m_Pitch);
1109 return pLineBuf; 1109 return pLineBuf;
1110 } 1110 }
1111 if (m_bpc * m_nComponents == 1) { 1111 if (m_bpc * m_nComponents == 1) {
1112 if (m_bImageMask && m_bDefaultDecode) { 1112 if (m_bImageMask && m_bDefaultDecode) {
1113 for (FX_DWORD i = 0; i < src_pitch_value; i++) { 1113 for (FX_DWORD i = 0; i < src_pitch_value; i++) {
1114 m_pLineBuf[i] = ~pSrcLine[i]; 1114 m_pLineBuf[i] = ~pSrcLine[i];
1115 } 1115 }
1116 } else if (m_bColorKey) { 1116 } else if (m_bColorKey) {
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 } 1650 }
1651 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) { 1651 FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) {
1652 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); 1652 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
1653 } 1653 }
1654 CPDF_ImageLoader::~CPDF_ImageLoader() { 1654 CPDF_ImageLoader::~CPDF_ImageLoader() {
1655 if (!m_bCached) { 1655 if (!m_bCached) {
1656 delete m_pBitmap; 1656 delete m_pBitmap;
1657 delete m_pMask; 1657 delete m_pMask;
1658 } 1658 }
1659 } 1659 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | testing/resources/bug_552046.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698