summaryrefslogtreecommitdiff
path: root/xfa/fde
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde')
-rw-r--r--xfa/fde/cfde_rendercontext.cpp54
-rw-r--r--xfa/fde/cfde_rendercontext.h17
2 files changed, 16 insertions, 55 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;