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 #include "xfa/fxgraphics/cxfa_graphics.h" 12 CXFA_RenderContext(CXFA_FFPageView * pPageView,const CFX_RectF & clipRect,const CFX_Matrix & matrix)13CXFA_RenderContext::CXFA_RenderContext(CXFA_FFPageView* pPageView, 14 const CFX_RectF& clipRect, 15 const CFX_Matrix& matrix) 16 : m_pWidget(nullptr), m_matrix(matrix), m_rtClipRect(clipRect) { 17 matrix.GetInverse().TransformRect(m_rtClipRect); 18 19 m_pWidgetIterator = pPageView->CreateWidgetIterator( 20 XFA_TRAVERSEWAY_Form, 21 XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable); 22 m_pWidget = m_pWidgetIterator->MoveToNext(); 23 } 24 ~CXFA_RenderContext()25CXFA_RenderContext::~CXFA_RenderContext() {} 26 DoRender(CXFA_Graphics * gs)27void CXFA_RenderContext::DoRender(CXFA_Graphics* gs) { 28 while (m_pWidget) { 29 CFX_RectF rtWidgetBox = m_pWidget->GetBBox(XFA_WidgetStatus_Visible); 30 rtWidgetBox.width += 1; 31 rtWidgetBox.height += 1; 32 if (rtWidgetBox.IntersectWith(m_rtClipRect)) 33 m_pWidget->RenderWidget(gs, m_matrix, XFA_WidgetStatus_Highlight); 34 35 m_pWidget = m_pWidgetIterator->MoveToNext(); 36 } 37 } 38