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

Side by Side Diff: xfa/src/fwl/src/theme/checkboxtp.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 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/src/fwl/src/lightwidget/widget.cpp ('k') | xfa/src/fwl/src/theme/formtp.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 "../../../foxitlib.h" 7 #include "../../../foxitlib.h"
8 #define CHECKBOX_SIZE_SIGNMARGIN 3 8 #define CHECKBOX_SIZE_SIGNMARGIN 3
9 #define CHECKBOX_SIZE_SIGNBORDER 2 9 #define CHECKBOX_SIZE_SIGNBORDER 2
10 #define CHECKBOX_SIZE_SIGNPATH 100 10 #define CHECKBOX_SIZE_SIGNPATH 100
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 return CFWL_WidgetTP::Initialize(); 94 return CFWL_WidgetTP::Initialize();
95 } 95 }
96 FWL_ERR CFWL_CheckBoxTP::Finalize() 96 FWL_ERR CFWL_CheckBoxTP::Finalize()
97 { 97 {
98 FinalizeTTO(); 98 FinalizeTTO();
99 return CFWL_WidgetTP::Finalize(); 99 return CFWL_WidgetTP::Finalize();
100 } 100 }
101 void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget *pWidget, CFX_Graphics *pGraphics, c onst CFX_RectF *pRect, FX_DWORD dwStates, CFX_Matrix *pMatrix ) 101 void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget *pWidget, CFX_Graphics *pGraphics, c onst CFX_RectF *pRect, FX_DWORD dwStates, CFX_Matrix *pMatrix )
102 { 102 {
103 dwStates &= 0x03; 103 dwStates &= 0x03;
104 FX_INT32 fillMode = FXFILL_WINDING; 104 int32_t fillMode = FXFILL_WINDING;
105 FX_DWORD dwStyleEx = pWidget->GetStylesEx(); 105 FX_DWORD dwStyleEx = pWidget->GetStylesEx();
106 dwStyleEx &= FWL_STYLEEXT_CKB_ShapeMask; 106 dwStyleEx &= FWL_STYLEEXT_CKB_ShapeMask;
107 CFX_Path path; 107 CFX_Path path;
108 path.Create(); 108 path.Create();
109 FX_FLOAT fRight = pRect->right(); 109 FX_FLOAT fRight = pRect->right();
110 FX_FLOAT fBottom = pRect->bottom(); 110 FX_FLOAT fBottom = pRect->bottom();
111 FX_BOOL bClipSign = (dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CK B_Hovered; 111 FX_BOOL bClipSign = (dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CK B_Hovered;
112 if ((dwStyleEx == FWL_STYLEEXT_CKB_ShapeSolidSquare) || (dwStyleEx == FWL_ST YLEEXT_CKB_ShapeSunkenSquare)) { 112 if ((dwStyleEx == FWL_STYLEEXT_CKB_ShapeSolidSquare) || (dwStyleEx == FWL_ST YLEEXT_CKB_ShapeSunkenSquare)) {
113 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); 113 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
114 if (bClipSign) { 114 if (bClipSign) {
(...skipping 15 matching lines...) Expand all
130 fillMode = FXFILL_ALTERNATE; 130 fillMode = FXFILL_ALTERNATE;
131 #ifdef CHECKBOX_FXGE_CoordinatesAdjust 131 #ifdef CHECKBOX_FXGE_CoordinatesAdjust
132 CFX_RectF rtClip(rect); 132 CFX_RectF rtClip(rect);
133 #else 133 #else
134 CFX_RectF rtClip(*pRect); 134 CFX_RectF rtClip(*pRect);
135 #endif 135 #endif
136 rtClip.Deflate(CHECKBOX_SIZE_SIGNMARGIN - 1, CHECKBOX_SIZE_SIGNMARGI N - 1); 136 rtClip.Deflate(CHECKBOX_SIZE_SIGNMARGIN - 1, CHECKBOX_SIZE_SIGNMARGI N - 1);
137 path.AddEllipse(rtClip); 137 path.AddEllipse(rtClip);
138 } 138 }
139 } 139 }
140 FX_INT32 iTheme = 1; 140 int32_t iTheme = 1;
141 if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered) { 141 if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered) {
142 iTheme = 2; 142 iTheme = 2;
143 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Pressed ) { 143 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Pressed ) {
144 iTheme = 3; 144 iTheme = 3;
145 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Disable d) { 145 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Disable d) {
146 iTheme = 4; 146 iTheme = 4;
147 } 147 }
148 if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Checked) { 148 if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Checked) {
149 iTheme += 4; 149 iTheme += 4;
150 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Neutral ) { 150 } else if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Neutral ) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics *pGraphics, const CFX_RectF *pRt Sign, FX_ARGB argbFill, CFX_Matrix *pMatrix ) 296 void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics *pGraphics, const CFX_RectF *pRt Sign, FX_ARGB argbFill, CFX_Matrix *pMatrix )
297 { 297 {
298 CFX_Path path; 298 CFX_Path path;
299 path.Create(); 299 path.Create();
300 FX_FLOAT fBottom = pRtSign->bottom(); 300 FX_FLOAT fBottom = pRtSign->bottom();
301 FX_FLOAT fRadius = (pRtSign->top - fBottom) / ( 1 + (FX_FLOAT)cos(FX_PI / 5. 0f)); 301 FX_FLOAT fRadius = (pRtSign->top - fBottom) / ( 1 + (FX_FLOAT)cos(FX_PI / 5. 0f));
302 CFX_PointF ptCenter; 302 CFX_PointF ptCenter;
303 ptCenter.Set((pRtSign->left + pRtSign->right()) / 2.0f, (pRtSign->top + fBot tom) / 2.0f); 303 ptCenter.Set((pRtSign->left + pRtSign->right()) / 2.0f, (pRtSign->top + fBot tom) / 2.0f);
304 FX_FLOAT px[5], py[5]; 304 FX_FLOAT px[5], py[5];
305 FX_FLOAT fAngel = FX_PI / 10.0f; 305 FX_FLOAT fAngel = FX_PI / 10.0f;
306 for (FX_INT32 i = 0; i < 5; i++) { 306 for (int32_t i = 0; i < 5; i++) {
307 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel); 307 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel);
308 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel); 308 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel);
309 fAngel += FX_PI * 2 / 5.0f; 309 fAngel += FX_PI * 2 / 5.0f;
310 } 310 }
311 path.MoveTo(px[0], py[0]); 311 path.MoveTo(px[0], py[0]);
312 FX_INT32 nNext = 0; 312 int32_t nNext = 0;
313 for (FX_INT32 j = 0; j < 5; j++) { 313 for (int32_t j = 0; j < 5; j++) {
314 nNext += 2; 314 nNext += 2;
315 if (nNext >= 5) { 315 if (nNext >= 5) {
316 nNext -= 5; 316 nNext -= 5;
317 } 317 }
318 path.LineTo(px[nNext], py[nNext]); 318 path.LineTo(px[nNext], py[nNext]);
319 } 319 }
320 CFX_Color crFill(argbFill); 320 CFX_Color crFill(argbFill);
321 pGraphics->SaveGraphState(); 321 pGraphics->SaveGraphState();
322 pGraphics->SetFillColor(&crFill); 322 pGraphics->SetFillColor(&crFill);
323 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); 323 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 pt1.x + px2 * FWLTHEME_BEZIER, pt1.y + py2 * FWLT HEME_BEZIER, 491 pt1.x + px2 * FWLTHEME_BEZIER, pt1.y + py2 * FWLT HEME_BEZIER,
492 pt1.x, pt1.y); 492 pt1.x, pt1.y);
493 FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH; 493 FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH;
494 CFX_AffineMatrix mt; 494 CFX_AffineMatrix mt;
495 mt.Set(1, 0, 0, 1, 0, 0); 495 mt.Set(1, 0, 0, 1, 0, 0);
496 mt.Scale(fScale, fScale); 496 mt.Scale(fScale, fScale);
497 CFX_PathData *pData = m_pCheckPath->GetPathData(); 497 CFX_PathData *pData = m_pCheckPath->GetPathData();
498 pData->Transform(&mt); 498 pData->Transform(&mt);
499 } 499 }
500 } 500 }
OLDNEW
« no previous file with comments | « xfa/src/fwl/src/lightwidget/widget.cpp ('k') | xfa/src/fwl/src/theme/formtp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698