• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "xfa/fxfa/cxfa_rendercontext.h"
8 
9 #include "xfa/fxfa/cxfa_ffpageview.h"
10 #include "xfa/fxfa/cxfa_ffwidget.h"
11 
CXFA_RenderContext(CXFA_FFPageView * pPageView,const CFX_RectF & clipRect,const CFX_Matrix & matrix)12 CXFA_RenderContext::CXFA_RenderContext(CXFA_FFPageView* pPageView,
13                                        const CFX_RectF& clipRect,
14                                        const CFX_Matrix& matrix)
15     : m_pWidgetIterator(pPageView->CreateFormWidgetIterator(
16           XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)),
17       m_pWidget(m_pWidgetIterator->MoveToNext()),
18       m_matrix(matrix),
19       m_rtClipRect(clipRect) {}
20 
21 CXFA_RenderContext::~CXFA_RenderContext() = default;
22 
DoRender(CXFA_Graphics * gs)23 void CXFA_RenderContext::DoRender(CXFA_Graphics* gs) {
24   while (m_pWidget) {
25     CFX_RectF rtWidgetBox = m_pWidget->GetBBox(CXFA_FFWidget::kDoNotDrawFocus);
26     ++rtWidgetBox.width;
27     ++rtWidgetBox.height;
28     if (rtWidgetBox.IntersectWith(m_rtClipRect))
29       m_pWidget->RenderWidget(gs, m_matrix, CXFA_FFWidget::kHighlight);
30 
31     m_pWidget = m_pWidgetIterator->MoveToNext();
32   }
33 }
34