summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/app/xfa_rendercontext.cpp36
-rw-r--r--xfa/fxfa/include/xfa_rendercontext.h5
2 files changed, 20 insertions, 21 deletions
diff --git a/xfa/fxfa/app/xfa_rendercontext.cpp b/xfa/fxfa/app/xfa_rendercontext.cpp
index 7bfd9630cb..de78a202ad 100644
--- a/xfa/fxfa/app/xfa_rendercontext.cpp
+++ b/xfa/fxfa/app/xfa_rendercontext.cpp
@@ -10,20 +10,20 @@
#include "xfa/fxfa/include/xfa_ffwidget.h"
#include "xfa/fxgraphics/include/cfx_graphics.h"
-#define XFA_RENDERCONTEXT_MaxCount 30
+namespace {
-CXFA_RenderContext::CXFA_RenderContext() {
- m_pWidgetIterator = NULL;
- m_pWidget = NULL;
- m_pPageView = NULL;
- m_pGS = NULL;
- m_dwStatus = 0;
+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();
m_rtClipRect.Reset();
}
-CXFA_RenderContext::~CXFA_RenderContext() {
- StopRender();
-}
+
+CXFA_RenderContext::~CXFA_RenderContext() {}
+
int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
CFX_Graphics* pGS,
const CFX_Matrix& matrix,
@@ -42,11 +42,12 @@ int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
uint32_t dwFilterType = XFA_WidgetStatus_Visible |
(m_options.m_bPrint ? XFA_WidgetStatus_Printable
: XFA_WidgetStatus_Viewable);
- m_pWidgetIterator =
- m_pPageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, dwFilterType);
+ m_pWidgetIterator.reset(
+ m_pPageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, dwFilterType));
m_pWidget = m_pWidgetIterator->MoveToNext();
return XFA_RENDERSTATUS_Ready;
}
+
int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
int32_t iCount = 0;
while (m_pWidget) {
@@ -55,19 +56,16 @@ int32_t CXFA_RenderContext::DoRender(IFX_Pause* pPause) {
pWidget->GetBBox(rtWidgetBox, XFA_WidgetStatus_Visible);
rtWidgetBox.width += 1;
rtWidgetBox.height += 1;
- if (rtWidgetBox.IntersectWith(m_rtClipRect)) {
+ if (rtWidgetBox.IntersectWith(m_rtClipRect))
pWidget->RenderWidget(m_pGS, &m_matrix, m_dwStatus);
- }
m_pWidget = m_pWidgetIterator->MoveToNext();
iCount++;
- if (iCount > XFA_RENDERCONTEXT_MaxCount && pPause &&
- pPause->NeedToPauseNow()) {
+ if (iCount > kMaxCount && pPause && pPause->NeedToPauseNow())
return XFA_RENDERSTATUS_ToBeContinued;
- }
}
return XFA_RENDERSTATUS_Done;
}
+
void CXFA_RenderContext::StopRender() {
- delete m_pWidgetIterator;
- m_pWidgetIterator = nullptr;
+ m_pWidgetIterator.reset();
}
diff --git a/xfa/fxfa/include/xfa_rendercontext.h b/xfa/fxfa/include/xfa_rendercontext.h
index cd7949d78b..1154b8c5f4 100644
--- a/xfa/fxfa/include/xfa_rendercontext.h
+++ b/xfa/fxfa/include/xfa_rendercontext.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXFA_INCLUDE_XFA_RENDERCONTEXT_H_
#define XFA_FXFA_INCLUDE_XFA_RENDERCONTEXT_H_
+#include <memory>
+
#include "xfa/fxfa/include/fxfa.h"
class CXFA_RenderContext {
@@ -14,7 +16,6 @@ class CXFA_RenderContext {
CXFA_RenderContext();
~CXFA_RenderContext();
- void Release() { delete this; }
int32_t StartRender(CXFA_FFPageView* pPageView,
CFX_Graphics* pGS,
const CFX_Matrix& matrix,
@@ -23,7 +24,7 @@ class CXFA_RenderContext {
void StopRender();
protected:
- IXFA_WidgetIterator* m_pWidgetIterator;
+ std::unique_ptr<IXFA_WidgetIterator> m_pWidgetIterator;
CXFA_FFWidget* m_pWidget;
CXFA_FFPageView* m_pPageView;
CFX_Graphics* m_pGS;