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 f6f41d9de11f000598c6858b726afa2a068650ac..4d428591cb582c0022cecedbafdb22922e5b860d 100644 |
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp |
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp |
@@ -1082,14 +1082,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()) { |
jun_fang
2015/11/12 05:41:07
src_pitch_value should equal m_pCachedBitmap->GetP
Oliver Chang
2015/11/12 18:39:45
This broke some things, as DIBitmap calculates the
|
if (line >= m_pCachedBitmap->GetHeight()) { |
line = m_pCachedBitmap->GetHeight() - 1; |
} |
@@ -1101,7 +1101,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; |