summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-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
6 files changed, 19 insertions, 68 deletions
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