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/fxfa/app/xfa_fwltheme.h" | 7 #include "xfa/fxfa/app/xfa_fwltheme.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (!m_pCalendarFont) { | 68 if (!m_pCalendarFont) { |
69 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage( | 69 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage( |
70 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr); | 70 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr); |
71 } | 71 } |
72 | 72 |
73 ASSERT(m_pCalendarFont); | 73 ASSERT(m_pCalendarFont); |
74 } | 74 } |
75 | 75 |
76 CXFA_FWLTheme::~CXFA_FWLTheme() { | 76 CXFA_FWLTheme::~CXFA_FWLTheme() { |
77 m_pTextOut.reset(); | 77 m_pTextOut.reset(); |
78 if (m_pCalendarFont) { | |
79 m_pCalendarFont->Release(); | |
80 m_pCalendarFont = nullptr; | |
81 } | |
82 FWLTHEME_Release(); | 78 FWLTHEME_Release(); |
83 } | 79 } |
84 | 80 |
85 void CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { | 81 void CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { |
86 GetTheme(pParams->m_pWidget)->DrawBackground(pParams); | 82 GetTheme(pParams->m_pWidget)->DrawBackground(pParams); |
87 } | 83 } |
88 | 84 |
89 void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { | 85 void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { |
90 if (pParams->m_wsText.IsEmpty()) | 86 if (pParams->m_wsText.IsEmpty()) |
91 return; | 87 return; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 float CXFA_FWLTheme::GetCYBorderSize() const { | 182 float CXFA_FWLTheme::GetCYBorderSize() const { |
187 return 1.0f; | 183 return 1.0f; |
188 } | 184 } |
189 | 185 |
190 float CXFA_FWLTheme::GetFontSize(CFWL_ThemePart* pThemePart) const { | 186 float CXFA_FWLTheme::GetFontSize(CFWL_ThemePart* pThemePart) const { |
191 if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) | 187 if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) |
192 return pWidget->GetDataAcc()->GetFontSize(); | 188 return pWidget->GetDataAcc()->GetFontSize(); |
193 return FWLTHEME_CAPACITY_FontSize; | 189 return FWLTHEME_CAPACITY_FontSize; |
194 } | 190 } |
195 | 191 |
196 CFGAS_GEFont* CXFA_FWLTheme::GetFont(CFWL_ThemePart* pThemePart) const { | 192 CFX_RetainPtr<CFGAS_GEFont> CXFA_FWLTheme::GetFont( |
| 193 CFWL_ThemePart* pThemePart) const { |
197 if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) | 194 if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) |
198 return pWidget->GetDataAcc()->GetFDEFont(); | 195 return pWidget->GetDataAcc()->GetFDEFont(); |
199 return GetTheme(pThemePart->m_pWidget)->GetFont(); | 196 return GetTheme(pThemePart->m_pWidget)->GetFont(); |
200 } | 197 } |
201 | 198 |
202 float CXFA_FWLTheme::GetLineHeight(CFWL_ThemePart* pThemePart) const { | 199 float CXFA_FWLTheme::GetLineHeight(CFWL_ThemePart* pThemePart) const { |
203 if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) | 200 if (CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) |
204 return pWidget->GetDataAcc()->GetLineHeight(); | 201 return pWidget->GetDataAcc()->GetLineHeight(); |
205 return kLineHeight; | 202 return kLineHeight; |
206 } | 203 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 case FWL_Type::PushButton: | 277 case FWL_Type::PushButton: |
281 return m_pPushButtonTP.get(); | 278 return m_pPushButtonTP.get(); |
282 case FWL_Type::Caret: | 279 case FWL_Type::Caret: |
283 return m_pCaretTP.get(); | 280 return m_pCaretTP.get(); |
284 case FWL_Type::Barcode: | 281 case FWL_Type::Barcode: |
285 return m_pBarcodeTP.get(); | 282 return m_pBarcodeTP.get(); |
286 default: | 283 default: |
287 return nullptr; | 284 return nullptr; |
288 } | 285 } |
289 } | 286 } |
OLD | NEW |