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/fwl/theme/cfwl_carettp.h"
8
9 #include "core/fxge/render_defines.h"
10 #include "xfa/fwl/cfwl_caret.h"
11 #include "xfa/fwl/cfwl_themebackground.h"
12 #include "xfa/fwl/cfwl_widget.h"
13 #include "xfa/fxgraphics/cxfa_gecolor.h"
14 #include "xfa/fxgraphics/cxfa_gepath.h"
15
16 CFWL_CaretTP::CFWL_CaretTP() = default;
17
18 CFWL_CaretTP::~CFWL_CaretTP() = default;
19
DrawBackground(const CFWL_ThemeBackground & pParams)20 void CFWL_CaretTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
21 switch (pParams.m_iPart) {
22 case CFWL_Part::Background: {
23 if (!(pParams.m_dwStates & CFWL_PartState_HightLight))
24 return;
25
26 DrawCaretBK(pParams.m_pGraphics.Get(), pParams.m_dwStates,
27 pParams.m_rtPart, pParams.m_matrix);
28 break;
29 }
30 default:
31 break;
32 }
33 }
34
DrawCaretBK(CXFA_Graphics * pGraphics,uint32_t dwStates,const CFX_RectF & rect,const CFX_Matrix & matrix)35 void CFWL_CaretTP::DrawCaretBK(CXFA_Graphics* pGraphics,
36 uint32_t dwStates,
37 const CFX_RectF& rect,
38 const CFX_Matrix& matrix) {
39 CXFA_GEPath path;
40 path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
41 pGraphics->SetFillColor(CXFA_GEColor(ArgbEncode(255, 0, 0, 0)));
42 pGraphics->FillPath(&path, FXFILL_WINDING, &matrix);
43 }
44