From b05836511dfab9483438fc8dcbab2f4ae6dcc1b1 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 5 Mar 2018 14:46:57 +0000 Subject: Change return types for some rendering Start/Continue methods. Either return a bool or a CPDF_DIBSource::LoadState. Explain what the bool return value means. Change-Id: I6346d0cd61d5faee5290df181cfff3b9e4d5d84e Reviewed-on: https://pdfium-review.googlesource.com/27851 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fpdfapi/page/cpdf_image.cpp | 14 +++++++------- core/fpdfapi/page/cpdf_image.h | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'core/fpdfapi/page') diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index 5f82886a9b..24f58dfeff 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -351,7 +351,7 @@ bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, int ret = source->StartLoadDIBSource(m_pDocument.Get(), m_pStream.Get(), true, pFormResource, pPageResource, bStdCS, GroupFamily, bLoadMask); - if (!ret) { + if (ret == 0) { m_pDIBSource.Reset(); return false; } @@ -367,14 +367,14 @@ bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, bool CPDF_Image::Continue(IFX_PauseIndicator* pPause) { RetainPtr pSource = m_pDIBSource.As(); int ret = pSource->ContinueLoadDIBSource(pPause); - if (!ret) { - m_pDIBSource.Reset(); - return false; - } if (ret == 2) return true; - m_pMask = pSource->DetachMask(); - m_MatteColor = pSource->GetMatteColor(); + if (ret == 1) { + m_pMask = pSource->DetachMask(); + m_MatteColor = pSource->GetMatteColor(); + } else { + m_pDIBSource.Reset(); + } return false; } diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h index 57cbe94ca2..43011f8822 100644 --- a/core/fpdfapi/page/cpdf_image.h +++ b/core/fpdfapi/page/cpdf_image.h @@ -48,12 +48,17 @@ class CPDF_Image : public Retainable { void SetJpegImageInline(const RetainPtr& pFile); void ResetCache(CPDF_Page* pPage, const RetainPtr& pDIBitmap); + + // Returns whether to Continue() or not. bool StartLoadDIBSource(CPDF_Dictionary* pFormResource, CPDF_Dictionary* pPageResource, bool bStdCS = false, uint32_t GroupFamily = 0, bool bLoadMask = false); + + // Returns whether to Continue() or not. bool Continue(IFX_PauseIndicator* pPause); + RetainPtr DetachBitmap(); RetainPtr DetachMask(); -- cgit v1.2.3