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

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

Issue 1874963002: Remove some FWL code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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') | no next file » | 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 m_pTextOut->SetEllipsisString(L"..."); 213 m_pTextOut->SetEllipsisString(L"...");
214 return FWL_ERR_Succeeded; 214 return FWL_ERR_Succeeded;
215 } 215 }
216 FX_ERR CFWL_WidgetTP::FinalizeTTO() { 216 FX_ERR CFWL_WidgetTP::FinalizeTTO() {
217 if (m_pTextOut) { 217 if (m_pTextOut) {
218 m_pTextOut->Release(); 218 m_pTextOut->Release();
219 m_pTextOut = NULL; 219 m_pTextOut = NULL;
220 } 220 }
221 return FWL_ERR_Succeeded; 221 return FWL_ERR_Succeeded;
222 } 222 }
223 #ifdef THEME_XPSimilar 223
224 void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, 224 void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics,
225 uint32_t dwStyles, 225 uint32_t dwStyles,
226 const CFX_RectF* pRect, 226 const CFX_RectF* pRect,
227 CFX_Matrix* pMatrix) { 227 CFX_Matrix* pMatrix) {
228 if (!pGraphics) 228 if (!pGraphics)
229 return; 229 return;
230 if (!pRect) 230 if (!pRect)
231 return; 231 return;
232 pGraphics->SaveGraphState(); 232 pGraphics->SaveGraphState();
233 CFX_Color crStroke(FWL_GetThemeColor(m_dwThemeID) == 0 233 CFX_Color crStroke(FWL_GetThemeColor(m_dwThemeID) == 0
234 ? ArgbEncode(255, 127, 157, 185) 234 ? ArgbEncode(255, 127, 157, 185)
235 : FWLTHEME_COLOR_Green_BKSelected); 235 : FWLTHEME_COLOR_Green_BKSelected);
236 pGraphics->SetStrokeColor(&crStroke); 236 pGraphics->SetStrokeColor(&crStroke);
237 CFX_Path path; 237 CFX_Path path;
238 path.Create(); 238 path.Create();
239 path.AddRectangle(pRect->left, pRect->top, pRect->width - 1, 239 path.AddRectangle(pRect->left, pRect->top, pRect->width - 1,
240 pRect->height - 1); 240 pRect->height - 1);
241 pGraphics->StrokePath(&path, pMatrix); 241 pGraphics->StrokePath(&path, pMatrix);
242 path.Clear(); 242 path.Clear();
243 crStroke = ArgbEncode(255, 255, 255, 255); 243 crStroke = ArgbEncode(255, 255, 255, 255);
244 pGraphics->SetStrokeColor(&crStroke); 244 pGraphics->SetStrokeColor(&crStroke);
245 path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 3, 245 path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 3,
246 pRect->height - 3); 246 pRect->height - 3);
247 pGraphics->StrokePath(&path, pMatrix); 247 pGraphics->StrokePath(&path, pMatrix);
248 pGraphics->RestoreGraphState(); 248 pGraphics->RestoreGraphState();
249 } 249 }
250 #else 250
251 void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics,
252 uint32_t dwStyles,
253 const CFX_RectF* pRect,
254 CFX_Matrix* pMatrix) {
255 if (!pGraphics)
256 return;
257 if (!pRect)
258 return;
259 FWLTHEME_EDGE eType;
260 FX_FLOAT fWidth;
261 switch (dwStyles & FWL_WGTSTYLE_EdgeMask) {
262 case FWL_WGTSTYLE_EdgeRaised: {
263 eType = FWLTHEME_EDGE_Raised, fWidth = FWLTHEME_CAPACITY_EdgeRaised;
264 break;
265 }
266 case FWL_WGTSTYLE_EdgeSunken: {
267 eType = FWLTHEME_EDGE_Sunken, fWidth = FWLTHEME_CAPACITY_EdgeSunken;
268 break;
269 }
270 case FWL_WGTSTYLE_EdgeFlat:
271 default: { return; }
272 }
273 Draw3DRect(pGraphics, eType, fWidth, pRect, FWLTHEME_COLOR_EDGELT1,
274 FWLTHEME_COLOR_EDGELT2, FWLTHEME_COLOR_EDGERB1,
275 FWLTHEME_COLOR_EDGERB2, pMatrix);
276 }
277 #endif
278 void CFWL_WidgetTP::Draw3DRect(CFX_Graphics* pGraphics, 251 void CFWL_WidgetTP::Draw3DRect(CFX_Graphics* pGraphics,
279 FWLTHEME_EDGE eType, 252 FWLTHEME_EDGE eType,
280 FX_FLOAT fWidth, 253 FX_FLOAT fWidth,
281 const CFX_RectF* pRect, 254 const CFX_RectF* pRect,
282 FX_ARGB cr1, 255 FX_ARGB cr1,
283 FX_ARGB cr2, 256 FX_ARGB cr2,
284 FX_ARGB cr3, 257 FX_ARGB cr3,
285 FX_ARGB cr4, 258 FX_ARGB cr4,
286 CFX_Matrix* pMatrix) { 259 CFX_Matrix* pMatrix) {
287 if (!pGraphics) 260 if (!pGraphics)
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 FWLTHEME_STATE eState, 640 FWLTHEME_STATE eState,
668 CFX_Matrix* pMatrix) { 641 CFX_Matrix* pMatrix) {
669 DrawBtn(pGraphics, pRect, eState, pMatrix); 642 DrawBtn(pGraphics, pRect, eState, pMatrix);
670 if (!CFWL_ArrowData::IsInstance()) { 643 if (!CFWL_ArrowData::IsInstance()) {
671 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); 644 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID));
672 } 645 }
673 CFWL_ArrowData::CColorData* pColorData = 646 CFWL_ArrowData::CColorData* pColorData =
674 CFWL_ArrowData::GetInstance()->m_pColorData; 647 CFWL_ArrowData::GetInstance()->m_pColorData;
675 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); 648 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix);
676 } 649 }
677 FWLCOLOR CFWL_WidgetTP::BlendColor(FWLCOLOR srcColor,
678 FWLCOLOR renderColor,
679 uint8_t scale) {
680 FWLCOLOR dstColor;
681 uint8_t n = 255 - scale;
682 dstColor.a = (uint8_t)(
683 ((uint16_t)srcColor.a * n + (uint16_t)renderColor.a * scale) >> 8);
684 dstColor.r = (uint8_t)(
685 ((uint16_t)srcColor.r * n + (uint16_t)renderColor.r * scale) >> 8);
686 dstColor.g = (uint8_t)(
687 ((uint16_t)srcColor.g * n + (uint16_t)renderColor.g * scale) >> 8);
688 dstColor.b = (uint8_t)(
689 ((uint16_t)srcColor.b * n + (uint16_t)renderColor.b * scale) >> 8);
690 return dstColor;
691 }
692 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) { 650 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) {
693 SetColorData(0); 651 SetColorData(0);
694 } 652 }
695 CFWL_FontData::CFWL_FontData() 653 CFWL_FontData::CFWL_FontData()
696 : m_dwStyles(0), 654 : m_dwStyles(0),
697 m_dwCodePage(0), 655 m_dwCodePage(0),
698 m_pFont(0), 656 m_pFont(0),
699 m_pFontMgr(NULL) 657 m_pFontMgr(NULL)
700 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 658 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
701 , 659 ,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 void FWLTHEME_Release() { 730 void FWLTHEME_Release() {
773 CFWL_ArrowData::DestroyInstance(); 731 CFWL_ArrowData::DestroyInstance();
774 CFWL_FontManager::DestroyInstance(); 732 CFWL_FontManager::DestroyInstance();
775 } 733 }
776 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { 734 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) {
777 return 0xffff0000 & dwThemeID; 735 return 0xffff0000 & dwThemeID;
778 } 736 }
779 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { 737 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) {
780 return 0x0000ffff & dwThemeID; 738 return 0x0000ffff & dwThemeID;
781 } 739 }
782 uint32_t FWL_MakeThemeID(uint32_t dwLayout, uint32_t dwColor) { 740
783 return (dwLayout << 16) | (0x0000FFFF & dwColor);
784 }
785 CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL; 741 CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL;
786 CFWL_ArrowData* CFWL_ArrowData::GetInstance() { 742 CFWL_ArrowData* CFWL_ArrowData::GetInstance() {
787 if (!m_pInstance) { 743 if (!m_pInstance) {
788 m_pInstance = new CFWL_ArrowData; 744 m_pInstance = new CFWL_ArrowData;
789 } 745 }
790 return m_pInstance; 746 return m_pInstance;
791 } 747 }
792 FX_BOOL CFWL_ArrowData::IsInstance() { 748 FX_BOOL CFWL_ArrowData::IsInstance() {
793 return (m_pInstance != NULL); 749 return (m_pInstance != NULL);
794 } 750 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251); 793 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251);
838 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251); 794 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251);
839 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235); 795 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235);
840 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); 796 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236);
841 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133); 797 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133);
842 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133); 798 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133);
843 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133); 799 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133);
844 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); 800 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128);
845 } 801 }
846 } 802 }
OLDNEW
« no previous file with comments | « xfa/fwl/theme/cfwl_widgettp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698