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

Unified Diff: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp

Issue 1406943005: Clear decoders after the image decoder in the /Filter array (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments (also rebases) 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 side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index bdd5e9aa9c04fbf694c0fd9a0a48385dd0ee6ee8..3d4cf8dcefe275f396935cf425b5efe778242001 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -1084,14 +1084,14 @@ uint8_t* CPDF_DIBSource::GetBuffer() const {
}
const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
if (m_bpc == 0) {
- return NULL;
+ return nullptr;
}
FX_SAFE_DWORD src_pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width);
if (!src_pitch.IsValid())
- return NULL;
+ return nullptr;
FX_DWORD src_pitch_value = src_pitch.ValueOrDie();
- const uint8_t* pSrcLine = NULL;
- if (m_pCachedBitmap) {
+ const uint8_t* pSrcLine = nullptr;
+ if (m_pCachedBitmap && src_pitch_value == m_pCachedBitmap->GetPitch()) {
Tom Sepez 2015/11/12 17:39:19 can you explain why we need this check here, maybe
Oliver Chang 2015/11/12 18:39:45 Done. Modified the CL description, also changed sl
if (line >= m_pCachedBitmap->GetHeight()) {
line = m_pCachedBitmap->GetHeight() - 1;
}
@@ -1103,7 +1103,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
pSrcLine = m_pStreamAcc->GetData() + line * src_pitch_value;
}
}
- if (pSrcLine == NULL) {
+ if (!pSrcLine) {
uint8_t* pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf;
FXSYS_memset(pLineBuf, 0xFF, m_Pitch);
return pLineBuf;

Powered by Google App Engine
This is Rietveld 408576698