summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.h5
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp29
-rw-r--r--xfa/fde/cfde_rendercontext.cpp54
-rw-r--r--xfa/fde/cfde_rendercontext.h17
-rw-r--r--xfa/fwl/cfwl_edit.cpp2
-rw-r--r--xfa/fxfa/cxfa_rendercontext.cpp10
-rw-r--r--xfa/fxfa/cxfa_rendercontext.h2
-rw-r--r--xfa/fxfa/fxfa.h2
8 files changed, 25 insertions, 96 deletions
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 6081fe3c19..f63c1ded0c 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -22,7 +22,6 @@ class CCodec_JpegModule;
class CCodec_ModuleMgr;
class CFX_DIBAttribute;
class IFX_SeekableReadStream;
-class IFX_Pause;
struct FXJPEG_Context;
class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
@@ -57,7 +56,7 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
int32_t GetBPC() const { return m_SrcBPC; }
void SetClipBox(FX_RECT* clip);
- FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause = nullptr);
+ FXCODEC_STATUS GetFrames(int32_t& frames);
FXCODEC_STATUS StartDecode(const CFX_RetainPtr<CFX_DIBitmap>& pDIBitmap,
int start_x,
int start_y,
@@ -66,7 +65,7 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
int32_t frames = 0,
bool bInterpol = true);
- FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = nullptr);
+ FXCODEC_STATUS ContinueDecode();
struct PixelWeight {
int m_SrcStart;
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 9d710e582d..e26431ffab 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -1784,8 +1784,7 @@ void CCodec_ProgressiveDecoder::Resample(
}
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t& frames,
- IFX_Pause* pPause) {
+FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t& frames) {
if (!(m_status == FXCODEC_STATUS_FRAME_READY ||
m_status == FXCODEC_STATUS_FRAME_TOBECONTINUE)) {
return FXCODEC_STATUS_ERROR;
@@ -1809,13 +1808,9 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::GetFrames(int32_t& frames,
pGifModule->LoadFrameInfo(m_pGifContext, &m_FrameNumber);
while (readResult == GifDecodeStatus::Unfinished) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_READ;
- if (!GifReadMoreData(pGifModule, error_status)) {
+ if (!GifReadMoreData(pGifModule, error_status))
return error_status;
- }
- if (pPause && pPause->NeedToPauseNow()) {
- m_status = FXCODEC_STATUS_FRAME_TOBECONTINUE;
- return m_status;
- }
+
readResult = pGifModule->LoadFrameInfo(m_pGifContext, &m_FrameNumber);
}
if (readResult == GifDecodeStatus::Success) {
@@ -2043,7 +2038,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(
}
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
+FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
if (m_status != FXCODEC_STATUS_DECODE_TOBECONTINUE)
return FXCODEC_STATUS_ERROR;
@@ -2074,10 +2069,6 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
}
Resample(m_pDeviceBitmap, m_SrcRow, m_pDecodeBuf, m_SrcFormat);
m_SrcRow++;
- if (pPause && pPause->NeedToPauseNow()) {
- m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
- return m_status;
- }
}
}
case FXCODEC_IMAGE_PNG: {
@@ -2122,10 +2113,6 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
m_status = FXCODEC_STATUS_ERROR;
return m_status;
}
- if (pPause && pPause->NeedToPauseNow()) {
- m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
- return m_status;
- }
}
}
case FXCODEC_IMAGE_GIF: {
@@ -2145,10 +2132,6 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
m_status = error_status;
return m_status;
}
- if (pPause && pPause->NeedToPauseNow()) {
- m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
- return m_status;
- }
readRes = pGifModule->LoadFrame(m_pGifContext, m_FrameCur, nullptr);
}
if (readRes == GifDecodeStatus::Success) {
@@ -2179,10 +2162,6 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) {
m_status = error_status;
return m_status;
}
- if (pPause && pPause->NeedToPauseNow()) {
- m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
- return m_status;
- }
readRes = pBmpModule->LoadImage(m_pBmpContext);
}
if (readRes == 1) {
diff --git a/xfa/fde/cfde_rendercontext.cpp b/xfa/fde/cfde_rendercontext.cpp
index 2e690e0ed9..af90ff7f13 100644
--- a/xfa/fde/cfde_rendercontext.cpp
+++ b/xfa/fde/cfde_rendercontext.cpp
@@ -15,42 +15,30 @@
#define FDE_PATHRENDER_Fill 2
CFDE_RenderContext::CFDE_RenderContext()
- : m_eStatus(FDE_RENDERSTATUS_Reset),
- m_pRenderDevice(nullptr),
- m_Transform() {
+ : m_pRenderDevice(nullptr), m_Transform() {
m_Transform.SetIdentity();
}
-CFDE_RenderContext::~CFDE_RenderContext() {
- StopRender();
-}
+CFDE_RenderContext::~CFDE_RenderContext() {}
-bool CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice,
+void CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice,
CFDE_TxtEdtPage* pCanvasSet,
const CFX_Matrix& tmDoc2Device) {
- if (m_pRenderDevice)
- return false;
- if (!pRenderDevice)
- return false;
- if (!pCanvasSet)
- return false;
+ if (m_pRenderDevice || !pRenderDevice || !pCanvasSet)
+ return;
- m_eStatus = FDE_RENDERSTATUS_Paused;
m_pRenderDevice = pRenderDevice;
m_Transform = tmDoc2Device;
if (!m_pIterator)
m_pIterator = pdfium::MakeUnique<CFDE_VisualSetIterator>();
-
- return m_pIterator->AttachCanvas(pCanvasSet) && m_pIterator->FilterObjects();
+ if (m_pIterator->AttachCanvas(pCanvasSet))
+ m_pIterator->FilterObjects();
}
-FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) {
- if (!m_pRenderDevice)
- return FDE_RENDERSTATUS_Failed;
- if (!m_pIterator)
- return FDE_RENDERSTATUS_Failed;
+void CFDE_RenderContext::DoRender() {
+ if (!m_pRenderDevice || !m_pIterator)
+ return;
- FDE_RENDERSTATUS eStatus = FDE_RENDERSTATUS_Paused;
CFX_Matrix rm;
rm.SetReverse(m_Transform);
CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect();
@@ -65,10 +53,8 @@ FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) {
int32_t iCount = 0;
while (true) {
pPiece = m_pIterator->GetNext(pVisualSet);
- if (!pPiece || !pVisualSet) {
- eStatus = FDE_RENDERSTATUS_Done;
- break;
- }
+ if (!pPiece || !pVisualSet)
+ return;
if (!rtDocClip.IntersectWith(pVisualSet->GetRect(*pPiece)))
continue;
@@ -83,21 +69,7 @@ FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) {
default:
break;
}
- if (iCount >= 100 && pPause && pPause->NeedToPauseNow()) {
- eStatus = FDE_RENDERSTATUS_Paused;
- break;
- }
}
- return m_eStatus = eStatus;
-}
-
-void CFDE_RenderContext::StopRender() {
- m_eStatus = FDE_RENDERSTATUS_Reset;
- m_pRenderDevice = nullptr;
- m_Transform.SetIdentity();
- m_pIterator.reset();
- m_pBrush.reset();
- m_CharPos.clear();
}
void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet,
@@ -112,10 +84,8 @@ void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet,
int32_t iCount = pTextSet->GetDisplayPos(*pText, nullptr, false);
if (iCount < 1)
return;
-
if (!m_pBrush)
m_pBrush = pdfium::MakeUnique<CFDE_Brush>();
-
if (m_CharPos.size() < static_cast<size_t>(iCount))
m_CharPos.resize(iCount, FXTEXT_CHARPOS());
diff --git a/xfa/fde/cfde_rendercontext.h b/xfa/fde/cfde_rendercontext.h
index 28b8780052..7f54e28c6d 100644
--- a/xfa/fde/cfde_rendercontext.h
+++ b/xfa/fde/cfde_rendercontext.h
@@ -18,28 +18,19 @@
class CFDE_RenderDevice;
class CFDE_TxtEdtTextSet;
-enum FDE_RENDERSTATUS {
- FDE_RENDERSTATUS_Reset = 0,
- FDE_RENDERSTATUS_Paused,
- FDE_RENDERSTATUS_Done,
- FDE_RENDERSTATUS_Failed,
-};
-
class CFDE_RenderContext {
public:
CFDE_RenderContext();
~CFDE_RenderContext();
- bool StartRender(CFDE_RenderDevice* pRenderDevice,
+ void StartRender(CFDE_RenderDevice* pRenderDevice,
CFDE_TxtEdtPage* pCanvasSet,
const CFX_Matrix& tmDoc2Device);
- FDE_RENDERSTATUS GetStatus() const { return m_eStatus; }
- FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr);
- void StopRender();
+ void DoRender();
+
+ private:
void RenderText(CFDE_TxtEdtTextSet* pTextSet, FDE_TEXTEDITPIECE* pText);
- protected:
- FDE_RENDERSTATUS m_eStatus;
CFDE_RenderDevice* m_pRenderDevice;
CFX_Matrix m_Transform;
std::vector<FXTEXT_CHARPOS> m_CharPos;
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 2dc4bcff7b..8c03402f23 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -570,7 +570,7 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
auto pRenderContext = pdfium::MakeUnique<CFDE_RenderContext>();
pRenderDevice->SetClipRect(rtClip);
pRenderContext->StartRender(pRenderDevice.get(), pPage, mt);
- pRenderContext->DoRender(nullptr);
+ pRenderContext->DoRender();
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText) {
pGraphics->RestoreGraphState();
diff --git a/xfa/fxfa/cxfa_rendercontext.cpp b/xfa/fxfa/cxfa_rendercontext.cpp
index 4b48dd4d18..3a4000885d 100644
--- a/xfa/fxfa/cxfa_rendercontext.cpp
+++ b/xfa/fxfa/cxfa_rendercontext.cpp
@@ -10,12 +10,6 @@
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_graphics.h"
-namespace {
-
-const int32_t kMaxCount = 30;
-
-} // namsepace
-
CXFA_RenderContext::CXFA_RenderContext()
: m_pWidget(nullptr), m_pPageView(nullptr), m_pGS(nullptr), m_dwStatus(0) {
m_matrix.SetIdentity();
@@ -47,7 +41,7 @@ int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
return XFA_RENDERSTATUS_Ready;
}
-int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
+int32_t CXFA_RenderContext::DoRender() {
int32_t iCount = 0;
while (m_pWidget) {
CXFA_FFWidget* pWidget = m_pWidget;
@@ -59,8 +53,6 @@ int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
m_pWidget = m_pWidgetIterator->MoveToNext();
iCount++;
- if (iCount > kMaxCount && pPause && pPause->NeedToPauseNow())
- return XFA_RENDERSTATUS_ToBeContinued;
}
return XFA_RENDERSTATUS_Done;
}
diff --git a/xfa/fxfa/cxfa_rendercontext.h b/xfa/fxfa/cxfa_rendercontext.h
index 960bd058d1..d241f448d7 100644
--- a/xfa/fxfa/cxfa_rendercontext.h
+++ b/xfa/fxfa/cxfa_rendercontext.h
@@ -28,7 +28,7 @@ class CXFA_RenderContext {
CFX_Graphics* pGS,
const CFX_Matrix& matrix,
const CXFA_RenderOptions& options);
- int32_t DoRender(IFX_Pause* pPause = nullptr);
+ int32_t DoRender();
void StopRender();
private:
diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h
index 2b4e2377af..fb124acaf4 100644
--- a/xfa/fxfa/fxfa.h
+++ b/xfa/fxfa/fxfa.h
@@ -64,9 +64,7 @@ enum class XFA_DocType { PDF = 0, Dynamic = 1, Static = 2 };
#define XFA_EVENTERROR_Disabled 2
#define XFA_RENDERSTATUS_Ready 1
-#define XFA_RENDERSTATUS_ToBeContinued 2
#define XFA_RENDERSTATUS_Done 3
-#define XFA_RENDERSTATUS_Failed -1
#define XFA_TRAVERSEWAY_Tranvalse 0x0001
#define XFA_TRAVERSEWAY_Form 0x0002