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

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

Issue 1101203002: Fix a regression with cut off images. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@2311
Patch Set: Created 5 years, 8 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 | « no previous file | 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return FALSE; 231 return FALSE;
232 } 232 }
233 m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); 233 m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie());
234 if (m_pColorSpace && bStdCS) { 234 if (m_pColorSpace && bStdCS) {
235 m_pColorSpace->EnableStdConversion(TRUE); 235 m_pColorSpace->EnableStdConversion(TRUE);
236 } 236 }
237 LoadPalette(); 237 LoadPalette();
238 if (m_bColorKey) { 238 if (m_bColorKey) {
239 m_bpp = 32; 239 m_bpp = 32;
240 m_AlphaFlag = 2; 240 m_AlphaFlag = 2;
241 FX_SAFE_DWORD pitch = CalculatePitch32(m_bpp, m_Width); 241 pitch = CalculatePitch32(m_bpp, m_Width);
242 if (!pitch.IsValid()) { 242 if (!pitch.IsValid()) {
243 return FALSE; 243 return FALSE;
244 } 244 }
245 m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); 245 m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie());
246 } 246 }
247 m_Pitch = pitch.ValueOrDie(); 247 m_Pitch = pitch.ValueOrDie();
248 if (ppMask) { 248 if (ppMask) {
249 *ppMask = LoadMask(*pMatteColor); 249 *ppMask = LoadMask(*pMatteColor);
250 } 250 }
251 if (m_pColorSpace && bStdCS) { 251 if (m_pColorSpace && bStdCS) {
(...skipping 23 matching lines...) Expand all
275 return 0; 275 return 0;
276 } 276 }
277 m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); 277 m_pLineBuf = FX_Alloc(FX_BYTE, pitch.ValueOrDie());
278 if (m_pColorSpace && m_bStdCS) { 278 if (m_pColorSpace && m_bStdCS) {
279 m_pColorSpace->EnableStdConversion(TRUE); 279 m_pColorSpace->EnableStdConversion(TRUE);
280 } 280 }
281 LoadPalette(); 281 LoadPalette();
282 if (m_bColorKey) { 282 if (m_bColorKey) {
283 m_bpp = 32; 283 m_bpp = 32;
284 m_AlphaFlag = 2; 284 m_AlphaFlag = 2;
285 FX_SAFE_DWORD pitch = CalculatePitch32(m_bpp, m_Width); 285 pitch = CalculatePitch32(m_bpp, m_Width);
286 if (!pitch.IsValid()) { 286 if (!pitch.IsValid()) {
287 return 0; 287 return 0;
288 } 288 }
289 m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie()); 289 m_pMaskedLine = FX_Alloc(FX_BYTE, pitch.ValueOrDie());
290 } 290 }
291 m_Pitch = pitch.ValueOrDie(); 291 m_Pitch = pitch.ValueOrDie();
292 return 1; 292 return 1;
293 } 293 }
294 int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Strea m* pStream, FX_BOOL bHasMask, 294 int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Strea m* pStream, FX_BOOL bHasMask,
295 CPDF_Dictionary* pFormResources, CPDF_Dic tionary* pPageResources, 295 CPDF_Dictionary* pFormResources, CPDF_Dic tionary* pPageResources,
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 { 1508 {
1509 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause); 1509 return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
1510 } 1510 }
1511 CPDF_ImageLoader::~CPDF_ImageLoader() 1511 CPDF_ImageLoader::~CPDF_ImageLoader()
1512 { 1512 {
1513 if (!m_bCached) { 1513 if (!m_bCached) {
1514 delete m_pBitmap; 1514 delete m_pBitmap;
1515 delete m_pMask; 1515 delete m_pMask;
1516 } 1516 }
1517 } 1517 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698