summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp13
-rw-r--r--xfa/fxfa/cxfa_rendercontext.cpp49
-rw-r--r--xfa/fxfa/cxfa_rendercontext.h23
-rw-r--r--xfa/fxfa/fxfa.h3
4 files changed, 23 insertions, 65 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 946dd84163..2dd8e309cf 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -95,18 +95,17 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
return;
if (pPage->GetContext()->GetDocType() == XFA_DocType::Dynamic) {
- CFX_Graphics gs(pDevice);
CFX_RectF rectClip(
static_cast<float>(pClip.left), static_cast<float>(pClip.top),
static_cast<float>(pClip.Width()), static_cast<float>(pClip.Height()));
+
+ CFX_Graphics gs(pDevice);
gs.SetClipRect(rectClip);
- auto pRenderContext = pdfium::MakeUnique<CXFA_RenderContext>();
- CXFA_RenderOptions renderOptions;
- renderOptions.m_bHighlight = true;
+
CXFA_FFPageView* xfaView = pPage->GetXFAPageView();
- pRenderContext->StartRender(xfaView, &gs, *pUser2Device, renderOptions);
- pRenderContext->DoRender();
- pRenderContext->StopRender();
+ CXFA_RenderContext renderContext(xfaView, rectClip, *pUser2Device);
+ renderContext.DoRender(&gs);
+
CXFA_FFDocView* docView = xfaView->GetDocView();
if (!docView)
return;
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