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

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

Issue 1821043003: Remove FX_WORD in favor of uint16_t. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use stdint.h directly, bitfield minefield. Created 4 years, 9 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
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/include/fwl/theme/widgettp.h" 7 #include "xfa/include/fwl/theme/widgettp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 CFWL_ArrowData::CColorData* pColorData = 669 CFWL_ArrowData::CColorData* pColorData =
670 CFWL_ArrowData::GetInstance()->m_pColorData; 670 CFWL_ArrowData::GetInstance()->m_pColorData;
671 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); 671 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix);
672 } 672 }
673 FWLCOLOR CFWL_WidgetTP::BlendColor(FWLCOLOR srcColor, 673 FWLCOLOR CFWL_WidgetTP::BlendColor(FWLCOLOR srcColor,
674 FWLCOLOR renderColor, 674 FWLCOLOR renderColor,
675 uint8_t scale) { 675 uint8_t scale) {
676 FWLCOLOR dstColor; 676 FWLCOLOR dstColor;
677 uint8_t n = 255 - scale; 677 uint8_t n = 255 - scale;
678 dstColor.a = (uint8_t)( 678 dstColor.a = (uint8_t)(
679 ((FX_WORD)srcColor.a * n + (FX_WORD)renderColor.a * scale) >> 8); 679 ((uint16_t)srcColor.a * n + (uint16_t)renderColor.a * scale) >> 8);
680 dstColor.r = (uint8_t)( 680 dstColor.r = (uint8_t)(
681 ((FX_WORD)srcColor.r * n + (FX_WORD)renderColor.r * scale) >> 8); 681 ((uint16_t)srcColor.r * n + (uint16_t)renderColor.r * scale) >> 8);
682 dstColor.g = (uint8_t)( 682 dstColor.g = (uint8_t)(
683 ((FX_WORD)srcColor.g * n + (FX_WORD)renderColor.g * scale) >> 8); 683 ((uint16_t)srcColor.g * n + (uint16_t)renderColor.g * scale) >> 8);
684 dstColor.b = (uint8_t)( 684 dstColor.b = (uint8_t)(
685 ((FX_WORD)srcColor.b * n + (FX_WORD)renderColor.b * scale) >> 8); 685 ((uint16_t)srcColor.b * n + (uint16_t)renderColor.b * scale) >> 8);
686 return dstColor; 686 return dstColor;
687 } 687 }
688 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) { 688 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) {
689 SetColorData(0); 689 SetColorData(0);
690 } 690 }
691 CFWL_FontData::CFWL_FontData() 691 CFWL_FontData::CFWL_FontData()
692 : m_dwStyles(0), 692 : m_dwStyles(0),
693 m_dwCodePage(0), 693 m_dwCodePage(0),
694 m_pFont(0), 694 m_pFont(0),
695 m_pFontMgr(NULL) 695 m_pFontMgr(NULL)
(...skipping 11 matching lines...) Expand all
707 m_pFontMgr->Release(); 707 m_pFontMgr->Release();
708 } 708 }
709 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 709 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
710 if (m_pFontSource != NULL) { 710 if (m_pFontSource != NULL) {
711 m_pFontSource->Release(); 711 m_pFontSource->Release();
712 } 712 }
713 #endif 713 #endif
714 } 714 }
715 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, 715 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily,
716 FX_DWORD dwFontStyles, 716 FX_DWORD dwFontStyles,
717 FX_WORD wCodePage) { 717 uint16_t wCodePage) {
718 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && 718 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles &&
719 m_dwCodePage == wCodePage; 719 m_dwCodePage == wCodePage;
720 } 720 }
721 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, 721 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily,
722 FX_DWORD dwFontStyles, 722 FX_DWORD dwFontStyles,
723 FX_WORD dwCodePage) { 723 uint16_t dwCodePage) {
724 m_wsFamily = wsFontFamily; 724 m_wsFamily = wsFontFamily;
725 m_dwStyles = dwFontStyles; 725 m_dwStyles = dwFontStyles;
726 m_dwCodePage = dwCodePage; 726 m_dwCodePage = dwCodePage;
727 if (!m_pFontMgr) { 727 if (!m_pFontMgr) {
728 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 728 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
729 m_pFontMgr = IFX_FontMgr::Create(FX_GetDefFontEnumerator()); 729 m_pFontMgr = IFX_FontMgr::Create(FX_GetDefFontEnumerator());
730 #else 730 #else
731 m_pFontSource = FX_CreateDefaultFontSourceEnum(); 731 m_pFontSource = FX_CreateDefaultFontSourceEnum();
732 m_pFontMgr = IFX_FontMgr::Create(m_pFontSource); 732 m_pFontMgr = IFX_FontMgr::Create(m_pFontSource);
733 #endif 733 #endif
(...skipping 10 matching lines...) Expand all
744 return s_FontManager; 744 return s_FontManager;
745 } 745 }
746 void CFWL_FontManager::DestroyInstance() { 746 void CFWL_FontManager::DestroyInstance() {
747 delete s_FontManager; 747 delete s_FontManager;
748 s_FontManager = nullptr; 748 s_FontManager = nullptr;
749 } 749 }
750 CFWL_FontManager::CFWL_FontManager() {} 750 CFWL_FontManager::CFWL_FontManager() {}
751 CFWL_FontManager::~CFWL_FontManager() {} 751 CFWL_FontManager::~CFWL_FontManager() {}
752 IFX_Font* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily, 752 IFX_Font* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily,
753 FX_DWORD dwFontStyles, 753 FX_DWORD dwFontStyles,
754 FX_WORD wCodePage) { 754 uint16_t wCodePage) {
755 for (const auto& pData : m_FontsArray) { 755 for (const auto& pData : m_FontsArray) {
756 if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage)) 756 if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage))
757 return pData->GetFont(); 757 return pData->GetFont();
758 } 758 }
759 std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData); 759 std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData);
760 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage)) 760 if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage))
761 return nullptr; 761 return nullptr;
762 m_FontsArray.push_back(std::move(pFontData)); 762 m_FontsArray.push_back(std::move(pFontData));
763 return m_FontsArray.back()->GetFont(); 763 return m_FontsArray.back()->GetFont();
764 } 764 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251); 833 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251);
834 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251); 834 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251);
835 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235); 835 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235);
836 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); 836 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236);
837 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133); 837 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133);
838 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133); 838 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133);
839 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133); 839 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133);
840 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); 840 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128);
841 } 841 }
842 } 842 }
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_scrollbarimp.cpp ('k') | xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698