summaryrefslogtreecommitdiff
path: root/xfa
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
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')
-rw-r--r--xfa/fxfa/cxfa_rendercontext.cpp49
-rw-r--r--xfa/fxfa/cxfa_rendercontext.h23
-rw-r--r--xfa/fxfa/fxfa.h3
3 files changed, 17 insertions, 58 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();
}
diff --git a/xfa/fxfa/cxfa_rendercontext.h b/xfa/fxfa/cxfa_rendercontext.h
index d241f448d7..0fd1dc9e1f 100644
--- a/xfa/fxfa/cxfa_rendercontext.h
+++ b/xfa/fxfa/cxfa_rendercontext.h
@@ -11,34 +11,19 @@
#include "xfa/fxfa/fxfa.h"
-class CXFA_RenderOptions {
- public:
- CXFA_RenderOptions() : m_bPrint(false), m_bHighlight(true) {}
-
- bool m_bPrint;
- bool m_bHighlight;
-};
-
class CXFA_RenderContext {
public:
- CXFA_RenderContext();
+ CXFA_RenderContext(CXFA_FFPageView* pPageView,
+ const CFX_RectF& clipRect,
+ const CFX_Matrix& matrix);
~CXFA_RenderContext();
- int32_t StartRender(CXFA_FFPageView* pPageView,
- CFX_Graphics* pGS,
- const CFX_Matrix& matrix,
- const CXFA_RenderOptions& options);
- int32_t DoRender();
- void StopRender();
+ void DoRender(CFX_Graphics* gs);
private:
std::unique_ptr<IXFA_WidgetIterator> m_pWidgetIterator;
CXFA_FFWidget* m_pWidget;
- CXFA_FFPageView* m_pPageView;
- CFX_Graphics* m_pGS;
CFX_Matrix m_matrix;
- CXFA_RenderOptions m_options;
- uint32_t m_dwStatus;
CFX_RectF m_rtClipRect;
};
diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h
index fb124acaf4..6dd901eaf4 100644
--- a/xfa/fxfa/fxfa.h
+++ b/xfa/fxfa/fxfa.h
@@ -63,9 +63,6 @@ enum class XFA_DocType { PDF = 0, Dynamic = 1, Static = 2 };
#define XFA_EVENTERROR_NotExist 0
#define XFA_EVENTERROR_Disabled 2
-#define XFA_RENDERSTATUS_Ready 1
-#define XFA_RENDERSTATUS_Done 3
-
#define XFA_TRAVERSEWAY_Tranvalse 0x0001
#define XFA_TRAVERSEWAY_Form 0x0002