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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Utils.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 | « fpdfsdk/src/pdfwindow/PWL_Signature.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Wnd.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 "../../include/pdfwindow/PDFWindow.h" 7 #include "../../include/pdfwindow/PDFWindow.h"
8 #include "../../include/pdfwindow/PWL_Wnd.h" 8 #include "../../include/pdfwindow/PWL_Wnd.h"
9 #include "../../include/pdfwindow/PWL_Utils.h" 9 #include "../../include/pdfwindow/PWL_Utils.h"
10 #include "../../include/pdfwindow/PWL_Icon.h" 10 #include "../../include/pdfwindow/PWL_Icon.h"
11 11
12 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) 12 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
13 #define IsFloatBigger(fa,fb) ((fa) > (fb) && !IsFloat Zero((fa) - (fb))) 13 #define IsFloatBigger(fa,fb) ((fa) > (fb) && !IsFloat Zero((fa) - (fb)))
14 #define IsFloatSmaller(fa,fb) ((fa) < (fb) && !IsFloat Zero((fa) - (fb))) 14 #define IsFloatSmaller(fa,fb) ((fa) < (fb) && !IsFloat Zero((fa) - (fb)))
15 #define IsFloatEqual(fa,fb) IsFloatZero((fa) -(fb)) 15 #define IsFloatEqual(fa,fb) IsFloatZero((fa) -(fb))
16 16
17 /* ---------------------------- CPWL_Utils ------------------------------ */ 17 /* ---------------------------- CPWL_Utils ------------------------------ */
18 18
19 CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, FX_INT32 nCount) 19 CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, int32_t nCount)
20 { 20 {
21 CFX_ByteTextBuf csAP; 21 CFX_ByteTextBuf csAP;
22 22
23 » for (FX_INT32 i=0; i<nCount; i++) 23 » for (int32_t i=0; i<nCount; i++)
24 { 24 {
25 switch (pPathData[i].type) 25 switch (pPathData[i].type)
26 { 26 {
27 case PWLPT_MOVETO: 27 case PWLPT_MOVETO:
28 csAP << pPathData[i].point.x << " " << pPathData[i].poin t.y << " m\n"; 28 csAP << pPathData[i].point.x << " " << pPathData[i].poin t.y << " m\n";
29 break; 29 break;
30 case PWLPT_LINETO: 30 case PWLPT_LINETO:
31 csAP << pPathData[i].point.x << " " << pPathData[i].poin t.y << " l\n"; 31 csAP << pPathData[i].point.x << " " << pPathData[i].poin t.y << " l\n";
32 break; 32 break;
33 case PWLPT_BEZIERTO: 33 case PWLPT_BEZIERTO:
34 csAP << pPathData[i].point.x << " " << pPathData[i].poin t.y << " " 34 csAP << pPathData[i].point.x << " " << pPathData[i].poin t.y << " "
35 << pPathData[i+1].point.x << " " << pPathData[i +1].point.y << " " 35 << pPathData[i+1].point.x << " " << pPathData[i +1].point.y << " "
36 << pPathData[i+2].point.x << " " << pPathData[i +2].point.y << " c\n"; 36 << pPathData[i+2].point.x << " " << pPathData[i +2].point.y << " c\n";
37 37
38 i += 2; 38 i += 2;
39 break; 39 break;
40 default: 40 default:
41 break; 41 break;
42 } 42 }
43 } 43 }
44 44
45 return csAP.GetByteString(); 45 return csAP.GetByteString();
46 } 46 }
47 47
48 void CPWL_Utils::GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* p PathData, FX_INT32 nCount) 48 void CPWL_Utils::GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* p PathData, int32_t nCount)
49 { 49 {
50 path.SetPointCount(nCount); 50 path.SetPointCount(nCount);
51 51
52 » for (FX_INT32 i=0; i<nCount; i++) 52 » for (int32_t i=0; i<nCount; i++)
53 { 53 {
54 switch (pPathData[i].type) 54 switch (pPathData[i].type)
55 { 55 {
56 case PWLPT_MOVETO: 56 case PWLPT_MOVETO:
57 path.SetPoint(i, pPathData[i].point.x, pPathData[i].poin t.y, FXPT_MOVETO); 57 path.SetPoint(i, pPathData[i].point.x, pPathData[i].poin t.y, FXPT_MOVETO);
58 break; 58 break;
59 case PWLPT_LINETO: 59 case PWLPT_LINETO:
60 path.SetPoint(i, pPathData[i].point.x, pPathData[i].poin t.y, FXPT_LINETO); 60 path.SetPoint(i, pPathData[i].point.x, pPathData[i].poin t.y, FXPT_LINETO);
61 break; 61 break;
62 case PWLPT_BEZIERTO: 62 case PWLPT_BEZIERTO:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return wrRet; 136 return wrRet;
137 } 137 }
138 138
139 CFX_ByteString CPWL_Utils::GetAP_Check(const CPDF_Rect & crBBox) 139 CFX_ByteString CPWL_Utils::GetAP_Check(const CPDF_Rect & crBBox)
140 { 140 {
141 CFX_ByteTextBuf csAP; 141 CFX_ByteTextBuf csAP;
142 142
143 FX_FLOAT fWidth = crBBox.right - crBBox.left; 143 FX_FLOAT fWidth = crBBox.right - crBBox.left;
144 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 144 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
145 145
146 » const FX_INT32 num = 8; 146 » const int32_t num = 8;
147 147
148 CPWL_Point pts[num*3] = 148 CPWL_Point pts[num*3] =
149 { 149 {
150 //1 150 //1
151 CPWL_Point(0.28f, 0.52f), 151 CPWL_Point(0.28f, 0.52f),
152 CPWL_Point(0.27f, 0.48f), 152 CPWL_Point(0.27f, 0.48f),
153 CPWL_Point(0.29f, 0.40f), 153 CPWL_Point(0.29f, 0.40f),
154 154
155 //2 155 //2
156 CPWL_Point(0.30f, 0.33f), 156 CPWL_Point(0.30f, 0.33f),
(...skipping 24 matching lines...) Expand all
181 CPWL_Point(0.43f, 0.47f), 181 CPWL_Point(0.43f, 0.47f),
182 CPWL_Point(0.40f, 0.47f), 182 CPWL_Point(0.40f, 0.47f),
183 CPWL_Point(0.41f, 0.58f), 183 CPWL_Point(0.41f, 0.58f),
184 184
185 //8 185 //8
186 CPWL_Point(0.40f, 0.60f), 186 CPWL_Point(0.40f, 0.60f),
187 CPWL_Point(0.28f, 0.66f), 187 CPWL_Point(0.28f, 0.66f),
188 CPWL_Point(0.30f, 0.56f) 188 CPWL_Point(0.30f, 0.56f)
189 }; 189 };
190 190
191 » for (FX_INT32 j=0; j<num*3; j++) 191 » for (int32_t j=0; j<num*3; j++)
192 { 192 {
193 pts[j].x *= fWidth; 193 pts[j].x *= fWidth;
194 pts[j].x += crBBox.left; 194 pts[j].x += crBBox.left;
195 195
196 pts[j].y *= fHeight; 196 pts[j].y *= fHeight;
197 pts[j].y += crBBox.bottom; 197 pts[j].y += crBBox.bottom;
198 } 198 }
199 199
200 csAP << pts[0].x << " " << pts[0].y << " m\n"; 200 csAP << pts[0].x << " " << pts[0].y << " m\n";
201 201
202 » for (FX_INT32 i=0; i<num; i++) 202 » for (int32_t i=0; i<num; i++)
203 { 203 {
204 » » FX_INT32 nCur = i*3; 204 » » int32_t nCur = i*3;
205 » » FX_INT32 n1 = i*3 + 1; 205 » » int32_t n1 = i*3 + 1;
206 » » FX_INT32 n2 = i*3 + 2; 206 » » int32_t n2 = i*3 + 2;
207 » » FX_INT32 nNext = (i < num-1 ? (i+1)*3 : 0); 207 » » int32_t nNext = (i < num-1 ? (i+1)*3 : 0);
208 208
209 FX_FLOAT px1 = pts[n1].x - pts[nCur].x; 209 FX_FLOAT px1 = pts[n1].x - pts[nCur].x;
210 FX_FLOAT py1 = pts[n1].y - pts[nCur].y; 210 FX_FLOAT py1 = pts[n1].y - pts[nCur].y;
211 FX_FLOAT px2 = pts[n2].x - pts[nNext].x; 211 FX_FLOAT px2 = pts[n2].x - pts[nNext].x;
212 FX_FLOAT py2 = pts[n2].y - pts[nNext].y; 212 FX_FLOAT py2 = pts[n2].y - pts[nNext].y;
213 213
214 csAP << pts[nCur].x + px1 * PWL_BEZIER << " " << pts[nCur].y + p y1 * PWL_BEZIER << " " 214 csAP << pts[nCur].x + px1 * PWL_BEZIER << " " << pts[nCur].y + p y1 * PWL_BEZIER << " "
215 << pts[nNext].x + px2 * PWL_BEZIER << " " << pts[nNext]. y + py2 * PWL_BEZIER << " " 215 << pts[nNext].x + px2 * PWL_BEZIER << " " << pts[nNext]. y + py2 * PWL_BEZIER << " "
216 << pts[nNext].x << " " << pts[nNext].y << " c\n"; 216 << pts[nNext].x << " " << pts[nNext].y << " c\n";
217 } 217 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 { 314 {
315 CFX_ByteTextBuf csAP; 315 CFX_ByteTextBuf csAP;
316 316
317 FX_FLOAT fRadius = (crBBox.top - crBBox.bottom)/(1+(FX_FLOAT)cos(PWL_PI/ 5.0f)); 317 FX_FLOAT fRadius = (crBBox.top - crBBox.bottom)/(1+(FX_FLOAT)cos(PWL_PI/ 5.0f));
318 CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f,(cr BBox.top + crBBox.bottom) / 2.0f); 318 CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f,(cr BBox.top + crBBox.bottom) / 2.0f);
319 319
320 FX_FLOAT px[5],py[5]; 320 FX_FLOAT px[5],py[5];
321 321
322 FX_FLOAT fAngel = PWL_PI/10.0f; 322 FX_FLOAT fAngel = PWL_PI/10.0f;
323 323
324 » for (FX_INT32 i=0; i<5; i++) 324 » for (int32_t i=0; i<5; i++)
325 { 325 {
326 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel); 326 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel);
327 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel); 327 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel);
328 328
329 fAngel += PWL_PI * 2 / 5.0f; 329 fAngel += PWL_PI * 2 / 5.0f;
330 } 330 }
331 331
332 csAP << px[0] << " " << py[0] << " m\n"; 332 csAP << px[0] << " " << py[0] << " m\n";
333 333
334 » FX_INT32 nNext = 0; 334 » int32_t nNext = 0;
335 » for (FX_INT32 j=0; j<5; j++) 335 » for (int32_t j=0; j<5; j++)
336 { 336 {
337 nNext += 2; 337 nNext += 2;
338 if (nNext >= 5) nNext -= 5; 338 if (nNext >= 5) nNext -= 5;
339 csAP << px[nNext] << " " << py[nNext] << " l\n"; 339 csAP << px[nNext] << " " << py[nNext] << " l\n";
340 } 340 }
341 341
342 return csAP.GetByteString(); 342 return csAP.GetByteString();
343 } 343 }
344 344
345 CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fR otate) 345 CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fR otate)
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 return IFX_Edit::GetSelectAppearanceStream(pEdit,ptOffset,pRange); 469 return IFX_Edit::GetSelectAppearanceStream(pEdit,ptOffset,pRange);
470 } 470 }
471 471
472 static CFX_ByteString GetSquigglyAppearanceStream(FX_FLOAT fStartX, FX_FLOAT fEn dX, FX_FLOAT fY, FX_FLOAT fStep) 472 static CFX_ByteString GetSquigglyAppearanceStream(FX_FLOAT fStartX, FX_FLOAT fEn dX, FX_FLOAT fY, FX_FLOAT fStep)
473 { 473 {
474 CFX_ByteTextBuf sRet; 474 CFX_ByteTextBuf sRet;
475 475
476 sRet << "0 w\n" << fStartX << " " << fY << " m\n"; 476 sRet << "0 w\n" << fStartX << " " << fY << " m\n";
477 477
478 FX_FLOAT fx; 478 FX_FLOAT fx;
479 » FX_INT32 i; 479 » int32_t i;
480 480
481 for (i=1,fx=fStartX+fStep; fx<fEndX; fx+=fStep,i++) 481 for (i=1,fx=fStartX+fStep; fx<fEndX; fx+=fStep,i++)
482 { 482 {
483 sRet << fx << " " << fY + (i&1)*fStep << " l\n"; 483 sRet << fx << " " << fY + (i&1)*fStep << " l\n";
484 } 484 }
485 485
486 sRet << "S\n"; 486 sRet << "S\n";
487 487
488 return sRet.GetByteString(); 488 return sRet.GetByteString();
489 } 489 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 bLatinWord = FALSE; 628 bLatinWord = FALSE;
629 sWord.Empty(); 629 sWord.Empty();
630 } 630 }
631 } 631 }
632 } 632 }
633 633
634 return sRet.GetByteString(); 634 return sRet.GetByteString();
635 } 635 }
636 636
637 CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo ntMap * pFontMap, 637 CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo ntMap * pFontMap,
638 » » » » » » » » » » » » » » const CFX_WideString & sText, FX_INT32 nAlignmen tH, FX_INT32 nAlignmentV, 638 » » » » » » » » » » » » » » const CFX_WideString & sText, int32_t nAlignment H, int32_t nAlignmentV,
639 FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText) 639 FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText)
640 { 640 {
641 CFX_ByteTextBuf sRet; 641 CFX_ByteTextBuf sRet;
642 642
643 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) 643 if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
644 { 644 {
645 pEdit->SetFontMap(pFontMap); 645 pEdit->SetFontMap(pFontMap);
646 pEdit->SetPlateRect(rcBBox); 646 pEdit->SetPlateRect(rcBBox);
647 pEdit->SetAlignmentH(nAlignmentH); 647 pEdit->SetAlignmentH(nAlignmentH);
648 pEdit->SetAlignmentV(nAlignmentV); 648 pEdit->SetAlignmentV(nAlignmentV);
(...skipping 18 matching lines...) Expand all
667 return sRet.GetByteString(); 667 return sRet.GetByteString();
668 } 668 }
669 669
670 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, 670 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,
671 IFX_Edit_FontMap * pFontMap, 671 IFX_Edit_FontMap * pFontMap,
672 CPDF_Stream * pIconStream, 672 CPDF_Stream * pIconStream,
673 CPDF_IconFit & IconFit, 673 CPDF_IconFit & IconFit,
674 const CFX_WideString & sLabel, 674 const CFX_WideString & sLabel,
675 const CPWL_Color & crText, 675 const CPWL_Color & crText,
676 FX_FLOAT fFontSize, 676 FX_FLOAT fFontSize,
677 » » » » » » » » » » » FX_INT32 nLayOut) 677 » » » » » » » » » » » int32_t nLayOut)
678 { 678 {
679 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; 679 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f;
680 680
681 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) 681 if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
682 { 682 {
683 pEdit->SetFontMap(pFontMap); 683 pEdit->SetFontMap(pFontMap);
684 pEdit->SetAlignmentH(1); 684 pEdit->SetAlignmentH(1);
685 pEdit->SetAlignmentV(1); 685 pEdit->SetAlignmentV(1);
686 pEdit->SetMultiLine(FALSE); 686 pEdit->SetMultiLine(FALSE);
687 pEdit->SetAutoReturn(FALSE); 687 pEdit->SetAutoReturn(FALSE);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 sColorStream << color.fColor1 << " " << color.fColor2 << " " << color.fColor3 << " " << color.fColor4 << " " 940 sColorStream << color.fColor1 << " " << color.fColor2 << " " << color.fColor3 << " " << color.fColor4 << " "
941 << (bFillOrStroke ? "k" : "K") << "\n"; 941 << (bFillOrStroke ? "k" : "K") << "\n";
942 break; 942 break;
943 } 943 }
944 944
945 return sColorStream.GetByteString(); 945 return sColorStream.GetByteString();
946 } 946 }
947 947
948 CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f Width, 948 CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT f Width,
949 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CP WL_Color & crRightBottom, 949 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CP WL_Color & crRightBottom,
950 » » » » » » » » » » » » FX_INT32 nStyle, const CPWL_Dash & dash) 950 » » » » » » » » » » » » int32_t nStyle, const CPWL_Dash & dash)
951 { 951 {
952 CFX_ByteTextBuf sAppStream; 952 CFX_ByteTextBuf sAppStream;
953 CFX_ByteString sColor; 953 CFX_ByteString sColor;
954 954
955 FX_FLOAT fLeft = rect.left; 955 FX_FLOAT fLeft = rect.left;
956 FX_FLOAT fRight = rect.right; 956 FX_FLOAT fRight = rect.right;
957 FX_FLOAT fTop = rect.top; 957 FX_FLOAT fTop = rect.top;
958 FX_FLOAT fBottom = rect.bottom; 958 FX_FLOAT fBottom = rect.bottom;
959 959
960 if (fWidth > 0.0f) 960 if (fWidth > 0.0f)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 } 1038 }
1039 1039
1040 sAppStream << "Q\n"; 1040 sAppStream << "Q\n";
1041 } 1041 }
1042 1042
1043 return sAppStream.GetByteString(); 1043 return sAppStream.GetByteString();
1044 } 1044 }
1045 1045
1046 CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F LOAT fWidth, 1046 CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_F LOAT fWidth,
1047 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CP WL_Color & crRightBottom, 1047 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CP WL_Color & crRightBottom,
1048 » » » » » » » » » » » » FX_INT32 nStyle, const CPWL_Dash & dash) 1048 » » » » » » » » » » » » int32_t nStyle, const CPWL_Dash & dash)
1049 { 1049 {
1050 CFX_ByteTextBuf sAppStream; 1050 CFX_ByteTextBuf sAppStream;
1051 CFX_ByteString sColor; 1051 CFX_ByteString sColor;
1052 1052
1053 1053
1054 1054
1055 1055
1056 1056
1057 1057
1058 if (fWidth > 0.0f) 1058 if (fWidth > 0.0f)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1241 }
1242 1242
1243 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CPDF_Rect & rcBBox, const CPW L_Color & crText) 1243 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CPDF_Rect & rcBBox, const CPW L_Color & crText)
1244 { 1244 {
1245 CFX_ByteTextBuf sAP; 1245 CFX_ByteTextBuf sAP;
1246 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils ::GetAP_Star(rcBBox) << "f\nQ\n"; 1246 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils ::GetAP_Star(rcBBox) << "f\nQ\n";
1247 return sAP.GetByteString(); 1247 return sAP.GetByteString();
1248 } 1248 }
1249 1249
1250 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CPDF_Rect & rcBBox, 1250 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CPDF_Rect & rcBBox,
1251 » » » » » » » » » » » » » FX_INT32 nStyle, 1251 » » » » » » » » » » » » » int32_t nStyle,
1252 const CPWL_Color & crText) 1252 const CPWL_Color & crText)
1253 { 1253 {
1254 CPDF_Rect rcCenter = GetCenterSquare(rcBBox); 1254 CPDF_Rect rcCenter = GetCenterSquare(rcBBox);
1255 switch (nStyle) 1255 switch (nStyle)
1256 { 1256 {
1257 default: 1257 default:
1258 case PCS_CHECK: 1258 case PCS_CHECK:
1259 return GetAppStream_Check(rcCenter,crText); 1259 return GetAppStream_Check(rcCenter,crText);
1260 case PCS_CIRCLE: 1260 case PCS_CIRCLE:
1261 return GetAppStream_Circle(ScaleRect(rcCenter,2.0f/3.0f),crText) ; 1261 return GetAppStream_Circle(ScaleRect(rcCenter,2.0f/3.0f),crText) ;
1262 case PCS_CROSS: 1262 case PCS_CROSS:
1263 return GetAppStream_Cross(rcCenter,crText); 1263 return GetAppStream_Cross(rcCenter,crText);
1264 case PCS_DIAMOND: 1264 case PCS_DIAMOND:
1265 return GetAppStream_Diamond(ScaleRect(rcCenter,2.0f/3.0f),crText ); 1265 return GetAppStream_Diamond(ScaleRect(rcCenter,2.0f/3.0f),crText );
1266 case PCS_SQUARE: 1266 case PCS_SQUARE:
1267 return GetAppStream_Square(ScaleRect(rcCenter,2.0f/3.0f),crText) ; 1267 return GetAppStream_Square(ScaleRect(rcCenter,2.0f/3.0f),crText) ;
1268 case PCS_STAR: 1268 case PCS_STAR:
1269 return GetAppStream_Star(ScaleRect(rcCenter,2.0f/3.0f),crText); 1269 return GetAppStream_Star(ScaleRect(rcCenter,2.0f/3.0f),crText);
1270 } 1270 }
1271 } 1271 }
1272 1272
1273 CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CPDF_Rect & rcBBox, 1273 CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CPDF_Rect & rcBBox,
1274 » » » » » » » » » » » » » FX_INT32 nStyle, 1274 » » » » » » » » » » » » » int32_t nStyle,
1275 const CPWL_Color & crText) 1275 const CPWL_Color & crText)
1276 { 1276 {
1277 CPDF_Rect rcCenter = GetCenterSquare(rcBBox); 1277 CPDF_Rect rcCenter = GetCenterSquare(rcBBox);
1278 switch (nStyle) 1278 switch (nStyle)
1279 { 1279 {
1280 default: 1280 default:
1281 case PCS_CHECK: 1281 case PCS_CHECK:
1282 return GetAppStream_Check(rcCenter,crText); 1282 return GetAppStream_Check(rcCenter,crText);
1283 case PCS_CIRCLE: 1283 case PCS_CIRCLE:
1284 return GetAppStream_Circle(ScaleRect(rcCenter,1.0f/2.0f),crText) ; 1284 return GetAppStream_Circle(ScaleRect(rcCenter,1.0f/2.0f),crText) ;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 { 1369 {
1370 if (dR<0 || dR>1 || dG<0 || dG>1 || dB<0 || dB>1) 1370 if (dR<0 || dR>1 || dG<0 || dG>1 || dB<0 || dB>1)
1371 return; 1371 return;
1372 1372
1373 dC = 1.0f - dR; 1373 dC = 1.0f - dR;
1374 dM = 1.0f - dG; 1374 dM = 1.0f - dG;
1375 dY = 1.0f - dB; 1375 dY = 1.0f - dB;
1376 dK = FX_MIN(dC, FX_MIN(dM, dY)); 1376 dK = FX_MIN(dC, FX_MIN(dM, dY));
1377 } 1377 }
1378 1378
1379 void CPWL_Utils::PWLColorToARGB(const CPWL_Color& color, FX_INT32& alpha, FX_FLO AT& red, FX_FLOAT& green, FX_FLOAT& blue) 1379 void CPWL_Utils::PWLColorToARGB(const CPWL_Color& color, int32_t& alpha, FX_FLOA T& red, FX_FLOAT& green, FX_FLOAT& blue)
1380 { 1380 {
1381 switch (color.nColorType) 1381 switch (color.nColorType)
1382 { 1382 {
1383 case COLORTYPE_TRANSPARENT: 1383 case COLORTYPE_TRANSPARENT:
1384 { 1384 {
1385 alpha = 0; 1385 alpha = 0;
1386 } 1386 }
1387 break; 1387 break;
1388 case COLORTYPE_GRAY: 1388 case COLORTYPE_GRAY:
1389 { 1389 {
1390 ConvertGRAY2RGB(color.fColor1, red, green, blue); 1390 ConvertGRAY2RGB(color.fColor1, red, green, blue);
1391 } 1391 }
1392 break; 1392 break;
1393 case COLORTYPE_RGB: 1393 case COLORTYPE_RGB:
1394 { 1394 {
1395 red = color.fColor1; 1395 red = color.fColor1;
1396 green = color.fColor2; 1396 green = color.fColor2;
1397 blue = color.fColor3; 1397 blue = color.fColor3;
1398 } 1398 }
1399 break; 1399 break;
1400 case COLORTYPE_CMYK: 1400 case COLORTYPE_CMYK:
1401 { 1401 {
1402 ConvertCMYK2RGB(color.fColor1, color.fColor2, color.fCol or3, color.fColor4, 1402 ConvertCMYK2RGB(color.fColor1, color.fColor2, color.fCol or3, color.fColor4,
1403 red, green, blue); 1403 red, green, blue);
1404 } 1404 }
1405 break; 1405 break;
1406 } 1406 }
1407 } 1407 }
1408 1408
1409 FX_COLORREF CPWL_Utils::PWLColorToFXColor(const CPWL_Color& color, FX_INT32 nTra nsparancy) 1409 FX_COLORREF CPWL_Utils::PWLColorToFXColor(const CPWL_Color& color, int32_t nTran sparancy)
1410 { 1410 {
1411 » FX_INT32 nAlpha = nTransparancy; 1411 » int32_t nAlpha = nTransparancy;
1412 FX_FLOAT dRed = 0; 1412 FX_FLOAT dRed = 0;
1413 FX_FLOAT dGreen = 0; 1413 FX_FLOAT dGreen = 0;
1414 FX_FLOAT dBlue = 0; 1414 FX_FLOAT dBlue = 0;
1415 1415
1416 PWLColorToARGB(color, nAlpha, dRed, dGreen, dBlue); 1416 PWLColorToARGB(color, nAlpha, dRed, dGreen, dBlue);
1417 1417
1418 » return ArgbEncode(nAlpha, (FX_INT32)(dRed*255), (FX_INT32)(dGreen*255), (FX_INT32)(dBlue*255)); 1418 » return ArgbEncode(nAlpha, (int32_t)(dRed*255), (int32_t)(dGreen*255), (i nt32_t)(dBlue*255));
1419 } 1419 }
1420 1420
1421 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce,const CPDF_Rect & rect, 1421 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce,const CPDF_Rect & rect,
1422 const FX_COLORREF & co lor) 1422 const FX_COLORREF & co lor)
1423 { 1423 {
1424 CFX_PathData path; 1424 CFX_PathData path;
1425 CPDF_Rect rcTemp(rect); 1425 CPDF_Rect rcTemp(rect);
1426 path.AppendRect(rcTemp.left,rcTemp.bottom,rcTemp.right,rcTemp.top); 1426 path.AppendRect(rcTemp.left,rcTemp.bottom,rcTemp.right,rcTemp.top);
1427 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_WINDING); 1427 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_WINDING);
1428 } 1428 }
1429 1429
1430 void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce, 1430 void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce,
1431 » » » » » » » const CPDF_Point* pPts, FX_INT32 nCount, const FX_COLORREF& color) 1431 » » » » » » » const CPDF_Point* pPts, int32_t nCount, const FX_COLORREF& color)
1432 { 1432 {
1433 CFX_PathData path; 1433 CFX_PathData path;
1434 path.SetPointCount(nCount); 1434 path.SetPointCount(nCount);
1435 1435
1436 path.SetPoint(0, pPts[0].x, pPts[0].y, FXPT_MOVETO); 1436 path.SetPoint(0, pPts[0].x, pPts[0].y, FXPT_MOVETO);
1437 » for (FX_INT32 i=1; i<nCount; i++) 1437 » for (int32_t i=1; i<nCount; i++)
1438 path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO); 1438 path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO);
1439 1439
1440 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_ALTERNATE) ; 1440 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_ALTERNATE) ;
1441 } 1441 }
1442 1442
1443 void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2De vice,const CPDF_Rect & rect, 1443 void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2De vice,const CPDF_Rect & rect,
1444 const FX_COLORREF & co lor, FX_FLOAT fWidth) 1444 const FX_COLORREF & co lor, FX_FLOAT fWidth)
1445 { 1445 {
1446 CFX_PathData path; 1446 CFX_PathData path;
1447 CPDF_Rect rcTemp(rect); 1447 CPDF_Rect rcTemp(rect);
(...skipping 13 matching lines...) Expand all
1461 path.SetPoint(0, ptMoveTo.x, ptMoveTo.y, FXPT_MOVETO); 1461 path.SetPoint(0, ptMoveTo.x, ptMoveTo.y, FXPT_MOVETO);
1462 path.SetPoint(1, ptLineTo.x, ptLineTo.y, FXPT_LINETO); 1462 path.SetPoint(1, ptLineTo.x, ptLineTo.y, FXPT_LINETO);
1463 1463
1464 CFX_GraphStateData gsd; 1464 CFX_GraphStateData gsd;
1465 gsd.m_LineWidth = fWidth; 1465 gsd.m_LineWidth = fWidth;
1466 1466
1467 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE) ; 1467 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE) ;
1468 } 1468 }
1469 1469
1470 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce,const CPDF_Rect & rect, 1470 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce,const CPDF_Rect & rect,
1471 » » » » » » » const CPWL_Color & col or, FX_INT32 nTransparancy) 1471 » » » » » » » const CPWL_Color & col or, int32_t nTransparancy)
1472 { 1472 {
1473 CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rect,PWLColorToFXColor(col or,nTransparancy)); 1473 CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rect,PWLColorToFXColor(col or,nTransparancy));
1474 } 1474 }
1475 1475
1476 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device , 1476 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device ,
1477 FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rec t rect, 1477 FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rec t rect,
1478 » » » » » » » » » » » » » » FX_INT32 nTransparancy, FX_INT32 nStartGray, FX_ INT32 nEndGray) 1478 » » » » » » » » » » » » » » int32_t nTransparancy, int32_t nStartGray, int32 _t nEndGray)
1479 { 1479 {
1480 FX_FLOAT fStepGray = 1.0f; 1480 FX_FLOAT fStepGray = 1.0f;
1481 1481
1482 if (bVertical) 1482 if (bVertical)
1483 { 1483 {
1484 fStepGray = (nEndGray - nStartGray) / rect.Height(); 1484 fStepGray = (nEndGray - nStartGray) / rect.Height();
1485 1485
1486 for (FX_FLOAT fy=rect.bottom+0.5f; fy<=rect.top-0.5f; fy+=1.0f) 1486 for (FX_FLOAT fy=rect.bottom+0.5f; fy<=rect.top-0.5f; fy+=1.0f)
1487 { 1487 {
1488 » » » FX_INT32 nGray = nStartGray + (FX_INT32)(fStepGray * (fy -rect.bottom)); 1488 » » » int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy-r ect.bottom));
1489 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_P oint(rect.left, fy), 1489 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_P oint(rect.left, fy),
1490 CPDF_Point(rect.right, fy), ArgbEncode(nTranspar ancy, nGray, nGray, nGray), 1.5f); 1490 CPDF_Point(rect.right, fy), ArgbEncode(nTranspar ancy, nGray, nGray, nGray), 1.5f);
1491 } 1491 }
1492 } 1492 }
1493 1493
1494 if (bHorizontal) 1494 if (bHorizontal)
1495 { 1495 {
1496 fStepGray = (nEndGray - nStartGray) / rect.Width(); 1496 fStepGray = (nEndGray - nStartGray) / rect.Width();
1497 1497
1498 for (FX_FLOAT fx=rect.left+0.5f; fx<=rect.right-0.5f; fx+=1.0f) 1498 for (FX_FLOAT fx=rect.left+0.5f; fx<=rect.right-0.5f; fx+=1.0f)
1499 { 1499 {
1500 » » » FX_INT32 nGray = nStartGray + (FX_INT32)(fStepGray * (fx -rect.left)); 1500 » » » int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx-r ect.left));
1501 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_P oint(fx, rect.bottom), 1501 CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_P oint(fx, rect.bottom),
1502 CPDF_Point(fx, rect.top), ArgbEncode(nTransparan cy, nGray, nGray, nGray), 1.5f); 1502 CPDF_Point(fx, rect.top), ArgbEncode(nTransparan cy, nGray, nGray, nGray), 1.5f);
1503 } 1503 }
1504 } 1504 }
1505 } 1505 }
1506 1506
1507 void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device , 1507 void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device ,
1508 const CPDF_Rect & rect, FX_FLOAT fWidth, 1508 const CPDF_Rect & rect, FX_FLOAT fWidth,
1509 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CP WL_Color & crRightBottom, 1509 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CP WL_Color & crRightBottom,
1510 » » » » » » » » » » » » FX_INT32 nStyle, const CPWL_Dash & dash, FX_INT32 nTransparancy) 1510 » » » » » » » » » » » » int32_t nStyle, const CPWL_Dash & dash, int32_t nTransparancy)
1511 { 1511 {
1512 FX_FLOAT fLeft = rect.left; 1512 FX_FLOAT fLeft = rect.left;
1513 FX_FLOAT fRight = rect.right; 1513 FX_FLOAT fRight = rect.right;
1514 FX_FLOAT fTop = rect.top; 1514 FX_FLOAT fTop = rect.top;
1515 FX_FLOAT fBottom = rect.bottom; 1515 FX_FLOAT fBottom = rect.bottom;
1516 1516
1517 if (fWidth > 0.0f) 1517 if (fWidth > 0.0f)
1518 { 1518 {
1519 FX_FLOAT fHalfWidth = fWidth / 2.0f; 1519 FX_FLOAT fHalfWidth = fWidth / 2.0f;
1520 1520
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 } 1615 }
1616 } 1616 }
1617 } 1617 }
1618 1618
1619 static void AddSquigglyPath(CFX_PathData & PathData, FX_FLOAT fStartX, FX_FLOAT fEndX, FX_FLOAT fY, FX_FLOAT fStep) 1619 static void AddSquigglyPath(CFX_PathData & PathData, FX_FLOAT fStartX, FX_FLOAT fEndX, FX_FLOAT fY, FX_FLOAT fStep)
1620 { 1620 {
1621 PathData.AddPointCount(1); 1621 PathData.AddPointCount(1);
1622 PathData.SetPoint(PathData.GetPointCount() - 1, fStartX, fY, FXPT_MOVETO ); 1622 PathData.SetPoint(PathData.GetPointCount() - 1, fStartX, fY, FXPT_MOVETO );
1623 1623
1624 FX_FLOAT fx; 1624 FX_FLOAT fx;
1625 » FX_INT32 i; 1625 » int32_t i;
1626 1626
1627 for (i=1,fx=fStartX+fStep; fx<fEndX; fx+=fStep,i++) 1627 for (i=1,fx=fStartX+fStep; fx<fEndX; fx+=fStep,i++)
1628 { 1628 {
1629 PathData.AddPointCount(1); 1629 PathData.AddPointCount(1);
1630 PathData.SetPoint(PathData.GetPointCount() - 1, fx, fY + (i&1)*f Step, FXPT_LINETO); 1630 PathData.SetPoint(PathData.GetPointCount() - 1, fx, fY + (i&1)*f Step, FXPT_LINETO);
1631 } 1631 }
1632 } 1632 }
1633 1633
1634 static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV T_WordRange& wrWord) 1634 static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPV T_WordRange& wrWord)
1635 { 1635 {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 1706
1707 CFX_PathData pathSpell; 1707 CFX_PathData pathSpell;
1708 1708
1709 pDevice->SaveState(); 1709 pDevice->SaveState();
1710 1710
1711 if (!rcClip.IsEmpty()) 1711 if (!rcClip.IsEmpty())
1712 { 1712 {
1713 CPDF_Rect rcTemp = rcClip; 1713 CPDF_Rect rcTemp = rcClip;
1714 pUser2Device->TransformRect(rcTemp); 1714 pUser2Device->TransformRect(rcTemp);
1715 FX_RECT rcDevClip; 1715 FX_RECT rcDevClip;
1716 » » rcDevClip.left = (FX_INT32)rcTemp.left; 1716 » » rcDevClip.left = (int32_t)rcTemp.left;
1717 » » rcDevClip.right = (FX_INT32)rcTemp.right; 1717 » » rcDevClip.right = (int32_t)rcTemp.right;
1718 » » rcDevClip.top = (FX_INT32)rcTemp.top; 1718 » » rcDevClip.top = (int32_t)rcTemp.top;
1719 » » rcDevClip.bottom = (FX_INT32)rcTemp.bottom; 1719 » » rcDevClip.bottom = (int32_t)rcTemp.bottom;
1720 pDevice->SetClip_Rect(&rcDevClip); 1720 pDevice->SetClip_Rect(&rcDevClip);
1721 } 1721 }
1722 1722
1723 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) 1723 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator())
1724 { 1724 {
1725 if (pEdit->GetFontMap()) 1725 if (pEdit->GetFontMap())
1726 { 1726 {
1727 if (pRange) 1727 if (pRange)
1728 pIterator->SetAt(pRange->BeginPos); 1728 pIterator->SetAt(pRange->BeginPos);
1729 else 1729 else
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 crRet.fColor1 = 1.0f - crRet.fColor1; 1841 crRet.fColor1 = 1.0f - crRet.fColor1;
1842 crRet.fColor2 = 1.0f - crRet.fColor2; 1842 crRet.fColor2 = 1.0f - crRet.fColor2;
1843 crRet.fColor3 = 1.0f - crRet.fColor3; 1843 crRet.fColor3 = 1.0f - crRet.fColor3;
1844 crRet.fColor4 = 1.0f - crRet.fColor4; 1844 crRet.fColor4 = 1.0f - crRet.fColor4;
1845 break; 1845 break;
1846 } 1846 }
1847 1847
1848 return crRet; 1848 return crRet;
1849 } 1849 }
1850 1850
1851 CFX_ByteString CPWL_Utils::GetIconAppStream(FX_INT32 nType, const CPDF_Rect& rec t, const CPWL_Color& crFill, 1851 CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CPDF_Rect& rect , const CPWL_Color& crFill,
1852 const CPWL_Color& crStroke) 1852 const CPWL_Color& crStroke)
1853 { 1853 {
1854 CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALS E); 1854 CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALS E);
1855 sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE); 1855 sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE);
1856 1856
1857 CFX_ByteString sPath; 1857 CFX_ByteString sPath;
1858 CFX_PathData path; 1858 CFX_PathData path;
1859 1859
1860 switch (nType) 1860 switch (nType)
1861 { 1861 {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 sAppStream += sPath; 1924 sAppStream += sPath;
1925 if (crStroke.nColorType != COLORTYPE_TRANSPARENT) 1925 if (crStroke.nColorType != COLORTYPE_TRANSPARENT)
1926 sAppStream += "B*\n"; 1926 sAppStream += "B*\n";
1927 else 1927 else
1928 sAppStream += "f*\n"; 1928 sAppStream += "f*\n";
1929 1929
1930 return sAppStream; 1930 return sAppStream;
1931 } 1931 }
1932 1932
1933 void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser 2Device, 1933 void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser 2Device,
1934 » » » » » » FX_INT32 nType, const CPDF_Rect & rect, const CPWL_Color& crFill, const CPWL_Color& crStroke, const FX_INT32 nTr ansparancy) 1934 » » » » » » int32_t nType, const CPDF_Rect & rect, const CPWL_Color& crFill, const CPWL_Color& crStroke, const int32_t nTran sparancy)
1935 { 1935 {
1936 CFX_GraphStateData gsd; 1936 CFX_GraphStateData gsd;
1937 gsd.m_LineWidth = 1.0f; 1937 gsd.m_LineWidth = 1.0f;
1938 1938
1939 CFX_ByteString sPath; 1939 CFX_ByteString sPath;
1940 CFX_PathData path; 1940 CFX_PathData path;
1941 1941
1942 switch (nType) 1942 switch (nType)
1943 { 1943 {
1944 case PWL_ICONTYPE_CHECKMARK: 1944 case PWL_ICONTYPE_CHECKMARK:
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 FX_FLOAT fLongRadius = (crBBox.top - crBBox.bottom)/(1+(FX_FLOAT)cos(PWL _PI/5.0f)); 2470 FX_FLOAT fLongRadius = (crBBox.top - crBBox.bottom)/(1+(FX_FLOAT)cos(PWL _PI/5.0f));
2471 fLongRadius = fLongRadius * 0.7f; 2471 fLongRadius = fLongRadius * 0.7f;
2472 FX_FLOAT fShortRadius = fLongRadius * 0.55f; 2472 FX_FLOAT fShortRadius = fLongRadius * 0.55f;
2473 CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f,(cr BBox.top + crBBox.bottom) / 2.0f); 2473 CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f,(cr BBox.top + crBBox.bottom) / 2.0f);
2474 2474
2475 FX_FLOAT px1[5], py1[5]; 2475 FX_FLOAT px1[5], py1[5];
2476 FX_FLOAT px2[5], py2[5]; 2476 FX_FLOAT px2[5], py2[5];
2477 2477
2478 FX_FLOAT fAngel = PWL_PI/10.0f; 2478 FX_FLOAT fAngel = PWL_PI/10.0f;
2479 2479
2480 » for (FX_INT32 i=0; i<5; i++) 2480 » for (int32_t i=0; i<5; i++)
2481 { 2481 {
2482 px1[i] = ptCenter.x + fLongRadius * (FX_FLOAT)cos(fAngel); 2482 px1[i] = ptCenter.x + fLongRadius * (FX_FLOAT)cos(fAngel);
2483 py1[i] = ptCenter.y + fLongRadius * (FX_FLOAT)sin(fAngel); 2483 py1[i] = ptCenter.y + fLongRadius * (FX_FLOAT)sin(fAngel);
2484 2484
2485 fAngel += PWL_PI * 2 / 5.0f; 2485 fAngel += PWL_PI * 2 / 5.0f;
2486 } 2486 }
2487 2487
2488 fAngel = PWL_PI/5.0f + PWL_PI/10.0f; 2488 fAngel = PWL_PI/5.0f + PWL_PI/10.0f;
2489 2489
2490 » for (FX_INT32 j=0; j<5; j++) 2490 » for (int32_t j=0; j<5; j++)
2491 { 2491 {
2492 px2[j] = ptCenter.x + fShortRadius * (FX_FLOAT)cos(fAngel); 2492 px2[j] = ptCenter.x + fShortRadius * (FX_FLOAT)cos(fAngel);
2493 py2[j] = ptCenter.y + fShortRadius * (FX_FLOAT)sin(fAngel); 2493 py2[j] = ptCenter.y + fShortRadius * (FX_FLOAT)sin(fAngel);
2494 2494
2495 fAngel += PWL_PI * 2 / 5.0f; 2495 fAngel += PWL_PI * 2 / 5.0f;
2496 } 2496 }
2497 2497
2498 CPWL_PathData PathArray[11]; 2498 CPWL_PathData PathArray[11];
2499 PathArray[0] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_MOVETO); 2499 PathArray[0] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_MOVETO);
2500 PathArray[1] = CPWL_PathData(CPWL_Point(px2[0], py2[0]), PWLPT_LINETO); 2500 PathArray[1] = CPWL_PathData(CPWL_Point(px2[0], py2[0]), PWLPT_LINETO);
2501 2501
2502 » for(FX_INT32 k = 0; k < 4; k++) 2502 » for(int32_t k = 0; k < 4; k++)
2503 { 2503 {
2504 PathArray[(k+1)*2] = CPWL_PathData(CPWL_Point(px1[k+1], py1[k+1] ), PWLPT_LINETO); 2504 PathArray[(k+1)*2] = CPWL_PathData(CPWL_Point(px1[k+1], py1[k+1] ), PWLPT_LINETO);
2505 PathArray[(k+1)*2 + 1] = CPWL_PathData(CPWL_Point(px2[k+1], py2[ k+1]), PWLPT_LINETO); 2505 PathArray[(k+1)*2 + 1] = CPWL_PathData(CPWL_Point(px2[k+1], py2[ k+1]), PWLPT_LINETO);
2506 } 2506 }
2507 2507
2508 PathArray[10] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_LINETO); 2508 PathArray[10] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_LINETO);
2509 2509
2510 if(type == PWLPT_STREAM) 2510 if(type == PWLPT_STREAM)
2511 sPathData = GetAppStreamFromArray(PathArray, 11); 2511 sPathData = GetAppStreamFromArray(PathArray, 11);
2512 else 2512 else
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.top -fOutHeight*0.04f), PWLPT_LINETO), 2788 CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.top -fOutHeight*0.04f), PWLPT_LINETO),
2789 */ 2789 */
2790 }; 2790 };
2791 2791
2792 if(type == PWLPT_STREAM) 2792 if(type == PWLPT_STREAM)
2793 sPathData = GetAppStreamFromArray(PathArray, 23); 2793 sPathData = GetAppStreamFromArray(PathArray, 23);
2794 else 2794 else
2795 GetPathDataFromArray(path, PathArray, 23); 2795 GetPathDataFromArray(path, PathArray, 23);
2796 } 2796 }
2797 2797
2798 void CPWL_Color::ConvertColorType(FX_INT32 nColorType) 2798 void CPWL_Color::ConvertColorType(int32_t nColorType)
2799 { 2799 {
2800 switch (this->nColorType) 2800 switch (this->nColorType)
2801 { 2801 {
2802 case COLORTYPE_TRANSPARENT: 2802 case COLORTYPE_TRANSPARENT:
2803 break; 2803 break;
2804 case COLORTYPE_GRAY: 2804 case COLORTYPE_GRAY:
2805 switch (nColorType) 2805 switch (nColorType)
2806 { 2806 {
2807 case COLORTYPE_RGB: 2807 case COLORTYPE_RGB:
2808 CPWL_Utils::ConvertGRAY2RGB(this->fColor1, this->fColor1 , this->fColor2, this->fColor3); 2808 CPWL_Utils::ConvertGRAY2RGB(this->fColor1, this->fColor1 , this->fColor2, this->fColor3);
(...skipping 23 matching lines...) Expand all
2832 case COLORTYPE_RGB: 2832 case COLORTYPE_RGB:
2833 CPWL_Utils::ConvertCMYK2RGB(this->fColor1, this->fColor2 , this->fColor3, this->fColor4, this->fColor1, this->fColor2, this->fColor3); 2833 CPWL_Utils::ConvertCMYK2RGB(this->fColor1, this->fColor2 , this->fColor3, this->fColor4, this->fColor1, this->fColor2, this->fColor3);
2834 break; 2834 break;
2835 } 2835 }
2836 break; 2836 break;
2837 } 2837 }
2838 this->nColorType = nColorType; 2838 this->nColorType = nColorType;
2839 } 2839 }
2840 2840
2841 2841
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Signature.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Wnd.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698