From cc2b38d41141a939c7ef73c0066418b8d823c681 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 30 Aug 2017 17:11:19 -0400 Subject: Split IFX_Pause out of fx_basic This CL moves IFX_Pause out to its own class from fx_basic and updates includes as needed. Change-Id: Iebdd183d8c85aa17570f190f1a7d1602c0af3c8b Reviewed-on: https://pdfium-review.googlesource.com/12491 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- BUILD.gn | 1 + core/fpdfapi/page/cpdf_contentparser.cpp | 3 ++- core/fpdfapi/page/cpdf_contentparser.h | 2 +- core/fpdfapi/page/cpdf_image.cpp | 2 +- core/fpdfapi/page/cpdf_image.h | 4 ++-- core/fpdfapi/page/cpdf_pageobjectholder.cpp | 2 +- core/fpdfapi/page/cpdf_pageobjectholder.h | 4 ++-- core/fpdfapi/render/cpdf_dibsource.cpp | 7 +++--- core/fpdfapi/render/cpdf_dibsource.h | 6 ++--- core/fpdfapi/render/cpdf_imagecacheentry.cpp | 2 +- core/fpdfapi/render/cpdf_imagecacheentry.h | 4 ++-- core/fpdfapi/render/cpdf_imageloader.cpp | 2 +- core/fpdfapi/render/cpdf_imageloader.h | 3 ++- core/fpdfapi/render/cpdf_imagerenderer.cpp | 2 +- core/fpdfapi/render/cpdf_imagerenderer.h | 2 +- core/fpdfapi/render/cpdf_pagerendercache.cpp | 2 +- core/fpdfapi/render/cpdf_pagerendercache.h | 4 ++-- core/fpdfapi/render/cpdf_progressiverenderer.cpp | 5 +++-- core/fpdfapi/render/cpdf_progressiverenderer.h | 6 ++--- core/fpdfapi/render/cpdf_renderstatus.cpp | 2 +- core/fpdfapi/render/cpdf_renderstatus.h | 2 +- core/fxcodec/codec/ccodec_jbig2module.h | 6 ++--- core/fxcodec/codec/ccodec_scanlinedecoder.h | 4 ++-- core/fxcodec/codec/fx_codec.cpp | 4 +++- core/fxcodec/codec/fx_codec_jbig.cpp | 4 ++-- core/fxcodec/jbig2/JBig2_Context.cpp | 25 +++++++++++---------- core/fxcodec/jbig2/JBig2_Context.h | 28 ++++++++++++++---------- core/fxcodec/jbig2/JBig2_GrdProc.cpp | 23 +++++++++---------- core/fxcodec/jbig2/JBig2_GrdProc.h | 24 ++++++++++---------- core/fxcodec/jbig2/JBig2_HtrdProc.cpp | 2 +- core/fxcodec/jbig2/JBig2_HtrdProc.h | 4 ++-- core/fxcodec/jbig2/JBig2_PddProc.cpp | 2 +- core/fxcodec/jbig2/JBig2_PddProc.h | 4 ++-- core/fxcrt/fx_basic.h | 6 ----- core/fxcrt/ifx_pauseindicator.h | 16 ++++++++++++++ core/fxge/agg/fx_agg_driver.cpp | 2 +- core/fxge/agg/fx_agg_driver.h | 3 ++- core/fxge/cfx_renderdevice.cpp | 2 +- core/fxge/cfx_renderdevice.h | 2 +- core/fxge/dib/cfx_dibsource.cpp | 2 +- core/fxge/dib/cfx_dibsource.h | 3 ++- core/fxge/dib/cfx_imagerenderer.cpp | 2 +- core/fxge/dib/cfx_imagerenderer.h | 2 +- core/fxge/dib/cfx_imagestretcher.cpp | 6 ++--- core/fxge/dib/cfx_imagestretcher.h | 7 +++--- core/fxge/dib/cfx_imagetransformer.cpp | 2 +- core/fxge/dib/cfx_imagetransformer.h | 2 +- core/fxge/dib/cstretchengine.cpp | 5 +++-- core/fxge/dib/cstretchengine.h | 5 +++-- core/fxge/ifx_renderdevicedriver.cpp | 2 +- core/fxge/ifx_renderdevicedriver.h | 5 +++-- core/fxge/skia/fx_skia_device.cpp | 2 +- core/fxge/skia/fx_skia_device.h | 3 ++- fpdfsdk/fsdk_pauseadapter.h | 5 +++-- 54 files changed, 157 insertions(+), 124 deletions(-) create mode 100644 core/fxcrt/ifx_pauseindicator.h diff --git a/BUILD.gn b/BUILD.gn index 820b1cfe8c..41dbaf7dc4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -856,6 +856,7 @@ static_library("fxcrt") { "core/fxcrt/fxcrt_posix.h", "core/fxcrt/fxcrt_windows.cpp", "core/fxcrt/fxcrt_windows.h", + "core/fxcrt/ifx_pauseindicator.h", "core/fxcrt/ifxcrt_fileaccess.h", "core/fxcrt/xml/cxml_attritem.cpp", "core/fxcrt/xml/cxml_attritem.h", diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index f7aef176bf..061ec74de8 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -17,6 +17,7 @@ #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fxcrt/fx_safe_types.h" +#include "core/fxcrt/ifx_pauseindicator.h" #include "third_party/base/ptr_util.h" #define PARSE_STEP_LIMIT 100 @@ -125,7 +126,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, m_CurrentOffset = 0; } -void CPDF_ContentParser::Continue(IFX_Pause* pPause) { +void CPDF_ContentParser::Continue(IFX_PauseIndicator* pPause) { int steps = 0; while (m_Status == ToBeContinued) { if (m_InternalStage == STAGE_GETCONTENT) { diff --git a/core/fpdfapi/page/cpdf_contentparser.h b/core/fpdfapi/page/cpdf_contentparser.h index 982a624346..1ae6efe2d7 100644 --- a/core/fpdfapi/page/cpdf_contentparser.h +++ b/core/fpdfapi/page/cpdf_contentparser.h @@ -38,7 +38,7 @@ class CPDF_ContentParser { const CFX_Matrix* pParentMatrix, CPDF_Type3Char* pType3Char, int level); - void Continue(IFX_Pause* pPause); + void Continue(IFX_PauseIndicator* pPause); private: enum InternalStage { diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index 2c3f13e9c2..233b303481 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -365,7 +365,7 @@ bool CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, return false; } -bool CPDF_Image::Continue(IFX_Pause* pPause) { +bool CPDF_Image::Continue(IFX_PauseIndicator* pPause) { CFX_RetainPtr pSource = m_pDIBSource.As(); int ret = pSource->ContinueLoadDIBSource(pPause); if (!ret) { diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h index c09ce1a46d..ed32d4b36a 100644 --- a/core/fpdfapi/page/cpdf_image.h +++ b/core/fpdfapi/page/cpdf_image.h @@ -19,7 +19,7 @@ class CFX_DIBSource; class CFX_DIBitmap; class CPDF_Document; class CPDF_Page; -class IFX_Pause; +class IFX_PauseIndicator; class IFX_SeekableReadStream; class CPDF_Image : public CFX_Retainable { @@ -57,7 +57,7 @@ class CPDF_Image : public CFX_Retainable { bool bStdCS = false, uint32_t GroupFamily = 0, bool bLoadMask = false); - bool Continue(IFX_Pause* pPause); + bool Continue(IFX_PauseIndicator* pPause); CFX_RetainPtr DetachBitmap(); CFX_RetainPtr DetachMask(); diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp index 138cb0d204..98950e6ff7 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp +++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp @@ -30,7 +30,7 @@ bool CPDF_PageObjectHolder::IsPage() const { return false; } -void CPDF_PageObjectHolder::ContinueParse(IFX_Pause* pPause) { +void CPDF_PageObjectHolder::ContinueParse(IFX_PauseIndicator* pPause) { if (!m_pParser) return; diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h index 87ebbc8460..0862369809 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.h +++ b/core/fpdfapi/page/cpdf_pageobjectholder.h @@ -16,7 +16,7 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" -class IFX_Pause; +class IFX_PauseIndicator; class CPDF_Dictionary; class CPDF_Stream; class CPDF_Document; @@ -48,7 +48,7 @@ class CPDF_PageObjectHolder { virtual bool IsPage() const; - void ContinueParse(IFX_Pause* pPause); + void ContinueParse(IFX_PauseIndicator* pPause); bool IsParsed() const { return m_ParseState == CONTENT_PARSED; } CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; } diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp index a5a368ea2d..08bde6ed8d 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibsource.cpp @@ -314,7 +314,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, return ret; } -int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { +int CPDF_DIBSource::ContinueLoadDIBSource(IFX_PauseIndicator* pPause) { FXCODEC_STATUS ret; if (m_Status == 1) { const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder(); @@ -729,7 +729,7 @@ int CPDF_DIBSource::StartLoadMask() { return m_pMaskStream ? StartLoadMaskDIB() : 1; } -int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) { +int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_PauseIndicator* pPause) { if (!m_pMask) return 1; @@ -1124,7 +1124,8 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { return m_pMaskedLine; } -bool CPDF_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const { +bool CPDF_DIBSource::SkipToScanline(int line, + IFX_PauseIndicator* pPause) const { return m_pDecoder && m_pDecoder->SkipToScanline(line, pPause); } diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h index 66a6d4e4e8..f6883ed263 100644 --- a/core/fpdfapi/render/cpdf_dibsource.h +++ b/core/fpdfapi/render/cpdf_dibsource.h @@ -49,7 +49,7 @@ class CPDF_DIBSource : public CFX_DIBSource { bool Load(CPDF_Document* pDoc, const CPDF_Stream* pStream); // CFX_DIBSource - bool SkipToScanline(int line, IFX_Pause* pPause) const override; + bool SkipToScanline(int line, IFX_PauseIndicator* pPause) const override; uint8_t* GetBuffer() const override; const uint8_t* GetScanline(int line) const override; void DownSampleScanline(int line, @@ -71,10 +71,10 @@ class CPDF_DIBSource : public CFX_DIBSource { bool bStdCS = false, uint32_t GroupFamily = 0, bool bLoadMask = false); - int ContinueLoadDIBSource(IFX_Pause* pPause); + int ContinueLoadDIBSource(IFX_PauseIndicator* pPause); int StartLoadMask(); int StartLoadMaskDIB(); - int ContinueLoadMaskDIB(IFX_Pause* pPause); + int ContinueLoadMaskDIB(IFX_PauseIndicator* pPause); int ContinueToLoadMask(); CFX_RetainPtr DetachMask(); diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/core/fpdfapi/render/cpdf_imagecacheentry.cpp index fad94f71ae..4f98b96726 100644 --- a/core/fpdfapi/render/cpdf_imagecacheentry.cpp +++ b/core/fpdfapi/render/cpdf_imagecacheentry.cpp @@ -105,7 +105,7 @@ void CPDF_ImageCacheEntry::ContinueGetCachedBitmap( CalcSize(); } -int CPDF_ImageCacheEntry::Continue(IFX_Pause* pPause, +int CPDF_ImageCacheEntry::Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus) { int ret = m_pCurBitmap.As()->ContinueLoadDIBSource(pPause); if (!ret) { diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.h b/core/fpdfapi/render/cpdf_imagecacheentry.h index fac2c1ff56..176b2818d9 100644 --- a/core/fpdfapi/render/cpdf_imagecacheentry.h +++ b/core/fpdfapi/render/cpdf_imagecacheentry.h @@ -19,7 +19,7 @@ class CPDF_Dictionary; class CPDF_Document; class CPDF_Image; class CPDF_RenderStatus; -class IFX_Pause; +class IFX_PauseIndicator; class CPDF_ImageCacheEntry { public: @@ -37,7 +37,7 @@ class CPDF_ImageCacheEntry { uint32_t GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus); - int Continue(IFX_Pause* pPause, CPDF_RenderStatus* pRenderStatus); + int Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus); CFX_RetainPtr DetachBitmap(); CFX_RetainPtr DetachMask(); diff --git a/core/fpdfapi/render/cpdf_imageloader.cpp b/core/fpdfapi/render/cpdf_imageloader.cpp index b09b919baa..60e64449bf 100644 --- a/core/fpdfapi/render/cpdf_imageloader.cpp +++ b/core/fpdfapi/render/cpdf_imageloader.cpp @@ -44,7 +44,7 @@ bool CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage, return ret; } -bool CPDF_ImageLoader::Continue(IFX_Pause* pPause, +bool CPDF_ImageLoader::Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus) { bool ret = m_pCache ? m_pCache->Continue(pPause, pRenderStatus) : m_pImageObject->GetImage()->Continue(pPause); diff --git a/core/fpdfapi/render/cpdf_imageloader.h b/core/fpdfapi/render/cpdf_imageloader.h index 47dd2f9812..e96fe37ca1 100644 --- a/core/fpdfapi/render/cpdf_imageloader.h +++ b/core/fpdfapi/render/cpdf_imageloader.h @@ -16,6 +16,7 @@ class CPDF_ImageObject; class CPDF_PageRenderCache; class CPDF_RenderStatus; +class IFX_PauseIndicator; class CPDF_ImageLoader { public: @@ -28,7 +29,7 @@ class CPDF_ImageLoader { uint32_t GroupFamily, bool bLoadMask, CPDF_RenderStatus* pRenderStatus); - bool Continue(IFX_Pause* pPause, CPDF_RenderStatus* pRenderStatus); + bool Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus); CFX_RetainPtr m_pBitmap; CFX_RetainPtr m_pMask; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index e04bd0c0f8..fafa18e5a4 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -510,7 +510,7 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() { return false; } -bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause) { +bool CPDF_ImageRenderer::Continue(IFX_PauseIndicator* pPause) { if (m_Status == 2) { if (m_pTransformer->Continue(pPause)) return true; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h index 345860107f..332cbf515c 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.h +++ b/core/fpdfapi/render/cpdf_imagerenderer.h @@ -43,7 +43,7 @@ class CPDF_ImageRenderer { bool bStdCS, int blendType); - bool Continue(IFX_Pause* pPause); + bool Continue(IFX_PauseIndicator* pPause); bool GetResult() const { return m_Result; } private: diff --git a/core/fpdfapi/render/cpdf_pagerendercache.cpp b/core/fpdfapi/render/cpdf_pagerendercache.cpp index 455b7f5ddb..ca5b620316 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.cpp +++ b/core/fpdfapi/render/cpdf_pagerendercache.cpp @@ -110,7 +110,7 @@ bool CPDF_PageRenderCache::StartGetCachedBitmap( return false; } -bool CPDF_PageRenderCache::Continue(IFX_Pause* pPause, +bool CPDF_PageRenderCache::Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus) { int ret = m_pCurImageCacheEntry->Continue(pPause, pRenderStatus); if (ret == 2) diff --git a/core/fpdfapi/render/cpdf_pagerendercache.h b/core/fpdfapi/render/cpdf_pagerendercache.h index a874212392..0a315b74ed 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.h +++ b/core/fpdfapi/render/cpdf_pagerendercache.h @@ -19,7 +19,7 @@ class CPDF_ImageCacheEntry; class CPDF_Page; class CPDF_RenderStatus; class CPDF_Stream; -class IFX_Pause; +class IFX_PauseIndicator; class CPDF_PageRenderCache { public: @@ -41,7 +41,7 @@ class CPDF_PageRenderCache { bool bLoadMask, CPDF_RenderStatus* pRenderStatus); - bool Continue(IFX_Pause* pPause, CPDF_RenderStatus* pRenderStatus); + bool Continue(IFX_PauseIndicator* pPause, CPDF_RenderStatus* pRenderStatus); private: void ClearImageCacheEntry(CPDF_Stream* pStream); diff --git a/core/fpdfapi/render/cpdf_progressiverenderer.cpp b/core/fpdfapi/render/cpdf_progressiverenderer.cpp index 3c6be3ba34..d906a9325d 100644 --- a/core/fpdfapi/render/cpdf_progressiverenderer.cpp +++ b/core/fpdfapi/render/cpdf_progressiverenderer.cpp @@ -13,6 +13,7 @@ #include "core/fpdfapi/render/cpdf_pagerendercache.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" #include "core/fpdfapi/render/cpdf_renderstatus.h" +#include "core/fxcrt/ifx_pauseindicator.h" #include "core/fxge/cfx_renderdevice.h" #include "third_party/base/ptr_util.h" @@ -34,7 +35,7 @@ CPDF_ProgressiveRenderer::~CPDF_ProgressiveRenderer() { } } -void CPDF_ProgressiveRenderer::Start(IFX_Pause* pPause) { +void CPDF_ProgressiveRenderer::Start(IFX_PauseIndicator* pPause) { if (!m_pContext || !m_pDevice || m_Status != Ready) { m_Status = Failed; return; @@ -43,7 +44,7 @@ void CPDF_ProgressiveRenderer::Start(IFX_Pause* pPause) { Continue(pPause); } -void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { +void CPDF_ProgressiveRenderer::Continue(IFX_PauseIndicator* pPause) { while (m_Status == ToBeContinued) { if (!m_pCurrentLayer) { if (m_LayerIndex >= m_pContext->CountLayers()) { diff --git a/core/fpdfapi/render/cpdf_progressiverenderer.h b/core/fpdfapi/render/cpdf_progressiverenderer.h index b56727836d..195636f168 100644 --- a/core/fpdfapi/render/cpdf_progressiverenderer.h +++ b/core/fpdfapi/render/cpdf_progressiverenderer.h @@ -17,7 +17,7 @@ class CPDF_RenderOptions; class CPDF_RenderStatus; class CFX_RenderDevice; -class IFX_Pause; +class IFX_PauseIndicator; class CPDF_ProgressiveRenderer { public: @@ -39,8 +39,8 @@ class CPDF_ProgressiveRenderer { ~CPDF_ProgressiveRenderer(); Status GetStatus() const { return m_Status; } - void Start(IFX_Pause* pPause); - void Continue(IFX_Pause* pPause); + void Start(IFX_PauseIndicator* pPause); + void Continue(IFX_PauseIndicator* pPause); private: // Maximum page objects to render before checking for pause. diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 8f0a51f1e4..380914fd27 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -1102,7 +1102,7 @@ void CPDF_RenderStatus::RenderSingleObject(CPDF_PageObject* pObj, bool CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { if (m_pImageRenderer) { if (m_pImageRenderer->Continue(pPause)) return true; diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h index cfaa966ed1..b4872f1d1e 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.h +++ b/core/fpdfapi/render/cpdf_renderstatus.h @@ -61,7 +61,7 @@ class CPDF_RenderStatus { void RenderSingleObject(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device); bool ContinueSingleObject(CPDF_PageObject* pObj, const CFX_Matrix* pObj2Device, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); void ProcessClipPath(const CPDF_ClipPath& ClipPath, const CFX_Matrix* pObj2Device); CPDF_RenderContext* GetContext() const { return m_pContext.Get(); } diff --git a/core/fxcodec/codec/ccodec_jbig2module.h b/core/fxcodec/codec/ccodec_jbig2module.h index b80d78f605..9b894fbc97 100644 --- a/core/fxcodec/codec/ccodec_jbig2module.h +++ b/core/fxcodec/codec/ccodec_jbig2module.h @@ -15,7 +15,7 @@ class CJBig2_Context; class CJBig2_Image; class CPDF_StreamAcc; -class IFX_Pause; +class IFX_PauseIndicator; class JBig2_DocumentContext; class CCodec_Jbig2Context { @@ -46,9 +46,9 @@ class CCodec_Jbig2Module { const CFX_RetainPtr& global_stream, uint8_t* dest_buf, uint32_t dest_pitch, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS ContinueDecode(CCodec_Jbig2Context* pJbig2Context, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); private: FXCODEC_STATUS Decode(CCodec_Jbig2Context* pJbig2Context, int result); diff --git a/core/fxcodec/codec/ccodec_scanlinedecoder.h b/core/fxcodec/codec/ccodec_scanlinedecoder.h index 06bb6d5abe..05d5eab92b 100644 --- a/core/fxcodec/codec/ccodec_scanlinedecoder.h +++ b/core/fxcodec/codec/ccodec_scanlinedecoder.h @@ -9,7 +9,7 @@ #include "core/fxcrt/fx_system.h" -class IFX_Pause; +class IFX_PauseIndicator; class CCodec_ScanlineDecoder { public: @@ -24,7 +24,7 @@ class CCodec_ScanlineDecoder { virtual ~CCodec_ScanlineDecoder(); const uint8_t* GetScanline(int line); - bool SkipToScanline(int line, IFX_Pause* pPause); + bool SkipToScanline(int line, IFX_PauseIndicator* pPause); int GetWidth() { return m_OutputWidth; } int GetHeight() { return m_OutputHeight; } diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index aeffd9cb45..2681f72199 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -15,6 +15,7 @@ #include "core/fxcodec/codec/codec_int.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" +#include "core/fxcrt/ifx_pauseindicator.h" #include "third_party/base/logging.h" #include "third_party/base/ptr_util.h" @@ -1389,7 +1390,8 @@ const uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) { return m_pLastScanline; } -bool CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) { +bool CCodec_ScanlineDecoder::SkipToScanline(int line, + IFX_PauseIndicator* pPause) { if (m_NextLine == line || m_NextLine == line + 1) return false; diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 4c545c3c3a..f6ace30dd3 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -48,7 +48,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( const CFX_RetainPtr& global_stream, uint8_t* dest_buf, uint32_t dest_pitch, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { if (!pJbig2Context) return FXCODEC_STATUS_ERR_PARAMS; @@ -71,7 +71,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode( CCodec_Jbig2Context* pJbig2Context, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { int ret = pJbig2Context->m_pContext->Continue(pPause); return Decode(pJbig2Context, ret); } diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index 778db1c591..a1f6cc6bca 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -23,6 +23,7 @@ #include "core/fxcodec/jbig2/JBig2_PddProc.h" #include "core/fxcodec/jbig2/JBig2_SddProc.h" #include "core/fxcodec/jbig2/JBig2_TrdProc.h" +#include "core/fxcrt/ifx_pauseindicator.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" @@ -69,7 +70,8 @@ CJBig2_Context::CJBig2_Context( CJBig2_Context::~CJBig2_Context() {} -int32_t CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) { +int32_t CJBig2_Context::decode_SquentialOrgnazation( + IFX_PauseIndicator* pPause) { int32_t nRet; if (m_pStream->getByteLeft() <= 0) return JBIG2_END_OF_FILE; @@ -115,11 +117,12 @@ int32_t CJBig2_Context::decode_SquentialOrgnazation(IFX_Pause* pPause) { return JBIG2_SUCCESS; } -int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) { +int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_PauseIndicator* pPause) { return decode_SquentialOrgnazation(pPause); } -int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { +int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage( + IFX_PauseIndicator* pPause) { int32_t nRet; while (m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) { auto pSegment = pdfium::MakeUnique(); @@ -140,7 +143,7 @@ int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { return decode_RandomOrgnazation(pPause); } -int32_t CJBig2_Context::decode_RandomOrgnazation(IFX_Pause* pPause) { +int32_t CJBig2_Context::decode_RandomOrgnazation(IFX_PauseIndicator* pPause) { for (; m_nSegmentDecoded < m_SegmentList.size(); ++m_nSegmentDecoded) { int32_t nRet = parseSegmentData(m_SegmentList[m_nSegmentDecoded].get(), pPause); @@ -163,7 +166,7 @@ int32_t CJBig2_Context::getFirstPage(uint8_t* pBuf, int32_t width, int32_t height, int32_t stride, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { int32_t nRet = 0; if (m_pGlobalContext) { nRet = m_pGlobalContext->decode_EmbedOrgnazation(pPause); @@ -183,7 +186,7 @@ int32_t CJBig2_Context::getFirstPage(uint8_t* pBuf, return Continue(pPause); } -int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { +int32_t CJBig2_Context::Continue(IFX_PauseIndicator* pPause) { m_ProcessingStatus = FXCODEC_STATUS_DECODE_READY; int32_t nRet = 0; if (m_PauseStep <= 1) { @@ -322,7 +325,7 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { } int32_t CJBig2_Context::parseSegmentData(CJBig2_Segment* pSegment, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { int32_t ret = ProcessingParseSegmentData(pSegment, pPause); while (m_ProcessingStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE && m_pStream->getByteLeft() > 0) { @@ -332,7 +335,7 @@ int32_t CJBig2_Context::parseSegmentData(CJBig2_Segment* pSegment, } int32_t CJBig2_Context::ProcessingParseSegmentData(CJBig2_Segment* pSegment, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { switch (pSegment->m_cFlags.s.type) { case 0: return parseSymbolDict(pSegment); @@ -931,7 +934,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { uint8_t cFlags; auto pPDD = pdfium::MakeUnique(); if (m_pStream->read1Byte(&cFlags) != 0 || @@ -970,7 +973,7 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, } int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { uint8_t cFlags; JBig2RegionInfo ri; auto pHRD = pdfium::MakeUnique(); @@ -1048,7 +1051,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, } int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { if (!m_pGRD) { auto pGRD = pdfium::MakeUnique(); uint8_t cFlags; diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index 9224d325b5..c88fc6f187 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -20,7 +20,7 @@ class CJBig2_ArithDecoder; class CJBig2_GRDProc; class CPDF_StreamAcc; -class IFX_Pause; +class IFX_PauseIndicator; // Cache is keyed by the ObjNum of a stream and an index within the stream. using CJBig2_CacheKey = std::pair; @@ -50,16 +50,16 @@ class CJBig2_Context { int32_t width, int32_t height, int32_t stride, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); - int32_t Continue(IFX_Pause* pPause); + int32_t Continue(IFX_PauseIndicator* pPause); FXCODEC_STATUS GetProcessingStatus() const { return m_ProcessingStatus; } private: - int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); - int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); - int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); - int32_t decode_RandomOrgnazation(IFX_Pause* pPause); + int32_t decode_SquentialOrgnazation(IFX_PauseIndicator* pPause); + int32_t decode_EmbedOrgnazation(IFX_PauseIndicator* pPause); + int32_t decode_RandomOrgnazation_FirstPage(IFX_PauseIndicator* pPause); + int32_t decode_RandomOrgnazation(IFX_PauseIndicator* pPause); CJBig2_Segment* findSegmentByNumber(uint32_t dwNumber); CJBig2_Segment* findReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment, @@ -67,14 +67,18 @@ class CJBig2_Context { int32_t nIndex); int32_t parseSegmentHeader(CJBig2_Segment* pSegment); - int32_t parseSegmentData(CJBig2_Segment* pSegment, IFX_Pause* pPause); + int32_t parseSegmentData(CJBig2_Segment* pSegment, + IFX_PauseIndicator* pPause); int32_t ProcessingParseSegmentData(CJBig2_Segment* pSegment, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); int32_t parseSymbolDict(CJBig2_Segment* pSegment); int32_t parseTextRegion(CJBig2_Segment* pSegment); - int32_t parsePatternDict(CJBig2_Segment* pSegment, IFX_Pause* pPause); - int32_t parseHalftoneRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause); - int32_t parseGenericRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause); + int32_t parsePatternDict(CJBig2_Segment* pSegment, + IFX_PauseIndicator* pPause); + int32_t parseHalftoneRegion(CJBig2_Segment* pSegment, + IFX_PauseIndicator* pPause); + int32_t parseGenericRegion(CJBig2_Segment* pSegment, + IFX_PauseIndicator* pPause); int32_t parseGenericRefinementRegion(CJBig2_Segment* pSegment); int32_t parseTable(CJBig2_Segment* pSegment); int32_t parseRegionInfo(JBig2RegionInfo* pRI); diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp index 1d76f9053d..7612114117 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -13,6 +13,7 @@ #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h" #include "core/fxcodec/jbig2/JBig2_BitStream.h" #include "core/fxcodec/jbig2/JBig2_Image.h" +#include "core/fxcrt/ifx_pauseindicator.h" #include "third_party/base/ptr_util.h" CJBig2_GRDProc::CJBig2_GRDProc() @@ -640,7 +641,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith( std::unique_ptr* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { if (GBW == 0 || GBW > JBIG2_MAX_IMAGE_SIZE || GBH == 0 || GBH > JBIG2_MAX_IMAGE_SIZE) { m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; @@ -665,7 +666,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith( } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith( - IFX_Pause* pPause, + IFX_PauseIndicator* pPause, CJBig2_ArithDecoder* pArithDecoder) { int iline = m_loopIndex; if (GBTEMPLATE == 0) { @@ -733,7 +734,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR( } FXCODEC_STATUS CJBig2_GRDProc::Continue_decode( - IFX_Pause* pPause, + IFX_PauseIndicator* pPause, CJBig2_ArithDecoder* pArithDecoder) { if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE) return m_ProssiveStatus; @@ -749,7 +750,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { if (!m_pLine) { m_pLine = pImage->m_pData; } @@ -853,7 +854,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { if (pArithDecoder->IsComplete()) @@ -911,7 +912,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { if (!m_pLine) { m_pLine = pImage->m_pData; } @@ -1013,7 +1014,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { if (pArithDecoder->IsComplete()) @@ -1067,7 +1068,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { if (!m_pLine) { m_pLine = pImage->m_pData; } @@ -1169,7 +1170,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { if (pArithDecoder->IsComplete()) @@ -1223,7 +1224,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { if (!m_pLine) m_pLine = pImage->m_pData; @@ -1311,7 +1312,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { if (pArithDecoder->IsComplete()) diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h index ef02a7d45a..14c57f976a 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrdProc.h @@ -17,7 +17,7 @@ class CJBig2_ArithDecoder; class CJBig2_BitStream; class CJBig2_Image; -class IFX_Pause; +class IFX_PauseIndicator; struct JBig2ArithCtx; class CJBig2_GRDProc { @@ -31,10 +31,10 @@ class CJBig2_GRDProc { FXCODEC_STATUS Start_decode_Arith(std::unique_ptr* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS Start_decode_MMR(std::unique_ptr* pImage, CJBig2_BitStream* pStream); - FXCODEC_STATUS Continue_decode(IFX_Pause* pPause, + FXCODEC_STATUS Continue_decode(IFX_PauseIndicator* pPause, CJBig2_ArithDecoder* pArithDecoder); FX_RECT GetReplaceRect() const { return m_ReplaceRect; } @@ -52,44 +52,44 @@ class CJBig2_GRDProc { bool UseTemplate1Opt3() const; bool UseTemplate23Opt3() const; - FXCODEC_STATUS decode_Arith(IFX_Pause* pPause, + FXCODEC_STATUS decode_Arith(IFX_PauseIndicator* pPause, CJBig2_ArithDecoder* pArithDecoder); FXCODEC_STATUS decode_Arith_Template0_opt3(CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS decode_Arith_Template0_unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS decode_Arith_Template1_opt3(CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS decode_Arith_Template1_unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS decode_Arith_Template2_opt3(CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS decode_Arith_Template2_unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); FXCODEC_STATUS decode_Arith_Template3_unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); std::unique_ptr decode_Arith_Template0_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp index 11070c11b9..9c9480e263 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp @@ -18,7 +18,7 @@ std::unique_ptr CJBig2_HTRDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { std::unique_ptr HSKIP; if (HENABLESKIP == 1) { HSKIP = pdfium::MakeUnique(HGW, HGH); diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.h b/core/fxcodec/jbig2/JBig2_HtrdProc.h index 75041ac41b..ed7cdbf2b5 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.h +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.h @@ -15,14 +15,14 @@ class CJBig2_ArithDecoder; class CJBig2_BitStream; -class IFX_Pause; +class IFX_PauseIndicator; struct JBig2ArithCtx; class CJBig2_HTRDProc { public: std::unique_ptr decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); std::unique_ptr decode_MMR(CJBig2_BitStream* pStream); diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp index e195d8f403..ee891cc002 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp @@ -16,7 +16,7 @@ std::unique_ptr CJBig2_PDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { uint32_t GRAY; std::unique_ptr BHDC; auto pDict = pdfium::MakeUnique(GRAYMAX + 1); diff --git a/core/fxcodec/jbig2/JBig2_PddProc.h b/core/fxcodec/jbig2/JBig2_PddProc.h index af27889ff1..938da1b209 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.h +++ b/core/fxcodec/jbig2/JBig2_PddProc.h @@ -14,7 +14,7 @@ class CJBig2_ArithDecoder; class CJBig2_BitStream; class CJBig2_PatternDict; -class IFX_Pause; +class IFX_PauseIndicator; struct JBig2ArithCtx; class CJBig2_PDDProc { @@ -22,7 +22,7 @@ class CJBig2_PDDProc { std::unique_ptr decode_Arith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, - IFX_Pause* pPause); + IFX_PauseIndicator* pPause); std::unique_ptr decode_MMR(CJBig2_BitStream* pStream); diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 7d3f3291c1..c60f0d367b 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -22,12 +22,6 @@ #define FX_IsOdd(a) ((a)&1) #endif // PDF_ENABLE_XFA -class IFX_Pause { - public: - virtual ~IFX_Pause() {} - virtual bool NeedToPauseNow() = 0; -}; - uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits); #endif // CORE_FXCRT_FX_BASIC_H_ diff --git a/core/fxcrt/ifx_pauseindicator.h b/core/fxcrt/ifx_pauseindicator.h new file mode 100644 index 0000000000..79c6016706 --- /dev/null +++ b/core/fxcrt/ifx_pauseindicator.h @@ -0,0 +1,16 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FXCRT_IFX_PAUSEINDICATOR_H_ +#define CORE_FXCRT_IFX_PAUSEINDICATOR_H_ + +class IFX_PauseIndicator { + public: + virtual ~IFX_PauseIndicator() {} + virtual bool NeedToPauseNow() = 0; +}; + +#endif // CORE_FXCRT_IFX_PAUSEINDICATOR_H_ diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 846920240e..e94ffc1f73 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -1553,7 +1553,7 @@ bool CFX_AggDeviceDriver::StartDIBits( } bool CFX_AggDeviceDriver::ContinueDIBits(CFX_ImageRenderer* pHandle, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { return m_pBitmap->GetBuffer() ? pHandle->Continue(pPause) : true; } diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index 1ce97d7853..c6aafebffc 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -89,7 +89,8 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { uint32_t flags, std::unique_ptr* handle, int blend_type) override; - bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause) override; + bool ContinueDIBits(CFX_ImageRenderer* handle, + IFX_PauseIndicator* pPause) override; bool DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index d0c52e8ade..959c909b5e 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -835,7 +835,7 @@ bool CFX_RenderDevice::StartDIBitsWithBlend( } bool CFX_RenderDevice::ContinueDIBits(CFX_ImageRenderer* handle, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { return m_pDeviceDriver->ContinueDIBits(handle, pPause); } diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index 49a0f3e0bc..36fb5ed0f9 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -208,7 +208,7 @@ class CFX_RenderDevice { uint32_t flags, std::unique_ptr* handle, int blend_type); - bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause); + bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_PauseIndicator* pPause); bool DrawNormalText(int nChars, const FXTEXT_CHARPOS* pCharPos, diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibsource.cpp index 3a2179660f..c0e7841b89 100644 --- a/core/fxge/dib/cfx_dibsource.cpp +++ b/core/fxge/dib/cfx_dibsource.cpp @@ -629,7 +629,7 @@ uint8_t* CFX_DIBSource::GetBuffer() const { return nullptr; } -bool CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const { +bool CFX_DIBSource::SkipToScanline(int line, IFX_PauseIndicator* pPause) const { return false; } diff --git a/core/fxge/dib/cfx_dibsource.h b/core/fxge/dib/cfx_dibsource.h index 798e092d16..8b6d960de6 100644 --- a/core/fxge/dib/cfx_dibsource.h +++ b/core/fxge/dib/cfx_dibsource.h @@ -27,6 +27,7 @@ enum FXDIB_Channel { class CFX_ClipRgn; class CFX_DIBitmap; +class IFX_PauseIndicator; class CFX_DIBSource : public CFX_Retainable { public: @@ -34,7 +35,7 @@ class CFX_DIBSource : public CFX_Retainable { virtual uint8_t* GetBuffer() const; virtual const uint8_t* GetScanline(int line) const = 0; - virtual bool SkipToScanline(int line, IFX_Pause* pPause) const; + virtual bool SkipToScanline(int line, IFX_PauseIndicator* pPause) const; virtual void DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp index 6448014ba5..2330fe0587 100644 --- a/core/fxge/dib/cfx_imagerenderer.cpp +++ b/core/fxge/dib/cfx_imagerenderer.cpp @@ -88,7 +88,7 @@ CFX_ImageRenderer::CFX_ImageRenderer( CFX_ImageRenderer::~CFX_ImageRenderer() {} -bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) { +bool CFX_ImageRenderer::Continue(IFX_PauseIndicator* pPause) { if (m_Status == 1) return m_Stretcher->Continue(pPause); if (m_Status != 2) diff --git a/core/fxge/dib/cfx_imagerenderer.h b/core/fxge/dib/cfx_imagerenderer.h index 97427ceb91..068fe34a89 100644 --- a/core/fxge/dib/cfx_imagerenderer.h +++ b/core/fxge/dib/cfx_imagerenderer.h @@ -33,7 +33,7 @@ class CFX_ImageRenderer { bool bRgbByteOrder); ~CFX_ImageRenderer(); - bool Continue(IFX_Pause* pPause); + bool Continue(IFX_PauseIndicator* pPause); private: const CFX_RetainPtr m_pDevice; diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp index 3c0a065868..0b7c542b30 100644 --- a/core/fxge/dib/cfx_imagestretcher.cpp +++ b/core/fxge/dib/cfx_imagestretcher.cpp @@ -125,7 +125,7 @@ bool CFX_ImageStretcher::Start() { return StartStretch(); } -bool CFX_ImageStretcher::Continue(IFX_Pause* pPause) { +bool CFX_ImageStretcher::Continue(IFX_PauseIndicator* pPause) { if (m_Flags & FXDIB_DOWNSAMPLE) return ContinueQuickStretch(pPause); return ContinueStretch(pPause); @@ -143,7 +143,7 @@ bool CFX_ImageStretcher::StartStretch() { return true; } -bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) { +bool CFX_ImageStretcher::ContinueStretch(IFX_PauseIndicator* pPause) { return m_pStretchEngine && m_pStretchEngine->Continue(pPause); } @@ -172,7 +172,7 @@ bool CFX_ImageStretcher::StartQuickStretch() { return true; } -bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) { +bool CFX_ImageStretcher::ContinueQuickStretch(IFX_PauseIndicator* pPause) { if (!m_pScanline) return false; diff --git a/core/fxge/dib/cfx_imagestretcher.h b/core/fxge/dib/cfx_imagestretcher.h index 45928ee141..f31669b866 100644 --- a/core/fxge/dib/cfx_imagestretcher.h +++ b/core/fxge/dib/cfx_imagestretcher.h @@ -15,6 +15,7 @@ #include "core/fxge/fx_dib.h" class CFX_DIBSource; +class IFX_PauseIndicator; class CFX_ImageStretcher { public: @@ -27,15 +28,15 @@ class CFX_ImageStretcher { ~CFX_ImageStretcher(); bool Start(); - bool Continue(IFX_Pause* pPause); + bool Continue(IFX_PauseIndicator* pPause); CFX_RetainPtr source() { return m_pSource; } private: bool StartQuickStretch(); bool StartStretch(); - bool ContinueQuickStretch(IFX_Pause* pPause); - bool ContinueStretch(IFX_Pause* pPause); + bool ContinueQuickStretch(IFX_PauseIndicator* pPause); + bool ContinueStretch(IFX_PauseIndicator* pPause); CFX_UnownedPtr const m_pDest; CFX_RetainPtr m_pSource; diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index c05dd795b5..e64a2645da 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -244,7 +244,7 @@ CFX_ImageTransformer::CFX_ImageTransformer( CFX_ImageTransformer::~CFX_ImageTransformer() {} -bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) { +bool CFX_ImageTransformer::Continue(IFX_PauseIndicator* pPause) { if (m_Status == 1) { if (m_Stretcher->Continue(pPause)) return true; diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h index 60e4714a65..694c44c932 100644 --- a/core/fxge/dib/cfx_imagetransformer.h +++ b/core/fxge/dib/cfx_imagetransformer.h @@ -25,7 +25,7 @@ class CFX_ImageTransformer { const FX_RECT* pClip); ~CFX_ImageTransformer(); - bool Continue(IFX_Pause* pPause); + bool Continue(IFX_PauseIndicator* pPause); const FX_RECT& result() const { return m_result; } CFX_RetainPtr DetachBitmap(); diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp index b5cf4a781d..4822d32b83 100644 --- a/core/fxge/dib/cstretchengine.cpp +++ b/core/fxge/dib/cstretchengine.cpp @@ -9,6 +9,7 @@ #include #include +#include "core/fxcrt/ifx_pauseindicator.h" #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/dib/ifx_scanlinecomposer.h" @@ -310,7 +311,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, CStretchEngine::~CStretchEngine() {} -bool CStretchEngine::Continue(IFX_Pause* pPause) { +bool CStretchEngine::Continue(IFX_PauseIndicator* pPause) { while (m_State == 1) { if (ContinueStretchHorz(pPause)) return true; @@ -347,7 +348,7 @@ bool CStretchEngine::StartStretchHorz() { return true; } -bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { +bool CStretchEngine::ContinueStretchHorz(IFX_PauseIndicator* pPause) { if (!m_DestWidth) return false; if (m_pSource->SkipToScanline(m_CurRow, pPause)) diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h index 049059361e..dd207af30d 100644 --- a/core/fxge/dib/cstretchengine.h +++ b/core/fxge/dib/cstretchengine.h @@ -13,6 +13,7 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxge/fx_dib.h" +class IFX_PauseIndicator; class IFX_ScanlineComposer; class CStretchEngine { @@ -26,10 +27,10 @@ class CStretchEngine { int flags); ~CStretchEngine(); - bool Continue(IFX_Pause* pPause); + bool Continue(IFX_PauseIndicator* pPause); bool StartStretchHorz(); - bool ContinueStretchHorz(IFX_Pause* pPause); + bool ContinueStretchHorz(IFX_PauseIndicator* pPause); void StretchVert(); class CWeightTable { diff --git a/core/fxge/ifx_renderdevicedriver.cpp b/core/fxge/ifx_renderdevicedriver.cpp index ac7a7424e7..378c9b89ef 100644 --- a/core/fxge/ifx_renderdevicedriver.cpp +++ b/core/fxge/ifx_renderdevicedriver.cpp @@ -58,7 +58,7 @@ CFX_RetainPtr IFX_RenderDeviceDriver::GetBackDrop() { } bool IFX_RenderDeviceDriver::ContinueDIBits(CFX_ImageRenderer* handle, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { return false; } diff --git a/core/fxge/ifx_renderdevicedriver.h b/core/fxge/ifx_renderdevicedriver.h index 1e4e30584e..cdea22e2db 100644 --- a/core/fxge/ifx_renderdevicedriver.h +++ b/core/fxge/ifx_renderdevicedriver.h @@ -22,7 +22,7 @@ class CFX_Matrix; class CFX_PathData; class CPDF_ShadingPattern; class FXTEXT_CHARPOS; -class IFX_Pause; +class IFX_PauseIndicator; struct FX_RECT; class IFX_RenderDeviceDriver { @@ -86,7 +86,8 @@ class IFX_RenderDeviceDriver { uint32_t flags, std::unique_ptr* handle, int blend_type) = 0; - virtual bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause); + virtual bool ContinueDIBits(CFX_ImageRenderer* handle, + IFX_PauseIndicator* pPause); virtual bool DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 6dd49d1be7..05a4c3a9ed 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -2391,7 +2391,7 @@ bool CFX_SkiaDeviceDriver::StartDIBits( } bool CFX_SkiaDeviceDriver::ContinueDIBits(CFX_ImageRenderer* handle, - IFX_Pause* pPause) { + IFX_PauseIndicator* pPause) { #ifdef _SKIA_SUPPORT_ m_pCache->FlushForDraw(); return false; diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index 2a92a36aac..df28479d9a 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -120,7 +120,8 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { std::unique_ptr* handle, int blend_type) override; - bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_Pause* pPause) override; + bool ContinueDIBits(CFX_ImageRenderer* handle, + IFX_PauseIndicator* pPause) override; bool DrawBitsWithMask(const CFX_RetainPtr& pBitmap, const CFX_RetainPtr& pMask, diff --git a/fpdfsdk/fsdk_pauseadapter.h b/fpdfsdk/fsdk_pauseadapter.h index 66a628aa09..25028f8d67 100644 --- a/fpdfsdk/fsdk_pauseadapter.h +++ b/fpdfsdk/fsdk_pauseadapter.h @@ -7,11 +7,12 @@ #ifndef FPDFSDK_FSDK_PAUSEADAPTER_H_ #define FPDFSDK_FSDK_PAUSEADAPTER_H_ -#include "core/fxcrt/fx_basic.h" +#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/ifx_pauseindicator.h" #include "public/fpdf_progressive.h" -class IFSDK_PAUSE_Adapter : public IFX_Pause { +class IFSDK_PAUSE_Adapter : public IFX_PauseIndicator { public: explicit IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause); ~IFSDK_PAUSE_Adapter() override; -- cgit v1.2.3