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

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

Issue 2227883002: Use smart pointers for class owned pointers in xfa/fxfa (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 4 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_ffapp.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
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } 690 }
691 CFWL_ArrowData::CColorData* pColorData = 691 CFWL_ArrowData::CColorData* pColorData =
692 CFWL_ArrowData::GetInstance()->m_pColorData.get(); 692 CFWL_ArrowData::GetInstance()->m_pColorData.get();
693 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); 693 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix);
694 } 694 }
695 695
696 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(nullptr) { 696 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(nullptr) {
697 SetColorData(0); 697 SetColorData(0);
698 } 698 }
699 699
700 CFWL_FontData::CFWL_FontData() 700 CFWL_FontData::CFWL_FontData() : m_dwStyles(0), m_dwCodePage(0) {}
701 : m_dwStyles(0),
702 m_dwCodePage(0),
703 m_pFont(0),
704 m_pFontMgr(nullptr)
705 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
706 ,
707 m_pFontSource(nullptr)
708 #endif
709 {
710 }
711 701
712 CFWL_FontData::~CFWL_FontData() { 702 CFWL_FontData::~CFWL_FontData() {}
713 if (m_pFont) {
714 m_pFont->Release();
715 }
716 if (m_pFontMgr) {
717 m_pFontMgr->Release();
718 }
719 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
720 if (m_pFontSource) {
721 m_pFontSource->Release();
722 }
723 #endif
724 }
725 703
726 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, 704 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily,
727 uint32_t dwFontStyles, 705 uint32_t dwFontStyles,
728 uint16_t wCodePage) { 706 uint16_t wCodePage) {
729 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && 707 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles &&
730 m_dwCodePage == wCodePage; 708 m_dwCodePage == wCodePage;
731 } 709 }
732 710
733 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, 711 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily,
734 uint32_t dwFontStyles, 712 uint32_t dwFontStyles,
735 uint16_t dwCodePage) { 713 uint16_t dwCodePage) {
736 m_wsFamily = wsFontFamily; 714 m_wsFamily = wsFontFamily;
737 m_dwStyles = dwFontStyles; 715 m_dwStyles = dwFontStyles;
738 m_dwCodePage = dwCodePage; 716 m_dwCodePage = dwCodePage;
739 if (!m_pFontMgr) { 717 if (!m_pFontMgr) {
740 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 718 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
741 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); 719 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
742 #else 720 #else
743 m_pFontSource = new CFX_FontSourceEnum_File; 721 m_pFontSource.reset(new CFX_FontSourceEnum_File);
744 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource); 722 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource.get());
745 #endif 723 #endif
746 } 724 }
747 m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles, 725 m_pFont.reset(CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles,
748 dwCodePage, m_pFontMgr); 726 dwCodePage, m_pFontMgr.get()));
749 return !!m_pFont; 727 return !!m_pFont;
750 } 728 }
751 729
752 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; 730 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr;
753 CFWL_FontManager* CFWL_FontManager::GetInstance() { 731 CFWL_FontManager* CFWL_FontManager::GetInstance() {
754 if (!s_FontManager) 732 if (!s_FontManager)
755 s_FontManager = new CFWL_FontManager; 733 s_FontManager = new CFWL_FontManager;
756 return s_FontManager; 734 return s_FontManager;
757 } 735 }
758 736
(...skipping 29 matching lines...) Expand all
788 CFWL_FontManager::DestroyInstance(); 766 CFWL_FontManager::DestroyInstance();
789 } 767 }
790 768
791 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { 769 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) {
792 return 0xffff0000 & dwThemeID; 770 return 0xffff0000 & dwThemeID;
793 } 771 }
794 772
795 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { 773 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) {
796 return 0x0000ffff & dwThemeID; 774 return 0x0000ffff & dwThemeID;
797 } 775 }
OLDNEW
« no previous file with comments | « xfa/fwl/theme/cfwl_widgettp.h ('k') | xfa/fxfa/app/xfa_ffapp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698