Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: xfa/fwl/theme/cfwl_widgettp.cpp

Issue 2037563002: Replace IFGAS_Font with underlying concrete type (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/theme/cfwl_widgettp.h ('k') | xfa/fxfa/app/xfa_ffwidgetacc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_widgettp.h" 7 #include "xfa/fwl/theme/cfwl_widgettp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "xfa/fde/tto/fde_textout.h" 11 #include "xfa/fde/tto/fde_textout.h"
12 #include "xfa/fgas/font/fgas_gefont.h"
12 #include "xfa/fgas/font/fgas_stdfontmgr.h" 13 #include "xfa/fgas/font/fgas_stdfontmgr.h"
13 #include "xfa/fwl/core/cfwl_themebackground.h" 14 #include "xfa/fwl/core/cfwl_themebackground.h"
14 #include "xfa/fwl/core/cfwl_themepart.h" 15 #include "xfa/fwl/core/cfwl_themepart.h"
15 #include "xfa/fwl/core/cfwl_themetext.h" 16 #include "xfa/fwl/core/cfwl_themetext.h"
16 #include "xfa/fwl/core/cfwl_widgetmgr.h" 17 #include "xfa/fwl/core/cfwl_widgetmgr.h"
17 #include "xfa/fwl/core/ifwl_themeprovider.h" 18 #include "xfa/fwl/core/ifwl_themeprovider.h"
18 #include "xfa/fwl/core/ifwl_widget.h" 19 #include "xfa/fwl/core/ifwl_widget.h"
19 #include "xfa/fxgraphics/cfx_color.h" 20 #include "xfa/fxgraphics/cfx_color.h"
20 #include "xfa/fxgraphics/cfx_path.h" 21 #include "xfa/fxgraphics/cfx_path.h"
21 #include "xfa/fxgraphics/cfx_shading.h" 22 #include "xfa/fxgraphics/cfx_shading.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (!m_pTextOut) 195 if (!m_pTextOut)
195 return FWL_Error::Succeeded; 196 return FWL_Error::Succeeded;
196 197
197 m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0); 198 m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0);
198 m_pTextOut->SetFont(m_pFDEFont); 199 m_pTextOut->SetFont(m_pFDEFont);
199 m_pTextOut->SetFontSize(fFontSize); 200 m_pTextOut->SetFontSize(fFontSize);
200 m_pTextOut->SetTextColor(rgbFont); 201 m_pTextOut->SetTextColor(rgbFont);
201 return FWL_Error::Succeeded; 202 return FWL_Error::Succeeded;
202 } 203 }
203 FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, 204 FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget,
204 IFGAS_Font* pFont, 205 CFGAS_GEFont* pFont,
205 FX_FLOAT fFontSize, 206 FX_FLOAT fFontSize,
206 FX_ARGB rgbFont) { 207 FX_ARGB rgbFont) {
207 if (!m_pTextOut) 208 if (!m_pTextOut)
208 return FWL_Error::Succeeded; 209 return FWL_Error::Succeeded;
209 210
210 m_pTextOut->SetFont(pFont); 211 m_pTextOut->SetFont(pFont);
211 m_pTextOut->SetFontSize(fFontSize); 212 m_pTextOut->SetFontSize(fFontSize);
212 m_pTextOut->SetTextColor(rgbFont); 213 m_pTextOut->SetTextColor(rgbFont);
213 return FWL_Error::Succeeded; 214 return FWL_Error::Succeeded;
214 } 215 }
215 IFGAS_Font* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { 216 CFGAS_GEFont* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) {
216 return m_pFDEFont; 217 return m_pFDEFont;
217 } 218 }
218 219
219 CFWL_WidgetTP::CFWL_WidgetTP() 220 CFWL_WidgetTP::CFWL_WidgetTP()
220 : m_dwRefCount(1), m_pFDEFont(nullptr), m_dwThemeID(0) {} 221 : m_dwRefCount(1), m_pFDEFont(nullptr), m_dwThemeID(0) {}
221 222
222 FWL_Error CFWL_WidgetTP::InitTTO() { 223 FWL_Error CFWL_WidgetTP::InitTTO() {
223 if (m_pTextOut) 224 if (m_pTextOut)
224 return FWL_Error::Succeeded; 225 return FWL_Error::Succeeded;
225 226
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 m_dwStyles = dwFontStyles; 705 m_dwStyles = dwFontStyles;
705 m_dwCodePage = dwCodePage; 706 m_dwCodePage = dwCodePage;
706 if (!m_pFontMgr) { 707 if (!m_pFontMgr) {
707 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 708 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
708 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); 709 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
709 #else 710 #else
710 m_pFontSource = new CFX_FontSourceEnum_File; 711 m_pFontSource = new CFX_FontSourceEnum_File;
711 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource); 712 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource);
712 #endif 713 #endif
713 } 714 }
714 m_pFont = IFGAS_Font::LoadFont(wsFontFamily.c_str(), dwFontStyles, dwCodePage, 715 m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles,
715 m_pFontMgr); 716 dwCodePage, m_pFontMgr);
716 return m_pFont != NULL; 717 return m_pFont != NULL;
717 } 718 }
718 719
719 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; 720 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr;
720 CFWL_FontManager* CFWL_FontManager::GetInstance() { 721 CFWL_FontManager* CFWL_FontManager::GetInstance() {
721 if (!s_FontManager) 722 if (!s_FontManager)
722 s_FontManager = new CFWL_FontManager; 723 s_FontManager = new CFWL_FontManager;
723 return s_FontManager; 724 return s_FontManager;
724 } 725 }
725 void CFWL_FontManager::DestroyInstance() { 726 void CFWL_FontManager::DestroyInstance() {
726 delete s_FontManager; 727 delete s_FontManager;
727 s_FontManager = nullptr; 728 s_FontManager = nullptr;
728 } 729 }
729 CFWL_FontManager::CFWL_FontManager() {} 730 CFWL_FontManager::CFWL_FontManager() {}
730 CFWL_FontManager::~CFWL_FontManager() {} 731 CFWL_FontManager::~CFWL_FontManager() {}
731 IFGAS_Font* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily, 732 CFGAS_GEFont* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily,
732 uint32_t dwFontStyles, 733 uint32_t dwFontStyles,
733 uint16_t wCodePage) { 734 uint16_t wCodePage) {
734 for (const auto& pData : m_FontsArray) { 735 for (const auto& pData : m_FontsArray) {
735 if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage)) 736 if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage))
736 return pData->GetFont(); 737 return pData->GetFont();
737 } 738 }
738 std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData); 739 std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData);
739 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage)) 740 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage))
740 return nullptr; 741 return nullptr;
741 m_FontsArray.push_back(std::move(pFontData)); 742 m_FontsArray.push_back(std::move(pFontData));
742 return m_FontsArray.back()->GetFont(); 743 return m_FontsArray.back()->GetFont();
743 } 744 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251); 810 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251);
810 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251); 811 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251);
811 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235); 812 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235);
812 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); 813 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236);
813 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133); 814 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133);
814 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133); 815 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133);
815 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133); 816 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133);
816 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); 817 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128);
817 } 818 }
818 } 819 }
OLDNEW
« no previous file with comments | « xfa/fwl/theme/cfwl_widgettp.h ('k') | xfa/fxfa/app/xfa_ffwidgetacc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698