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

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

Issue 2095653002: Remove NULL in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master 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_checksum.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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return &m_dwValue; 143 return &m_dwValue;
144 } 144 }
145 case CFWL_WidgetCapacity::LineHeight: { 145 case CFWL_WidgetCapacity::LineHeight: {
146 m_fValue = kLineHeight; 146 m_fValue = kLineHeight;
147 break; 147 break;
148 } 148 }
149 case CFWL_WidgetCapacity::UIMargin: { 149 case CFWL_WidgetCapacity::UIMargin: {
150 m_rtMargin.Set(0, 0, 0, 0); 150 m_rtMargin.Set(0, 0, 0, 0);
151 return &m_rtMargin; 151 return &m_rtMargin;
152 } 152 }
153 default: { return NULL; } 153 default: { return nullptr; }
154 } 154 }
155 return &m_fValue; 155 return &m_fValue;
156 } 156 }
157 FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { 157 FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) {
158 return FWL_GetThemeLayout(m_dwThemeID); 158 return FWL_GetThemeLayout(m_dwThemeID);
159 } 159 }
160 FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, 160 FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart,
161 CFX_RectF& rect) { 161 CFX_RectF& rect) {
162 return FWL_Error::Succeeded; 162 return FWL_Error::Succeeded;
163 } 163 }
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 FWLTHEME_STATE eState, 658 FWLTHEME_STATE eState,
659 CFX_Matrix* pMatrix) { 659 CFX_Matrix* pMatrix) {
660 DrawBtn(pGraphics, pRect, eState, pMatrix); 660 DrawBtn(pGraphics, pRect, eState, pMatrix);
661 if (!CFWL_ArrowData::IsInstance()) { 661 if (!CFWL_ArrowData::IsInstance()) {
662 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); 662 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID));
663 } 663 }
664 CFWL_ArrowData::CColorData* pColorData = 664 CFWL_ArrowData::CColorData* pColorData =
665 CFWL_ArrowData::GetInstance()->m_pColorData; 665 CFWL_ArrowData::GetInstance()->m_pColorData;
666 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); 666 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix);
667 } 667 }
668 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) { 668 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(nullptr) {
669 SetColorData(0); 669 SetColorData(0);
670 } 670 }
671 CFWL_FontData::CFWL_FontData() 671 CFWL_FontData::CFWL_FontData()
672 : m_dwStyles(0), 672 : m_dwStyles(0),
673 m_dwCodePage(0), 673 m_dwCodePage(0),
674 m_pFont(0), 674 m_pFont(0),
675 m_pFontMgr(NULL) 675 m_pFontMgr(nullptr)
676 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 676 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
677 , 677 ,
678 m_pFontSource(NULL) 678 m_pFontSource(nullptr)
679 #endif 679 #endif
680 { 680 {
681 } 681 }
682 CFWL_FontData::~CFWL_FontData() { 682 CFWL_FontData::~CFWL_FontData() {
683 if (m_pFont) { 683 if (m_pFont) {
684 m_pFont->Release(); 684 m_pFont->Release();
685 } 685 }
686 if (m_pFontMgr) { 686 if (m_pFontMgr) {
687 m_pFontMgr->Release(); 687 m_pFontMgr->Release();
688 } 688 }
689 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 689 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
690 if (m_pFontSource != NULL) { 690 if (m_pFontSource) {
691 m_pFontSource->Release(); 691 m_pFontSource->Release();
692 } 692 }
693 #endif 693 #endif
694 } 694 }
695 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, 695 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily,
696 uint32_t dwFontStyles, 696 uint32_t dwFontStyles,
697 uint16_t wCodePage) { 697 uint16_t wCodePage) {
698 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && 698 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles &&
699 m_dwCodePage == wCodePage; 699 m_dwCodePage == wCodePage;
700 } 700 }
701 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, 701 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily,
702 uint32_t dwFontStyles, 702 uint32_t dwFontStyles,
703 uint16_t dwCodePage) { 703 uint16_t dwCodePage) {
704 m_wsFamily = wsFontFamily; 704 m_wsFamily = wsFontFamily;
705 m_dwStyles = dwFontStyles; 705 m_dwStyles = dwFontStyles;
706 m_dwCodePage = dwCodePage; 706 m_dwCodePage = dwCodePage;
707 if (!m_pFontMgr) { 707 if (!m_pFontMgr) {
708 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 708 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
709 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); 709 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
710 #else 710 #else
711 m_pFontSource = new CFX_FontSourceEnum_File; 711 m_pFontSource = new CFX_FontSourceEnum_File;
712 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource); 712 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource);
713 #endif 713 #endif
714 } 714 }
715 m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles, 715 m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.c_str(), dwFontStyles,
716 dwCodePage, m_pFontMgr); 716 dwCodePage, m_pFontMgr);
717 return m_pFont != NULL; 717 return !!m_pFont;
718 } 718 }
719 719
720 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; 720 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr;
721 CFWL_FontManager* CFWL_FontManager::GetInstance() { 721 CFWL_FontManager* CFWL_FontManager::GetInstance() {
722 if (!s_FontManager) 722 if (!s_FontManager)
723 s_FontManager = new CFWL_FontManager; 723 s_FontManager = new CFWL_FontManager;
724 return s_FontManager; 724 return s_FontManager;
725 } 725 }
726 void CFWL_FontManager::DestroyInstance() { 726 void CFWL_FontManager::DestroyInstance() {
727 delete s_FontManager; 727 delete s_FontManager;
(...skipping 21 matching lines...) Expand all
749 CFWL_ArrowData::DestroyInstance(); 749 CFWL_ArrowData::DestroyInstance();
750 CFWL_FontManager::DestroyInstance(); 750 CFWL_FontManager::DestroyInstance();
751 } 751 }
752 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { 752 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) {
753 return 0xffff0000 & dwThemeID; 753 return 0xffff0000 & dwThemeID;
754 } 754 }
755 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { 755 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) {
756 return 0x0000ffff & dwThemeID; 756 return 0x0000ffff & dwThemeID;
757 } 757 }
758 758
759 CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL; 759 CFWL_ArrowData* CFWL_ArrowData::m_pInstance = nullptr;
760 760
761 CFWL_ArrowData* CFWL_ArrowData::GetInstance() { 761 CFWL_ArrowData* CFWL_ArrowData::GetInstance() {
762 if (!m_pInstance) 762 if (!m_pInstance)
763 m_pInstance = new CFWL_ArrowData; 763 m_pInstance = new CFWL_ArrowData;
764 return m_pInstance; 764 return m_pInstance;
765 } 765 }
766 766
767 FX_BOOL CFWL_ArrowData::IsInstance() { 767 FX_BOOL CFWL_ArrowData::IsInstance() {
768 return !!m_pInstance; 768 return !!m_pInstance;
769 } 769 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251); 810 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251);
811 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251); 811 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251);
812 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235); 812 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235);
813 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); 813 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236);
814 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133); 814 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133);
815 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133); 815 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133);
816 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133); 816 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133);
817 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); 817 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128);
818 } 818 }
819 } 819 }
OLDNEW
« no previous file with comments | « xfa/fwl/theme/cfwl_widgettp.h ('k') | xfa/fxfa/app/xfa_checksum.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698