diff options
author | tsepez <tsepez@chromium.org> | 2016-05-18 12:50:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-18 12:50:41 -0700 |
commit | a039bc2d0142efe9148ed4580ef304b33570b431 (patch) | |
tree | be4bed659f3c1cf50de9552ad58364fe8331c0e9 /xfa/fxfa/app/xfa_rendercontext.cpp | |
parent | e7b2853a4143137803609fe96330d7924c1731ed (diff) | |
download | pdfium-a039bc2d0142efe9148ed4580ef304b33570b431.tar.xz |
Remove Release() from CXFA_RenderContext
Review-Url: https://codereview.chromium.org/1994733002
Diffstat (limited to 'xfa/fxfa/app/xfa_rendercontext.cpp')
-rw-r--r-- | xfa/fxfa/app/xfa_rendercontext.cpp | 36 |
1 files changed, 17 insertions, 19 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(); } |