• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The PDFium Authors
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 "xfa/fgas/graphics/cfgas_gecolor.h"
10 #include "xfa/fgas/graphics/cfgas_gegraphics.h"
11 #include "xfa/fgas/graphics/cfgas_gepath.h"
12 #include "xfa/fwl/cfwl_caret.h"
13 #include "xfa/fwl/cfwl_themebackground.h"
14 #include "xfa/fwl/cfwl_widget.h"
15 
16 namespace pdfium {
17 
18 CFWL_CaretTP::CFWL_CaretTP() = default;
19 
20 CFWL_CaretTP::~CFWL_CaretTP() = default;
21 
DrawBackground(const CFWL_ThemeBackground & pParams)22 void CFWL_CaretTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
23   switch (pParams.GetPart()) {
24     case CFWL_ThemePart::Part::kBackground: {
25       if (!(pParams.m_dwStates & CFWL_PartState::kHightLight))
26         return;
27 
28       DrawCaretBK(pParams.GetGraphics(), pParams.m_dwStates, pParams.m_PartRect,
29                   pParams.m_matrix);
30       break;
31     }
32     default:
33       break;
34   }
35 }
36 
DrawCaretBK(CFGAS_GEGraphics * pGraphics,Mask<CFWL_PartState> dwStates,const CFX_RectF & rect,const CFX_Matrix & matrix)37 void CFWL_CaretTP::DrawCaretBK(CFGAS_GEGraphics* pGraphics,
38                                Mask<CFWL_PartState> dwStates,
39                                const CFX_RectF& rect,
40                                const CFX_Matrix& matrix) {
41   CFGAS_GEPath path;
42   path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
43   pGraphics->SetFillColor(CFGAS_GEColor(ArgbEncode(255, 0, 0, 0)));
44   pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
45 }
46 
47 }  // namespace pdfium
48