summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_rendercontext.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-05-04 14:08:01 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-04 18:34:17 +0000
commitcf53b788ca1c097c0cbbca3dee048520eb9dabd4 (patch)
tree907214b67e73326c9c52648c20b97d31c80a993b /xfa/fxfa/cxfa_rendercontext.cpp
parentc0aefd45c89a2980de8965f12bc80db408dfa78c (diff)
downloadpdfium-cf53b788ca1c097c0cbbca3dee048520eb9dabd4.tar.xz
Cleanup CXFA_RenderContext
Move StartRender into the constructor, remove StopRender as it will be handled by the destructor. Remove RenderOptions as they are always set the same way. Change-Id: Iddbd6849199cbe255a5e1694164de5556a34f57c Reviewed-on: https://pdfium-review.googlesource.com/4876 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_rendercontext.cpp')
-rw-r--r--xfa/fxfa/cxfa_rendercontext.cpp49
1 files changed, 13 insertions, 36 deletions
diff --git a/xfa/fxfa/cxfa_rendercontext.cpp b/xfa/fxfa/cxfa_rendercontext.cpp
index 3a4000885d..02c7cbb371 100644
--- a/xfa/fxfa/cxfa_rendercontext.cpp
+++ b/xfa/fxfa/cxfa_rendercontext.cpp
@@ -10,53 +10,30 @@
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_graphics.h"
-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() {}
-
-int32_t CXFA_RenderContext::StartRender(CXFA_FFPageView* pPageView,
- CFX_Graphics* pGS,
- const CFX_Matrix& matrix,
- const CXFA_RenderOptions& options) {
- m_pPageView = pPageView;
- m_pGS = pGS;
- m_matrix = matrix;
- m_options = options;
-
+CXFA_RenderContext::CXFA_RenderContext(CXFA_FFPageView* pPageView,
+ const CFX_RectF& clipRect,
+ const CFX_Matrix& matrix)
+ : m_pWidget(nullptr), m_matrix(matrix), m_rtClipRect(clipRect) {
CFX_Matrix mtRes;
mtRes.SetReverse(matrix);
- m_rtClipRect = pGS->GetClipRect();
mtRes.TransformRect(m_rtClipRect);
- m_dwStatus = m_options.m_bHighlight ? XFA_WidgetStatus_Highlight : 0;
- 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 = pPageView->CreateWidgetIterator(
+ XFA_TRAVERSEWAY_Form,
+ XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable);
m_pWidget = m_pWidgetIterator->MoveToNext();
- return XFA_RENDERSTATUS_Ready;
}
-int32_t CXFA_RenderContext::DoRender() {
- int32_t iCount = 0;
+CXFA_RenderContext::~CXFA_RenderContext() {}
+
+void CXFA_RenderContext::DoRender(CFX_Graphics* gs) {
while (m_pWidget) {
- CXFA_FFWidget* pWidget = m_pWidget;
- CFX_RectF rtWidgetBox = pWidget->GetBBox(XFA_WidgetStatus_Visible);
+ CFX_RectF rtWidgetBox = m_pWidget->GetBBox(XFA_WidgetStatus_Visible);
rtWidgetBox.width += 1;
rtWidgetBox.height += 1;
if (rtWidgetBox.IntersectWith(m_rtClipRect))
- pWidget->RenderWidget(m_pGS, &m_matrix, m_dwStatus);
+ m_pWidget->RenderWidget(gs, &m_matrix, XFA_WidgetStatus_Highlight);
m_pWidget = m_pWidgetIterator->MoveToNext();
- iCount++;
}
- return XFA_RENDERSTATUS_Done;
-}
-
-void CXFA_RenderContext::StopRender() {
- m_pWidgetIterator.reset();
}