| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fwl/theme/cfwl_carettp.h" | 7 #include "xfa/fwl/theme/cfwl_carettp.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/core/cfwl_themebackground.h" | 9 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 10 #include "xfa/fwl/core/ifwl_caret.h" | 10 #include "xfa/fwl/core/ifwl_caret.h" |
| 11 #include "xfa/fwl/core/ifwl_widget.h" | 11 #include "xfa/fwl/core/ifwl_widget.h" |
| 12 #include "xfa/fxgraphics/cfx_color.h" | 12 #include "xfa/fxgraphics/cfx_color.h" |
| 13 #include "xfa/fxgraphics/cfx_path.h" | 13 #include "xfa/fxgraphics/cfx_path.h" |
| 14 | 14 |
| 15 CFWL_CaretTP::CFWL_CaretTP() {} | 15 CFWL_CaretTP::CFWL_CaretTP() {} |
| 16 CFWL_CaretTP::~CFWL_CaretTP() {} | 16 CFWL_CaretTP::~CFWL_CaretTP() {} |
| 17 | 17 |
| 18 bool CFWL_CaretTP::IsValidWidget(IFWL_Widget* pWidget) { | 18 bool CFWL_CaretTP::IsValidWidget(IFWL_Widget* pWidget) { |
| 19 return pWidget && pWidget->GetClassID() == FWL_Type::Caret; | 19 return pWidget && pWidget->GetClassID() == FWL_Type::Caret; |
| 20 } | 20 } |
| 21 | 21 |
| 22 FX_BOOL CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 22 void CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
| 23 if (!pParams) | 23 if (!pParams) |
| 24 return FALSE; | 24 return; |
| 25 |
| 25 switch (pParams->m_iPart) { | 26 switch (pParams->m_iPart) { |
| 26 case CFWL_Part::Background: { | 27 case CFWL_Part::Background: { |
| 27 if (!(pParams->m_dwStates & CFWL_PartState_HightLight)) { | 28 if (!(pParams->m_dwStates & CFWL_PartState_HightLight)) |
| 28 return TRUE; | 29 return; |
| 29 } | 30 |
| 30 DrawCaretBK(pParams->m_pGraphics, pParams->m_dwStates, | 31 DrawCaretBK(pParams->m_pGraphics, pParams->m_dwStates, |
| 31 &(pParams->m_rtPart), (CFX_Color*)pParams->m_pData, | 32 &(pParams->m_rtPart), (CFX_Color*)pParams->m_pData, |
| 32 &(pParams->m_matrix)); | 33 &(pParams->m_matrix)); |
| 33 break; | 34 break; |
| 34 } | 35 } |
| 35 default: | 36 default: |
| 36 break; | 37 break; |
| 37 } | 38 } |
| 38 return TRUE; | |
| 39 } | 39 } |
| 40 |
| 40 void CFWL_CaretTP::DrawCaretBK(CFX_Graphics* pGraphics, | 41 void CFWL_CaretTP::DrawCaretBK(CFX_Graphics* pGraphics, |
| 41 uint32_t dwStates, | 42 uint32_t dwStates, |
| 42 const CFX_RectF* pRect, | 43 const CFX_RectF* pRect, |
| 43 CFX_Color* crFill, | 44 CFX_Color* crFill, |
| 44 CFX_Matrix* pMatrix) { | 45 CFX_Matrix* pMatrix) { |
| 45 CFX_Path path; | 46 CFX_Path path; |
| 46 path.Create(); | 47 path.Create(); |
| 47 CFX_RectF rect = *pRect; | 48 CFX_RectF rect = *pRect; |
| 48 path.AddRectangle(rect.left, rect.top, rect.width, rect.height); | 49 path.AddRectangle(rect.left, rect.top, rect.width, rect.height); |
| 49 if (crFill) { | 50 if (crFill) { |
| 50 pGraphics->SetFillColor(crFill); | 51 pGraphics->SetFillColor(crFill); |
| 51 } else { | 52 } else { |
| 52 CFX_Color crFilltemp(ArgbEncode(255, 0, 0, 0)); | 53 CFX_Color crFilltemp(ArgbEncode(255, 0, 0, 0)); |
| 53 pGraphics->SetFillColor(&crFilltemp); | 54 pGraphics->SetFillColor(&crFilltemp); |
| 54 } | 55 } |
| 55 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | 56 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); |
| 56 } | 57 } |
| OLD | NEW |