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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Utils.cpp

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. 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
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_SpecialButton.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 "fpdfsdk/include/pdfwindow/PWL_Utils.h" 7 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 case PWLPT_BEZIERTO: 62 case PWLPT_BEZIERTO:
63 path.SetPoint(i, pPathData[i].point.x, pPathData[i].point.y, 63 path.SetPoint(i, pPathData[i].point.x, pPathData[i].point.y,
64 FXPT_BEZIERTO); 64 FXPT_BEZIERTO);
65 break; 65 break;
66 default: 66 default:
67 break; 67 break;
68 } 68 }
69 } 69 }
70 } 70 }
71 71
72 CPDF_Rect CPWL_Utils::MaxRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2) { 72 CFX_FloatRect CPWL_Utils::MaxRect(const CFX_FloatRect& rect1,
73 CPDF_Rect rcRet; 73 const CFX_FloatRect& rect2) {
74 CFX_FloatRect rcRet;
74 75
75 rcRet.left = PWL_MIN(rect1.left, rect2.left); 76 rcRet.left = PWL_MIN(rect1.left, rect2.left);
76 rcRet.bottom = PWL_MIN(rect1.bottom, rect2.bottom); 77 rcRet.bottom = PWL_MIN(rect1.bottom, rect2.bottom);
77 rcRet.right = PWL_MAX(rect1.right, rect2.right); 78 rcRet.right = PWL_MAX(rect1.right, rect2.right);
78 rcRet.top = PWL_MAX(rect1.top, rect2.top); 79 rcRet.top = PWL_MAX(rect1.top, rect2.top);
79 80
80 return rcRet; 81 return rcRet;
81 } 82 }
82 83
83 CPDF_Rect CPWL_Utils::OffsetRect(const CPDF_Rect& rect, 84 CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect,
84 FX_FLOAT x, 85 FX_FLOAT x,
85 FX_FLOAT y) { 86 FX_FLOAT y) {
86 return CPDF_Rect(rect.left + x, rect.bottom + y, rect.right + x, 87 return CFX_FloatRect(rect.left + x, rect.bottom + y, rect.right + x,
87 rect.top + y); 88 rect.top + y);
88 } 89 }
89 90
90 FX_BOOL CPWL_Utils::ContainsRect(const CPDF_Rect& rcParent, 91 FX_BOOL CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent,
91 const CPDF_Rect& rcChild) { 92 const CFX_FloatRect& rcChild) {
92 return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom && 93 return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom &&
93 rcChild.right <= rcParent.right && rcChild.top <= rcParent.top; 94 rcChild.right <= rcParent.right && rcChild.top <= rcParent.top;
94 } 95 }
95 96
96 FX_BOOL CPWL_Utils::IntersectRect(const CPDF_Rect& rect1, 97 FX_BOOL CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1,
97 const CPDF_Rect& rect2) { 98 const CFX_FloatRect& rect2) {
98 FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left; 99 FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left;
99 FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right; 100 FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right;
100 FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom; 101 FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom;
101 FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top; 102 FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top;
102 103
103 return left < right && bottom < top; 104 return left < right && bottom < top;
104 } 105 }
105 106
106 CPDF_Point CPWL_Utils::OffsetPoint(const CPDF_Point& point, 107 CFX_FloatPoint CPWL_Utils::OffsetPoint(const CFX_FloatPoint& point,
107 FX_FLOAT x, 108 FX_FLOAT x,
108 FX_FLOAT y) { 109 FX_FLOAT y) {
109 return CPDF_Point(point.x + x, point.y + y); 110 return CFX_FloatPoint(point.x + x, point.y + y);
110 } 111 }
111 112
112 CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1, 113 CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange& wr1,
113 const CPVT_WordRange& wr2) { 114 const CPVT_WordRange& wr2) {
114 CPVT_WordRange wrRet; 115 CPVT_WordRange wrRet;
115 116
116 if (wr2.EndPos.WordCmp(wr1.BeginPos) < 0 || 117 if (wr2.EndPos.WordCmp(wr1.BeginPos) < 0 ||
117 wr2.BeginPos.WordCmp(wr1.EndPos) > 0) 118 wr2.BeginPos.WordCmp(wr1.EndPos) > 0)
118 return wrRet; 119 return wrRet;
119 if (wr1.EndPos.WordCmp(wr2.BeginPos) < 0 || 120 if (wr1.EndPos.WordCmp(wr2.BeginPos) < 0 ||
120 wr1.BeginPos.WordCmp(wr2.EndPos) > 0) 121 wr1.BeginPos.WordCmp(wr2.EndPos) > 0)
121 return wrRet; 122 return wrRet;
122 123
123 if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) { 124 if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) {
124 wrRet.BeginPos = wr2.BeginPos; 125 wrRet.BeginPos = wr2.BeginPos;
125 } else { 126 } else {
126 wrRet.BeginPos = wr1.BeginPos; 127 wrRet.BeginPos = wr1.BeginPos;
127 } 128 }
128 129
129 if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) { 130 if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) {
130 wrRet.EndPos = wr1.EndPos; 131 wrRet.EndPos = wr1.EndPos;
131 } else { 132 } else {
132 wrRet.EndPos = wr2.EndPos; 133 wrRet.EndPos = wr2.EndPos;
133 } 134 }
134 135
135 return wrRet; 136 return wrRet;
136 } 137 }
137 138
138 CFX_ByteString CPWL_Utils::GetAP_Check(const CPDF_Rect& crBBox) { 139 CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) {
139 const FX_FLOAT fWidth = crBBox.right - crBBox.left; 140 const FX_FLOAT fWidth = crBBox.right - crBBox.left;
140 const FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 141 const FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
141 142
142 CPWL_Point pts[8][3] = {{CPWL_Point(0.28f, 0.52f), CPWL_Point(0.27f, 0.48f), 143 CPWL_Point pts[8][3] = {{CPWL_Point(0.28f, 0.52f), CPWL_Point(0.27f, 0.48f),
143 CPWL_Point(0.29f, 0.40f)}, 144 CPWL_Point(0.29f, 0.40f)},
144 {CPWL_Point(0.30f, 0.33f), CPWL_Point(0.31f, 0.29f), 145 {CPWL_Point(0.30f, 0.33f), CPWL_Point(0.31f, 0.29f),
145 CPWL_Point(0.31f, 0.28f)}, 146 CPWL_Point(0.31f, 0.28f)},
146 {CPWL_Point(0.39f, 0.28f), CPWL_Point(0.49f, 0.29f), 147 {CPWL_Point(0.39f, 0.28f), CPWL_Point(0.49f, 0.29f),
147 CPWL_Point(0.77f, 0.67f)}, 148 CPWL_Point(0.77f, 0.67f)},
148 {CPWL_Point(0.76f, 0.68f), CPWL_Point(0.78f, 0.69f), 149 {CPWL_Point(0.76f, 0.68f), CPWL_Point(0.78f, 0.69f),
(...skipping 28 matching lines...) Expand all
177 csAP << pts[i][0].x + px1 * FX_BEZIER << " " 178 csAP << pts[i][0].x + px1 * FX_BEZIER << " "
178 << pts[i][0].y + py1 * FX_BEZIER << " " 179 << pts[i][0].y + py1 * FX_BEZIER << " "
179 << pts[nNext][0].x + px2 * FX_BEZIER << " " 180 << pts[nNext][0].x + px2 * FX_BEZIER << " "
180 << pts[nNext][0].y + py2 * FX_BEZIER << " " << pts[nNext][0].x << " " 181 << pts[nNext][0].y + py2 * FX_BEZIER << " " << pts[nNext][0].x << " "
181 << pts[nNext][0].y << " c\n"; 182 << pts[nNext][0].y << " c\n";
182 } 183 }
183 184
184 return csAP.GetByteString(); 185 return csAP.GetByteString();
185 } 186 }
186 187
187 CFX_ByteString CPWL_Utils::GetAP_Circle(const CPDF_Rect& crBBox) { 188 CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) {
188 CFX_ByteTextBuf csAP; 189 CFX_ByteTextBuf csAP;
189 190
190 FX_FLOAT fWidth = crBBox.right - crBBox.left; 191 FX_FLOAT fWidth = crBBox.right - crBBox.left;
191 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 192 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
192 193
193 CPDF_Point pt1(crBBox.left, crBBox.bottom + fHeight / 2); 194 CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2);
194 CPDF_Point pt2(crBBox.left + fWidth / 2, crBBox.top); 195 CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top);
195 CPDF_Point pt3(crBBox.right, crBBox.bottom + fHeight / 2); 196 CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2);
196 CPDF_Point pt4(crBBox.left + fWidth / 2, crBBox.bottom); 197 CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom);
197 198
198 csAP << pt1.x << " " << pt1.y << " m\n"; 199 csAP << pt1.x << " " << pt1.y << " m\n";
199 200
200 FX_FLOAT px = pt2.x - pt1.x; 201 FX_FLOAT px = pt2.x - pt1.x;
201 FX_FLOAT py = pt2.y - pt1.y; 202 FX_FLOAT py = pt2.y - pt1.y;
202 203
203 csAP << pt1.x << " " << pt1.y + py * FX_BEZIER << " " 204 csAP << pt1.x << " " << pt1.y + py * FX_BEZIER << " "
204 << pt2.x - px * FX_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y 205 << pt2.x - px * FX_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y
205 << " c\n"; 206 << " c\n";
206 207
(...skipping 12 matching lines...) Expand all
219 220
220 px = pt4.x - pt1.x; 221 px = pt4.x - pt1.x;
221 py = pt1.y - pt4.y; 222 py = pt1.y - pt4.y;
222 223
223 csAP << pt4.x - px * FX_BEZIER << " " << pt4.y << " " << pt1.x << " " 224 csAP << pt4.x - px * FX_BEZIER << " " << pt4.y << " " << pt1.x << " "
224 << pt1.y - py * FX_BEZIER << " " << pt1.x << " " << pt1.y << " c\n"; 225 << pt1.y - py * FX_BEZIER << " " << pt1.x << " " << pt1.y << " c\n";
225 226
226 return csAP.GetByteString(); 227 return csAP.GetByteString();
227 } 228 }
228 229
229 CFX_ByteString CPWL_Utils::GetAP_Cross(const CPDF_Rect& crBBox) { 230 CFX_ByteString CPWL_Utils::GetAP_Cross(const CFX_FloatRect& crBBox) {
230 CFX_ByteTextBuf csAP; 231 CFX_ByteTextBuf csAP;
231 232
232 csAP << crBBox.left << " " << crBBox.top << " m\n"; 233 csAP << crBBox.left << " " << crBBox.top << " m\n";
233 csAP << crBBox.right << " " << crBBox.bottom << " l\n"; 234 csAP << crBBox.right << " " << crBBox.bottom << " l\n";
234 csAP << crBBox.left << " " << crBBox.bottom << " m\n"; 235 csAP << crBBox.left << " " << crBBox.bottom << " m\n";
235 csAP << crBBox.right << " " << crBBox.top << " l\n"; 236 csAP << crBBox.right << " " << crBBox.top << " l\n";
236 237
237 return csAP.GetByteString(); 238 return csAP.GetByteString();
238 } 239 }
239 240
240 CFX_ByteString CPWL_Utils::GetAP_Diamond(const CPDF_Rect& crBBox) { 241 CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) {
241 CFX_ByteTextBuf csAP; 242 CFX_ByteTextBuf csAP;
242 243
243 FX_FLOAT fWidth = crBBox.right - crBBox.left; 244 FX_FLOAT fWidth = crBBox.right - crBBox.left;
244 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 245 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
245 246
246 CPDF_Point pt1(crBBox.left, crBBox.bottom + fHeight / 2); 247 CFX_FloatPoint pt1(crBBox.left, crBBox.bottom + fHeight / 2);
247 CPDF_Point pt2(crBBox.left + fWidth / 2, crBBox.top); 248 CFX_FloatPoint pt2(crBBox.left + fWidth / 2, crBBox.top);
248 CPDF_Point pt3(crBBox.right, crBBox.bottom + fHeight / 2); 249 CFX_FloatPoint pt3(crBBox.right, crBBox.bottom + fHeight / 2);
249 CPDF_Point pt4(crBBox.left + fWidth / 2, crBBox.bottom); 250 CFX_FloatPoint pt4(crBBox.left + fWidth / 2, crBBox.bottom);
250 251
251 csAP << pt1.x << " " << pt1.y << " m\n"; 252 csAP << pt1.x << " " << pt1.y << " m\n";
252 csAP << pt2.x << " " << pt2.y << " l\n"; 253 csAP << pt2.x << " " << pt2.y << " l\n";
253 csAP << pt3.x << " " << pt3.y << " l\n"; 254 csAP << pt3.x << " " << pt3.y << " l\n";
254 csAP << pt4.x << " " << pt4.y << " l\n"; 255 csAP << pt4.x << " " << pt4.y << " l\n";
255 csAP << pt1.x << " " << pt1.y << " l\n"; 256 csAP << pt1.x << " " << pt1.y << " l\n";
256 257
257 return csAP.GetByteString(); 258 return csAP.GetByteString();
258 } 259 }
259 260
260 CFX_ByteString CPWL_Utils::GetAP_Square(const CPDF_Rect& crBBox) { 261 CFX_ByteString CPWL_Utils::GetAP_Square(const CFX_FloatRect& crBBox) {
261 CFX_ByteTextBuf csAP; 262 CFX_ByteTextBuf csAP;
262 263
263 csAP << crBBox.left << " " << crBBox.top << " m\n"; 264 csAP << crBBox.left << " " << crBBox.top << " m\n";
264 csAP << crBBox.right << " " << crBBox.top << " l\n"; 265 csAP << crBBox.right << " " << crBBox.top << " l\n";
265 csAP << crBBox.right << " " << crBBox.bottom << " l\n"; 266 csAP << crBBox.right << " " << crBBox.bottom << " l\n";
266 csAP << crBBox.left << " " << crBBox.bottom << " l\n"; 267 csAP << crBBox.left << " " << crBBox.bottom << " l\n";
267 csAP << crBBox.left << " " << crBBox.top << " l\n"; 268 csAP << crBBox.left << " " << crBBox.top << " l\n";
268 269
269 return csAP.GetByteString(); 270 return csAP.GetByteString();
270 } 271 }
271 272
272 CFX_ByteString CPWL_Utils::GetAP_Star(const CPDF_Rect& crBBox) { 273 CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) {
273 CFX_ByteTextBuf csAP; 274 CFX_ByteTextBuf csAP;
274 275
275 FX_FLOAT fRadius = 276 FX_FLOAT fRadius =
276 (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); 277 (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f));
277 CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f, 278 CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f,
278 (crBBox.top + crBBox.bottom) / 2.0f); 279 (crBBox.top + crBBox.bottom) / 2.0f);
279 280
280 FX_FLOAT px[5], py[5]; 281 FX_FLOAT px[5], py[5];
281 282
282 FX_FLOAT fAngel = FX_PI / 10.0f; 283 FX_FLOAT fAngel = FX_PI / 10.0f;
283 284
284 for (int32_t i = 0; i < 5; i++) { 285 for (int32_t i = 0; i < 5; i++) {
285 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel); 286 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel);
286 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel); 287 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel);
287 288
288 fAngel += FX_PI * 2 / 5.0f; 289 fAngel += FX_PI * 2 / 5.0f;
289 } 290 }
290 291
291 csAP << px[0] << " " << py[0] << " m\n"; 292 csAP << px[0] << " " << py[0] << " m\n";
292 293
293 int32_t nNext = 0; 294 int32_t nNext = 0;
294 for (int32_t j = 0; j < 5; j++) { 295 for (int32_t j = 0; j < 5; j++) {
295 nNext += 2; 296 nNext += 2;
296 if (nNext >= 5) 297 if (nNext >= 5)
297 nNext -= 5; 298 nNext -= 5;
298 csAP << px[nNext] << " " << py[nNext] << " l\n"; 299 csAP << px[nNext] << " " << py[nNext] << " l\n";
299 } 300 }
300 301
301 return csAP.GetByteString(); 302 return csAP.GetByteString();
302 } 303 }
303 304
304 CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CPDF_Rect& crBBox, 305 CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox,
305 FX_FLOAT fRotate) { 306 FX_FLOAT fRotate) {
306 CFX_ByteTextBuf csAP; 307 CFX_ByteTextBuf csAP;
307 308
308 FX_FLOAT fWidth = crBBox.right - crBBox.left; 309 FX_FLOAT fWidth = crBBox.right - crBBox.left;
309 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 310 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
310 311
311 CPDF_Point pt1(-fWidth / 2, 0); 312 CFX_FloatPoint pt1(-fWidth / 2, 0);
312 CPDF_Point pt2(0, fHeight / 2); 313 CFX_FloatPoint pt2(0, fHeight / 2);
313 CPDF_Point pt3(fWidth / 2, 0); 314 CFX_FloatPoint pt3(fWidth / 2, 0);
314 315
315 FX_FLOAT px, py; 316 FX_FLOAT px, py;
316 317
317 csAP << cos(fRotate) << " " << sin(fRotate) << " " << -sin(fRotate) << " " 318 csAP << cos(fRotate) << " " << sin(fRotate) << " " << -sin(fRotate) << " "
318 << cos(fRotate) << " " << crBBox.left + fWidth / 2 << " " 319 << cos(fRotate) << " " << crBBox.left + fWidth / 2 << " "
319 << crBBox.bottom + fHeight / 2 << " cm\n"; 320 << crBBox.bottom + fHeight / 2 << " cm\n";
320 321
321 csAP << pt1.x << " " << pt1.y << " m\n"; 322 csAP << pt1.x << " " << pt1.y << " m\n";
322 323
323 px = pt2.x - pt1.x; 324 px = pt2.x - pt1.x;
324 py = pt2.y - pt1.y; 325 py = pt2.y - pt1.y;
325 326
326 csAP << pt1.x << " " << pt1.y + py * FX_BEZIER << " " 327 csAP << pt1.x << " " << pt1.y + py * FX_BEZIER << " "
327 << pt2.x - px * FX_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y 328 << pt2.x - px * FX_BEZIER << " " << pt2.y << " " << pt2.x << " " << pt2.y
328 << " c\n"; 329 << " c\n";
329 330
330 px = pt3.x - pt2.x; 331 px = pt3.x - pt2.x;
331 py = pt2.y - pt3.y; 332 py = pt2.y - pt3.y;
332 333
333 csAP << pt2.x + px * FX_BEZIER << " " << pt2.y << " " << pt3.x << " " 334 csAP << pt2.x + px * FX_BEZIER << " " << pt2.y << " " << pt3.x << " "
334 << pt3.y + py * FX_BEZIER << " " << pt3.x << " " << pt3.y << " c\n"; 335 << pt3.y + py * FX_BEZIER << " " << pt3.x << " " << pt3.y << " c\n";
335 336
336 return csAP.GetByteString(); 337 return csAP.GetByteString();
337 } 338 }
338 339
339 CPDF_Rect CPWL_Utils::InflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize) { 340 CFX_FloatRect CPWL_Utils::InflateRect(const CFX_FloatRect& rcRect,
341 FX_FLOAT fSize) {
340 if (rcRect.IsEmpty()) 342 if (rcRect.IsEmpty())
341 return rcRect; 343 return rcRect;
342 344
343 CPDF_Rect rcNew(rcRect.left - fSize, rcRect.bottom - fSize, 345 CFX_FloatRect rcNew(rcRect.left - fSize, rcRect.bottom - fSize,
344 rcRect.right + fSize, rcRect.top + fSize); 346 rcRect.right + fSize, rcRect.top + fSize);
345 rcNew.Normalize(); 347 rcNew.Normalize();
346 return rcNew; 348 return rcNew;
347 } 349 }
348 350
349 CPDF_Rect CPWL_Utils::DeflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize) { 351 CFX_FloatRect CPWL_Utils::DeflateRect(const CFX_FloatRect& rcRect,
352 FX_FLOAT fSize) {
350 if (rcRect.IsEmpty()) 353 if (rcRect.IsEmpty())
351 return rcRect; 354 return rcRect;
352 355
353 CPDF_Rect rcNew(rcRect.left + fSize, rcRect.bottom + fSize, 356 CFX_FloatRect rcNew(rcRect.left + fSize, rcRect.bottom + fSize,
354 rcRect.right - fSize, rcRect.top - fSize); 357 rcRect.right - fSize, rcRect.top - fSize);
355 rcNew.Normalize(); 358 rcNew.Normalize();
356 return rcNew; 359 return rcNew;
357 } 360 }
358 361
359 CPDF_Rect CPWL_Utils::ScaleRect(const CPDF_Rect& rcRect, FX_FLOAT fScale) { 362 CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect,
363 FX_FLOAT fScale) {
360 FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f; 364 FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f;
361 FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f; 365 FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f;
362 366
363 CPDF_Point ptCenter = CPDF_Point((rcRect.left + rcRect.right) / 2, 367 CFX_FloatPoint ptCenter = CFX_FloatPoint((rcRect.left + rcRect.right) / 2,
364 (rcRect.top + rcRect.bottom) / 2); 368 (rcRect.top + rcRect.bottom) / 2);
365 369
366 return CPDF_Rect( 370 return CFX_FloatRect(
367 ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale, 371 ptCenter.x - fHalfWidth * fScale, ptCenter.y - fHalfHeight * fScale,
368 ptCenter.x + fHalfWidth * fScale, ptCenter.y + fHalfHeight * fScale); 372 ptCenter.x + fHalfWidth * fScale, ptCenter.y + fHalfHeight * fScale);
369 } 373 }
370 374
371 CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CPDF_Rect& rect, 375 CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect,
372 const CPWL_Color& color) { 376 const CPWL_Color& color) {
373 CFX_ByteTextBuf sAppStream; 377 CFX_ByteTextBuf sAppStream;
374 378
375 CFX_ByteString sColor = GetColorAppStream(color, TRUE); 379 CFX_ByteString sColor = GetColorAppStream(color, TRUE);
376 if (sColor.GetLength() > 0) { 380 if (sColor.GetLength() > 0) {
377 sAppStream << "q\n" << sColor; 381 sAppStream << "q\n" << sColor;
378 sAppStream << rect.left << " " << rect.bottom << " " 382 sAppStream << rect.left << " " << rect.bottom << " "
379 << rect.right - rect.left << " " << rect.top - rect.bottom 383 << rect.right - rect.left << " " << rect.top - rect.bottom
380 << " re f\nQ\n"; 384 << " re f\nQ\n";
381 } 385 }
382 386
383 return sAppStream.GetByteString(); 387 return sAppStream.GetByteString();
384 } 388 }
385 389
386 CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CPDF_Rect& rect, 390 CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect,
387 const CPWL_Color& color) { 391 const CPWL_Color& color) {
388 CFX_ByteTextBuf sAppStream; 392 CFX_ByteTextBuf sAppStream;
389 393
390 CFX_ByteString sColor = GetColorAppStream(color, TRUE); 394 CFX_ByteString sColor = GetColorAppStream(color, TRUE);
391 if (sColor.GetLength() > 0) { 395 if (sColor.GetLength() > 0) {
392 sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; 396 sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n";
393 } 397 }
394 398
395 return sAppStream.GetByteString(); 399 return sAppStream.GetByteString();
396 } 400 }
397 401
398 CPDF_Rect CPWL_Utils::GetCenterSquare(const CPDF_Rect& rect) { 402 CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) {
399 FX_FLOAT fWidth = rect.right - rect.left; 403 FX_FLOAT fWidth = rect.right - rect.left;
400 FX_FLOAT fHeight = rect.top - rect.bottom; 404 FX_FLOAT fHeight = rect.top - rect.bottom;
401 405
402 FX_FLOAT fCenterX = (rect.left + rect.right) / 2.0f; 406 FX_FLOAT fCenterX = (rect.left + rect.right) / 2.0f;
403 FX_FLOAT fCenterY = (rect.top + rect.bottom) / 2.0f; 407 FX_FLOAT fCenterY = (rect.top + rect.bottom) / 2.0f;
404 408
405 FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2; 409 FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2;
406 410
407 return CPDF_Rect(fCenterX - fRadius, fCenterY - fRadius, fCenterX + fRadius, 411 return CFX_FloatRect(fCenterX - fRadius, fCenterY - fRadius,
408 fCenterY + fRadius); 412 fCenterX + fRadius, fCenterY + fRadius);
409 } 413 }
410 414
411 CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit, 415 CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit,
412 const CPDF_Point& ptOffset, 416 const CFX_FloatPoint& ptOffset,
413 const CPVT_WordRange* pRange, 417 const CPVT_WordRange* pRange,
414 FX_BOOL bContinuous, 418 FX_BOOL bContinuous,
415 FX_WORD SubWord) { 419 FX_WORD SubWord) {
416 return IFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous, 420 return IFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous,
417 SubWord); 421 SubWord);
418 } 422 }
419 423
420 CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit, 424 CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit,
421 const CPDF_Point& ptOffset, 425 const CFX_FloatPoint& ptOffset,
422 const CPVT_WordRange* pRange) { 426 const CPVT_WordRange* pRange) {
423 return IFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange); 427 return IFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange);
424 } 428 }
425 429
426 static CFX_ByteString GetSquigglyAppearanceStream(FX_FLOAT fStartX, 430 static CFX_ByteString GetSquigglyAppearanceStream(FX_FLOAT fStartX,
427 FX_FLOAT fEndX, 431 FX_FLOAT fEndX,
428 FX_FLOAT fY, 432 FX_FLOAT fY,
429 FX_FLOAT fStep) { 433 FX_FLOAT fStep) {
430 CFX_ByteTextBuf sRet; 434 CFX_ByteTextBuf sRet;
431 435
432 sRet << "0 w\n" << fStartX << " " << fY << " m\n"; 436 sRet << "0 w\n" << fStartX << " " << fY << " m\n";
433 437
434 FX_FLOAT fx; 438 FX_FLOAT fx;
435 int32_t i; 439 int32_t i;
436 440
437 for (i = 1, fx = fStartX + fStep; fx < fEndX; fx += fStep, i++) { 441 for (i = 1, fx = fStartX + fStep; fx < fEndX; fx += fStep, i++) {
438 sRet << fx << " " << fY + (i & 1) * fStep << " l\n"; 442 sRet << fx << " " << fY + (i & 1) * fStep << " l\n";
439 } 443 }
440 444
441 sRet << "S\n"; 445 sRet << "S\n";
442 446
443 return sRet.GetByteString(); 447 return sRet.GetByteString();
444 } 448 }
445 449
446 static CFX_ByteString GetWordSpellCheckAppearanceStream( 450 static CFX_ByteString GetWordSpellCheckAppearanceStream(
447 IFX_Edit_Iterator* pIterator, 451 IFX_Edit_Iterator* pIterator,
448 const CPDF_Point& ptOffset, 452 const CFX_FloatPoint& ptOffset,
449 const CPVT_WordRange& wrWord) { 453 const CPVT_WordRange& wrWord) {
450 CFX_ByteTextBuf sRet; 454 CFX_ByteTextBuf sRet;
451 455
452 FX_FLOAT fStartX = 0.0f; 456 FX_FLOAT fStartX = 0.0f;
453 FX_FLOAT fEndX = 0.0f; 457 FX_FLOAT fEndX = 0.0f;
454 FX_FLOAT fY = 0.0f; 458 FX_FLOAT fY = 0.0f;
455 FX_FLOAT fStep = 0.0f; 459 FX_FLOAT fStep = 0.0f;
456 460
457 FX_BOOL bBreak = FALSE; 461 FX_BOOL bBreak = FALSE;
458 462
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 break; 501 break;
498 } while (pIterator->NextLine()); 502 } while (pIterator->NextLine());
499 } 503 }
500 504
501 return sRet.GetByteString(); 505 return sRet.GetByteString();
502 } 506 }
503 507
504 CFX_ByteString CPWL_Utils::GetSpellCheckAppStream( 508 CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(
505 IFX_Edit* pEdit, 509 IFX_Edit* pEdit,
506 IPWL_SpellCheck* pSpellCheck, 510 IPWL_SpellCheck* pSpellCheck,
507 const CPDF_Point& ptOffset, 511 const CFX_FloatPoint& ptOffset,
508 const CPVT_WordRange* pRange) { 512 const CPVT_WordRange* pRange) {
509 CFX_ByteTextBuf sRet; 513 CFX_ByteTextBuf sRet;
510 514
511 if (pRange && pRange->IsExist()) { 515 if (pRange && pRange->IsExist()) {
512 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 516 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
513 pIterator->SetAt(pRange->BeginPos); 517 pIterator->SetAt(pRange->BeginPos);
514 518
515 FX_BOOL bLatinWord = FALSE; 519 FX_BOOL bLatinWord = FALSE;
516 CPVT_WordPlace wpWordStart; 520 CPVT_WordPlace wpWordStart;
517 CFX_ByteString sWord; 521 CFX_ByteString sWord;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 566
563 bLatinWord = FALSE; 567 bLatinWord = FALSE;
564 sWord.Empty(); 568 sWord.Empty();
565 } 569 }
566 } 570 }
567 } 571 }
568 572
569 return sRet.GetByteString(); 573 return sRet.GetByteString();
570 } 574 }
571 575
572 CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect& rcBBox, 576 CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox,
573 IFX_Edit_FontMap* pFontMap, 577 IFX_Edit_FontMap* pFontMap,
574 const CFX_WideString& sText, 578 const CFX_WideString& sText,
575 int32_t nAlignmentH, 579 int32_t nAlignmentH,
576 int32_t nAlignmentV, 580 int32_t nAlignmentV,
577 FX_FLOAT fFontSize, 581 FX_FLOAT fFontSize,
578 FX_BOOL bMultiLine, 582 FX_BOOL bMultiLine,
579 FX_BOOL bAutoReturn, 583 FX_BOOL bAutoReturn,
580 const CPWL_Color& crText) { 584 const CPWL_Color& crText) {
581 CFX_ByteTextBuf sRet; 585 CFX_ByteTextBuf sRet;
582 586
583 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { 587 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) {
584 pEdit->SetFontMap(pFontMap); 588 pEdit->SetFontMap(pFontMap);
585 pEdit->SetPlateRect(rcBBox); 589 pEdit->SetPlateRect(rcBBox);
586 pEdit->SetAlignmentH(nAlignmentH); 590 pEdit->SetAlignmentH(nAlignmentH);
587 pEdit->SetAlignmentV(nAlignmentV); 591 pEdit->SetAlignmentV(nAlignmentV);
588 pEdit->SetMultiLine(bMultiLine); 592 pEdit->SetMultiLine(bMultiLine);
589 pEdit->SetAutoReturn(bAutoReturn); 593 pEdit->SetAutoReturn(bAutoReturn);
590 if (IsFloatZero(fFontSize)) 594 if (IsFloatZero(fFontSize))
591 pEdit->SetAutoFontSize(TRUE); 595 pEdit->SetAutoFontSize(TRUE);
592 else 596 else
593 pEdit->SetFontSize(fFontSize); 597 pEdit->SetFontSize(fFontSize);
594 598
595 pEdit->Initialize(); 599 pEdit->Initialize();
596 pEdit->SetText(sText.c_str()); 600 pEdit->SetText(sText.c_str());
597 601
598 CFX_ByteString sEdit = 602 CFX_ByteString sEdit =
599 CPWL_Utils::GetEditAppStream(pEdit, CPDF_Point(0.0f, 0.0f)); 603 CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
600 if (sEdit.GetLength() > 0) { 604 if (sEdit.GetLength() > 0) {
601 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit 605 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit
602 << "ET\n"; 606 << "ET\n";
603 } 607 }
604 IFX_Edit::DelEdit(pEdit); 608 IFX_Edit::DelEdit(pEdit);
605 } 609 }
606 610
607 return sRet.GetByteString(); 611 return sRet.GetByteString();
608 } 612 }
609 613
610 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect& rcBBox, 614 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
611 IFX_Edit_FontMap* pFontMap, 615 IFX_Edit_FontMap* pFontMap,
612 CPDF_Stream* pIconStream, 616 CPDF_Stream* pIconStream,
613 CPDF_IconFit& IconFit, 617 CPDF_IconFit& IconFit,
614 const CFX_WideString& sLabel, 618 const CFX_WideString& sLabel,
615 const CPWL_Color& crText, 619 const CPWL_Color& crText,
616 FX_FLOAT fFontSize, 620 FX_FLOAT fFontSize,
617 int32_t nLayOut) { 621 int32_t nLayOut) {
618 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; 622 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f;
619 623
620 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { 624 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) {
621 pEdit->SetFontMap(pFontMap); 625 pEdit->SetFontMap(pFontMap);
622 pEdit->SetAlignmentH(1); 626 pEdit->SetAlignmentH(1);
623 pEdit->SetAlignmentV(1); 627 pEdit->SetAlignmentV(1);
624 pEdit->SetMultiLine(FALSE); 628 pEdit->SetMultiLine(FALSE);
625 pEdit->SetAutoReturn(FALSE); 629 pEdit->SetAutoReturn(FALSE);
626 if (IsFloatZero(fFontSize)) 630 if (IsFloatZero(fFontSize))
627 pEdit->SetAutoFontSize(TRUE); 631 pEdit->SetAutoFontSize(TRUE);
628 else 632 else
629 pEdit->SetFontSize(fFontSize); 633 pEdit->SetFontSize(fFontSize);
630 634
631 pEdit->Initialize(); 635 pEdit->Initialize();
632 pEdit->SetText(sLabel.c_str()); 636 pEdit->SetText(sLabel.c_str());
633 637
634 CPDF_Rect rcLabelContent = pEdit->GetContentRect(); 638 CFX_FloatRect rcLabelContent = pEdit->GetContentRect();
635 CPWL_Icon Icon; 639 CPWL_Icon Icon;
636 PWL_CREATEPARAM cp; 640 PWL_CREATEPARAM cp;
637 cp.dwFlags = PWS_VISIBLE; 641 cp.dwFlags = PWS_VISIBLE;
638 Icon.Create(cp); 642 Icon.Create(cp);
639 Icon.SetIconFit(&IconFit); 643 Icon.SetIconFit(&IconFit);
640 Icon.SetPDFStream(pIconStream); 644 Icon.SetPDFStream(pIconStream);
641 645
642 CPDF_Rect rcLabel = CPDF_Rect(0, 0, 0, 0); 646 CFX_FloatRect rcLabel = CFX_FloatRect(0, 0, 0, 0);
643 CPDF_Rect rcIcon = CPDF_Rect(0, 0, 0, 0); 647 CFX_FloatRect rcIcon = CFX_FloatRect(0, 0, 0, 0);
644 FX_FLOAT fWidth = 0.0f; 648 FX_FLOAT fWidth = 0.0f;
645 FX_FLOAT fHeight = 0.0f; 649 FX_FLOAT fHeight = 0.0f;
646 650
647 switch (nLayOut) { 651 switch (nLayOut) {
648 case PPBL_LABEL: 652 case PPBL_LABEL:
649 rcLabel = rcBBox; 653 rcLabel = rcBBox;
650 rcIcon = CPDF_Rect(0, 0, 0, 0); 654 rcIcon = CFX_FloatRect(0, 0, 0, 0);
651 break; 655 break;
652 case PPBL_ICON: 656 case PPBL_ICON:
653 rcIcon = rcBBox; 657 rcIcon = rcBBox;
654 rcLabel = CPDF_Rect(0, 0, 0, 0); 658 rcLabel = CFX_FloatRect(0, 0, 0, 0);
655 break; 659 break;
656 case PPBL_ICONTOPLABELBOTTOM: 660 case PPBL_ICONTOPLABELBOTTOM:
657 661
658 if (pIconStream) { 662 if (pIconStream) {
659 if (IsFloatZero(fFontSize)) { 663 if (IsFloatZero(fFontSize)) {
660 fHeight = rcBBox.top - rcBBox.bottom; 664 fHeight = rcBBox.top - rcBBox.bottom;
661 rcLabel = CPDF_Rect(rcBBox.left, rcBBox.bottom, rcBBox.right, 665 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
662 rcBBox.bottom + fHeight * fAutoFontScale); 666 rcBBox.bottom + fHeight * fAutoFontScale);
663 rcIcon = 667 rcIcon = CFX_FloatRect(rcBBox.left, rcLabel.top, rcBBox.right,
664 CPDF_Rect(rcBBox.left, rcLabel.top, rcBBox.right, rcBBox.top); 668 rcBBox.top);
665 } else { 669 } else {
666 fHeight = rcLabelContent.Height(); 670 fHeight = rcLabelContent.Height();
667 671
668 if (rcBBox.bottom + fHeight > rcBBox.top) { 672 if (rcBBox.bottom + fHeight > rcBBox.top) {
669 rcIcon = CPDF_Rect(0, 0, 0, 0); 673 rcIcon = CFX_FloatRect(0, 0, 0, 0);
670 rcLabel = rcBBox; 674 rcLabel = rcBBox;
671 } else { 675 } else {
672 rcLabel = CPDF_Rect(rcBBox.left, rcBBox.bottom, rcBBox.right, 676 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
673 rcBBox.bottom + fHeight); 677 rcBBox.bottom + fHeight);
674 rcIcon = 678 rcIcon = CFX_FloatRect(rcBBox.left, rcLabel.top, rcBBox.right,
675 CPDF_Rect(rcBBox.left, rcLabel.top, rcBBox.right, rcBBox.top); 679 rcBBox.top);
676 } 680 }
677 } 681 }
678 } else { 682 } else {
679 rcLabel = rcBBox; 683 rcLabel = rcBBox;
680 rcIcon = CPDF_Rect(0, 0, 0, 0); 684 rcIcon = CFX_FloatRect(0, 0, 0, 0);
681 } 685 }
682 686
683 break; 687 break;
684 case PPBL_LABELTOPICONBOTTOM: 688 case PPBL_LABELTOPICONBOTTOM:
685 689
686 if (pIconStream) { 690 if (pIconStream) {
687 if (IsFloatZero(fFontSize)) { 691 if (IsFloatZero(fFontSize)) {
688 fHeight = rcBBox.top - rcBBox.bottom; 692 fHeight = rcBBox.top - rcBBox.bottom;
689 rcLabel = 693 rcLabel = CFX_FloatRect(rcBBox.left,
690 CPDF_Rect(rcBBox.left, rcBBox.top - fHeight * fAutoFontScale, 694 rcBBox.top - fHeight * fAutoFontScale,
691 rcBBox.right, rcBBox.top); 695 rcBBox.right, rcBBox.top);
692 rcIcon = CPDF_Rect(rcBBox.left, rcBBox.bottom, rcBBox.right, 696 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
693 rcLabel.bottom); 697 rcLabel.bottom);
694 } else { 698 } else {
695 fHeight = rcLabelContent.Height(); 699 fHeight = rcLabelContent.Height();
696 700
697 if (rcBBox.bottom + fHeight > rcBBox.top) { 701 if (rcBBox.bottom + fHeight > rcBBox.top) {
698 rcIcon = CPDF_Rect(0, 0, 0, 0); 702 rcIcon = CFX_FloatRect(0, 0, 0, 0);
699 rcLabel = rcBBox; 703 rcLabel = rcBBox;
700 } else { 704 } else {
701 rcLabel = CPDF_Rect(rcBBox.left, rcBBox.top - fHeight, 705 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.top - fHeight,
702 rcBBox.right, rcBBox.top); 706 rcBBox.right, rcBBox.top);
703 rcIcon = CPDF_Rect(rcBBox.left, rcBBox.bottom, rcBBox.right, 707 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
704 rcLabel.bottom); 708 rcLabel.bottom);
705 } 709 }
706 } 710 }
707 } else { 711 } else {
708 rcLabel = rcBBox; 712 rcLabel = rcBBox;
709 rcIcon = CPDF_Rect(0, 0, 0, 0); 713 rcIcon = CFX_FloatRect(0, 0, 0, 0);
710 } 714 }
711 715
712 break; 716 break;
713 case PPBL_ICONLEFTLABELRIGHT: 717 case PPBL_ICONLEFTLABELRIGHT:
714 718
715 if (pIconStream) { 719 if (pIconStream) {
716 if (IsFloatZero(fFontSize)) { 720 if (IsFloatZero(fFontSize)) {
717 fWidth = rcBBox.right - rcBBox.left; 721 fWidth = rcBBox.right - rcBBox.left;
718 rcLabel = CPDF_Rect(rcBBox.right - fWidth * fAutoFontScale, 722 rcLabel = CFX_FloatRect(rcBBox.right - fWidth * fAutoFontScale,
719 rcBBox.bottom, rcBBox.right, rcBBox.top); 723 rcBBox.bottom, rcBBox.right, rcBBox.top);
720 rcIcon = 724 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
721 CPDF_Rect(rcBBox.left, rcBBox.bottom, rcLabel.left, rcBBox.top); 725 rcBBox.top);
722 726
723 if (rcLabelContent.Width() < fWidth * fAutoFontScale) { 727 if (rcLabelContent.Width() < fWidth * fAutoFontScale) {
724 } else { 728 } else {
725 if (rcLabelContent.Width() < fWidth) { 729 if (rcLabelContent.Width() < fWidth) {
726 rcLabel = CPDF_Rect(rcBBox.right - rcLabelContent.Width(), 730 rcLabel =
727 rcBBox.bottom, rcBBox.right, rcBBox.top); 731 CFX_FloatRect(rcBBox.right - rcLabelContent.Width(),
728 rcIcon = CPDF_Rect(rcBBox.left, rcBBox.bottom, rcLabel.left, 732 rcBBox.bottom, rcBBox.right, rcBBox.top);
729 rcBBox.top); 733 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
734 rcBBox.top);
730 } else { 735 } else {
731 rcLabel = rcBBox; 736 rcLabel = rcBBox;
732 rcIcon = CPDF_Rect(0, 0, 0, 0); 737 rcIcon = CFX_FloatRect(0, 0, 0, 0);
733 } 738 }
734 } 739 }
735 } else { 740 } else {
736 fWidth = rcLabelContent.Width(); 741 fWidth = rcLabelContent.Width();
737 742
738 if (rcBBox.left + fWidth > rcBBox.right) { 743 if (rcBBox.left + fWidth > rcBBox.right) {
739 rcLabel = rcBBox; 744 rcLabel = rcBBox;
740 rcIcon = CPDF_Rect(0, 0, 0, 0); 745 rcIcon = CFX_FloatRect(0, 0, 0, 0);
741 } else { 746 } else {
742 rcLabel = CPDF_Rect(rcBBox.right - fWidth, rcBBox.bottom, 747 rcLabel = CFX_FloatRect(rcBBox.right - fWidth, rcBBox.bottom,
743 rcBBox.right, rcBBox.top); 748 rcBBox.right, rcBBox.top);
744 rcIcon = CPDF_Rect(rcBBox.left, rcBBox.bottom, rcLabel.left, 749 rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
745 rcBBox.top); 750 rcBBox.top);
746 } 751 }
747 } 752 }
748 } else { 753 } else {
749 rcLabel = rcBBox; 754 rcLabel = rcBBox;
750 rcIcon = CPDF_Rect(0, 0, 0, 0); 755 rcIcon = CFX_FloatRect(0, 0, 0, 0);
751 } 756 }
752 757
753 break; 758 break;
754 case PPBL_LABELLEFTICONRIGHT: 759 case PPBL_LABELLEFTICONRIGHT:
755 760
756 if (pIconStream) { 761 if (pIconStream) {
757 if (IsFloatZero(fFontSize)) { 762 if (IsFloatZero(fFontSize)) {
758 fWidth = rcBBox.right - rcBBox.left; 763 fWidth = rcBBox.right - rcBBox.left;
759 rcLabel = 764 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
760 CPDF_Rect(rcBBox.left, rcBBox.bottom, 765 rcBBox.left + fWidth * fAutoFontScale,
761 rcBBox.left + fWidth * fAutoFontScale, rcBBox.top); 766 rcBBox.top);
762 rcIcon = CPDF_Rect(rcLabel.right, rcBBox.bottom, rcBBox.right, 767 rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right,
763 rcBBox.top); 768 rcBBox.top);
764 769
765 if (rcLabelContent.Width() < fWidth * fAutoFontScale) { 770 if (rcLabelContent.Width() < fWidth * fAutoFontScale) {
766 } else { 771 } else {
767 if (rcLabelContent.Width() < fWidth) { 772 if (rcLabelContent.Width() < fWidth) {
768 rcLabel = 773 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
769 CPDF_Rect(rcBBox.left, rcBBox.bottom, 774 rcBBox.left + rcLabelContent.Width(),
770 rcBBox.left + rcLabelContent.Width(), rcBBox.top); 775 rcBBox.top);
771 rcIcon = CPDF_Rect(rcLabel.right, rcBBox.bottom, rcBBox.right, 776 rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom,
772 rcBBox.top); 777 rcBBox.right, rcBBox.top);
773 } else { 778 } else {
774 rcLabel = rcBBox; 779 rcLabel = rcBBox;
775 rcIcon = CPDF_Rect(0, 0, 0, 0); 780 rcIcon = CFX_FloatRect(0, 0, 0, 0);
776 } 781 }
777 } 782 }
778 } else { 783 } else {
779 fWidth = rcLabelContent.Width(); 784 fWidth = rcLabelContent.Width();
780 785
781 if (rcBBox.left + fWidth > rcBBox.right) { 786 if (rcBBox.left + fWidth > rcBBox.right) {
782 rcLabel = rcBBox; 787 rcLabel = rcBBox;
783 rcIcon = CPDF_Rect(0, 0, 0, 0); 788 rcIcon = CFX_FloatRect(0, 0, 0, 0);
784 } else { 789 } else {
785 rcLabel = CPDF_Rect(rcBBox.left, rcBBox.bottom, 790 rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
786 rcBBox.left + fWidth, rcBBox.top); 791 rcBBox.left + fWidth, rcBBox.top);
787 rcIcon = CPDF_Rect(rcLabel.right, rcBBox.bottom, rcBBox.right, 792 rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right,
788 rcBBox.top); 793 rcBBox.top);
789 } 794 }
790 } 795 }
791 } else { 796 } else {
792 rcLabel = rcBBox; 797 rcLabel = rcBBox;
793 rcIcon = CPDF_Rect(0, 0, 0, 0); 798 rcIcon = CFX_FloatRect(0, 0, 0, 0);
794 } 799 }
795 800
796 break; 801 break;
797 case PPBL_LABELOVERICON: 802 case PPBL_LABELOVERICON:
798 rcLabel = rcBBox; 803 rcLabel = rcBBox;
799 rcIcon = rcBBox; 804 rcIcon = rcBBox;
800 break; 805 break;
801 } 806 }
802 807
803 CFX_ByteTextBuf sAppStream, sTemp; 808 CFX_ByteTextBuf sAppStream, sTemp;
804 809
805 if (!rcIcon.IsEmpty()) { 810 if (!rcIcon.IsEmpty()) {
806 Icon.Move(rcIcon, FALSE, FALSE); 811 Icon.Move(rcIcon, FALSE, FALSE);
807 sTemp << Icon.GetImageAppStream(); 812 sTemp << Icon.GetImageAppStream();
808 } 813 }
809 814
810 Icon.Destroy(); 815 Icon.Destroy();
811 816
812 if (!rcLabel.IsEmpty()) { 817 if (!rcLabel.IsEmpty()) {
813 pEdit->SetPlateRect(rcLabel); 818 pEdit->SetPlateRect(rcLabel);
814 CFX_ByteString sEdit = 819 CFX_ByteString sEdit =
815 CPWL_Utils::GetEditAppStream(pEdit, CPDF_Point(0.0f, 0.0f)); 820 CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
816 if (sEdit.GetLength() > 0) { 821 if (sEdit.GetLength() > 0) {
817 sTemp << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit 822 sTemp << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit
818 << "ET\n"; 823 << "ET\n";
819 } 824 }
820 } 825 }
821 826
822 IFX_Edit::DelEdit(pEdit); 827 IFX_Edit::DelEdit(pEdit);
823 828
824 if (sTemp.GetSize() > 0) { 829 if (sTemp.GetSize() > 0) {
825 sAppStream << "q\n" << rcBBox.left << " " << rcBBox.bottom << " " 830 sAppStream << "q\n" << rcBBox.left << " " << rcBBox.bottom << " "
(...skipping 25 matching lines...) Expand all
851 case COLORTYPE_CMYK: 856 case COLORTYPE_CMYK:
852 sColorStream << color.fColor1 << " " << color.fColor2 << " " 857 sColorStream << color.fColor1 << " " << color.fColor2 << " "
853 << color.fColor3 << " " << color.fColor4 << " " 858 << color.fColor3 << " " << color.fColor4 << " "
854 << (bFillOrStroke ? "k" : "K") << "\n"; 859 << (bFillOrStroke ? "k" : "K") << "\n";
855 break; 860 break;
856 } 861 }
857 862
858 return sColorStream.GetByteString(); 863 return sColorStream.GetByteString();
859 } 864 }
860 865
861 CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect& rect, 866 CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect,
862 FX_FLOAT fWidth, 867 FX_FLOAT fWidth,
863 const CPWL_Color& color, 868 const CPWL_Color& color,
864 const CPWL_Color& crLeftTop, 869 const CPWL_Color& crLeftTop,
865 const CPWL_Color& crRightBottom, 870 const CPWL_Color& crRightBottom,
866 int32_t nStyle, 871 int32_t nStyle,
867 const CPWL_Dash& dash) { 872 const CPWL_Dash& dash) {
868 CFX_ByteTextBuf sAppStream; 873 CFX_ByteTextBuf sAppStream;
869 CFX_ByteString sColor; 874 CFX_ByteString sColor;
870 875
871 FX_FLOAT fLeft = rect.left; 876 FX_FLOAT fLeft = rect.left;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 break; 973 break;
969 } 974 }
970 975
971 sAppStream << "Q\n"; 976 sAppStream << "Q\n";
972 } 977 }
973 978
974 return sAppStream.GetByteString(); 979 return sAppStream.GetByteString();
975 } 980 }
976 981
977 CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( 982 CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(
978 const CPDF_Rect& rect, 983 const CFX_FloatRect& rect,
979 FX_FLOAT fWidth, 984 FX_FLOAT fWidth,
980 const CPWL_Color& color, 985 const CPWL_Color& color,
981 const CPWL_Color& crLeftTop, 986 const CPWL_Color& crLeftTop,
982 const CPWL_Color& crRightBottom, 987 const CPWL_Color& crRightBottom,
983 int32_t nStyle, 988 int32_t nStyle,
984 const CPWL_Dash& dash) { 989 const CPWL_Dash& dash) {
985 CFX_ByteTextBuf sAppStream; 990 CFX_ByteTextBuf sAppStream;
986 CFX_ByteString sColor; 991 CFX_ByteString sColor;
987 992
988 if (fWidth > 0.0f) { 993 if (fWidth > 0.0f) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 sRet.fColor1 /= fColorDevide; 1122 sRet.fColor1 /= fColorDevide;
1118 sRet.fColor2 /= fColorDevide; 1123 sRet.fColor2 /= fColorDevide;
1119 sRet.fColor3 /= fColorDevide; 1124 sRet.fColor3 /= fColorDevide;
1120 sRet.fColor4 /= fColorDevide; 1125 sRet.fColor4 /= fColorDevide;
1121 break; 1126 break;
1122 } 1127 }
1123 1128
1124 return sRet; 1129 return sRet;
1125 } 1130 }
1126 1131
1127 CFX_ByteString CPWL_Utils::GetAppStream_Check(const CPDF_Rect& rcBBox, 1132 CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox,
1128 const CPWL_Color& crText) { 1133 const CPWL_Color& crText) {
1129 CFX_ByteTextBuf sAP; 1134 CFX_ByteTextBuf sAP;
1130 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) 1135 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE)
1131 << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n"; 1136 << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n";
1132 return sAP.GetByteString(); 1137 return sAP.GetByteString();
1133 } 1138 }
1134 1139
1135 CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CPDF_Rect& rcBBox, 1140 CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox,
1136 const CPWL_Color& crText) { 1141 const CPWL_Color& crText) {
1137 CFX_ByteTextBuf sAP; 1142 CFX_ByteTextBuf sAP;
1138 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) 1143 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE)
1139 << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n"; 1144 << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n";
1140 return sAP.GetByteString(); 1145 return sAP.GetByteString();
1141 } 1146 }
1142 1147
1143 CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CPDF_Rect& rcBBox, 1148 CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox,
1144 const CPWL_Color& crText) { 1149 const CPWL_Color& crText) {
1145 CFX_ByteTextBuf sAP; 1150 CFX_ByteTextBuf sAP;
1146 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, FALSE) 1151 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, FALSE)
1147 << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n"; 1152 << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n";
1148 return sAP.GetByteString(); 1153 return sAP.GetByteString();
1149 } 1154 }
1150 1155
1151 CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CPDF_Rect& rcBBox, 1156 CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
1152 const CPWL_Color& crText) { 1157 const CPWL_Color& crText) {
1153 CFX_ByteTextBuf sAP; 1158 CFX_ByteTextBuf sAP;
1154 sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) 1159 sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText, TRUE)
1155 << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; 1160 << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n";
1156 return sAP.GetByteString(); 1161 return sAP.GetByteString();
1157 } 1162 }
1158 1163
1159 CFX_ByteString CPWL_Utils::GetAppStream_Square(const CPDF_Rect& rcBBox, 1164 CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox,
1160 const CPWL_Color& crText) { 1165 const CPWL_Color& crText) {
1161 CFX_ByteTextBuf sAP; 1166 CFX_ByteTextBuf sAP;
1162 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) 1167 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE)
1163 << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n"; 1168 << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n";
1164 return sAP.GetByteString(); 1169 return sAP.GetByteString();
1165 } 1170 }
1166 1171
1167 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CPDF_Rect& rcBBox, 1172 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox,
1168 const CPWL_Color& crText) { 1173 const CPWL_Color& crText) {
1169 CFX_ByteTextBuf sAP; 1174 CFX_ByteTextBuf sAP;
1170 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) 1175 sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE)
1171 << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n"; 1176 << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n";
1172 return sAP.GetByteString(); 1177 return sAP.GetByteString();
1173 } 1178 }
1174 1179
1175 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CPDF_Rect& rcBBox, 1180 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
1176 int32_t nStyle, 1181 int32_t nStyle,
1177 const CPWL_Color& crText) { 1182 const CPWL_Color& crText) {
1178 CPDF_Rect rcCenter = GetCenterSquare(rcBBox); 1183 CFX_FloatRect rcCenter = GetCenterSquare(rcBBox);
1179 switch (nStyle) { 1184 switch (nStyle) {
1180 default: 1185 default:
1181 case PCS_CHECK: 1186 case PCS_CHECK:
1182 return GetAppStream_Check(rcCenter, crText); 1187 return GetAppStream_Check(rcCenter, crText);
1183 case PCS_CIRCLE: 1188 case PCS_CIRCLE:
1184 return GetAppStream_Circle(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1189 return GetAppStream_Circle(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
1185 case PCS_CROSS: 1190 case PCS_CROSS:
1186 return GetAppStream_Cross(rcCenter, crText); 1191 return GetAppStream_Cross(rcCenter, crText);
1187 case PCS_DIAMOND: 1192 case PCS_DIAMOND:
1188 return GetAppStream_Diamond(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1193 return GetAppStream_Diamond(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
1189 case PCS_SQUARE: 1194 case PCS_SQUARE:
1190 return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1195 return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
1191 case PCS_STAR: 1196 case PCS_STAR:
1192 return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1197 return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
1193 } 1198 }
1194 } 1199 }
1195 1200
1196 CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CPDF_Rect& rcBBox, 1201 CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
1197 int32_t nStyle, 1202 int32_t nStyle,
1198 const CPWL_Color& crText) { 1203 const CPWL_Color& crText) {
1199 CPDF_Rect rcCenter = GetCenterSquare(rcBBox); 1204 CFX_FloatRect rcCenter = GetCenterSquare(rcBBox);
1200 switch (nStyle) { 1205 switch (nStyle) {
1201 default: 1206 default:
1202 case PCS_CHECK: 1207 case PCS_CHECK:
1203 return GetAppStream_Check(rcCenter, crText); 1208 return GetAppStream_Check(rcCenter, crText);
1204 case PCS_CIRCLE: 1209 case PCS_CIRCLE:
1205 return GetAppStream_Circle(ScaleRect(rcCenter, 1.0f / 2.0f), crText); 1210 return GetAppStream_Circle(ScaleRect(rcCenter, 1.0f / 2.0f), crText);
1206 case PCS_CROSS: 1211 case PCS_CROSS:
1207 return GetAppStream_Cross(rcCenter, crText); 1212 return GetAppStream_Cross(rcCenter, crText);
1208 case PCS_DIAMOND: 1213 case PCS_DIAMOND:
1209 return GetAppStream_Diamond(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1214 return GetAppStream_Diamond(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
1210 case PCS_SQUARE: 1215 case PCS_SQUARE:
1211 return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1216 return GetAppStream_Square(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
1212 case PCS_STAR: 1217 case PCS_STAR:
1213 return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText); 1218 return GetAppStream_Star(ScaleRect(rcCenter, 2.0f / 3.0f), crText);
1214 } 1219 }
1215 } 1220 }
1216 1221
1217 CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CPDF_Rect& rcBBox) { 1222 CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
1218 CFX_ByteTextBuf sAppStream; 1223 CFX_ByteTextBuf sAppStream;
1219 1224
1220 if (!rcBBox.IsEmpty()) { 1225 if (!rcBBox.IsEmpty()) {
1221 sAppStream << "q\n" << CPWL_Utils::GetColorAppStream( 1226 sAppStream << "q\n" << CPWL_Utils::GetColorAppStream(
1222 CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, 1227 CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f,
1223 220.0f / 255.0f, 220.0f / 255.0f), 1228 220.0f / 255.0f, 220.0f / 255.0f),
1224 TRUE); 1229 TRUE);
1225 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " 1230 sAppStream << rcBBox.left << " " << rcBBox.bottom << " "
1226 << rcBBox.right - rcBBox.left << " " 1231 << rcBBox.right - rcBBox.left << " "
1227 << rcBBox.top - rcBBox.bottom << " re f\n"; 1232 << rcBBox.top - rcBBox.bottom << " re f\n";
1228 sAppStream << "Q\n"; 1233 sAppStream << "Q\n";
1229 1234
1230 sAppStream << "q\n" << CPWL_Utils::GetBorderAppStream( 1235 sAppStream << "q\n" << CPWL_Utils::GetBorderAppStream(
1231 rcBBox, 2, CPWL_Color(COLORTYPE_GRAY, 0), 1236 rcBBox, 2, CPWL_Color(COLORTYPE_GRAY, 0),
1232 CPWL_Color(COLORTYPE_GRAY, 1), 1237 CPWL_Color(COLORTYPE_GRAY, 1),
1233 CPWL_Color(COLORTYPE_GRAY, 0.5), PBS_BEVELED, 1238 CPWL_Color(COLORTYPE_GRAY, 0.5), PBS_BEVELED,
1234 CPWL_Dash(3, 0, 0)) 1239 CPWL_Dash(3, 0, 0))
1235 << "Q\n"; 1240 << "Q\n";
1236 1241
1237 CPDF_Point ptCenter = CPDF_Point((rcBBox.left + rcBBox.right) / 2, 1242 CFX_FloatPoint ptCenter = CFX_FloatPoint((rcBBox.left + rcBBox.right) / 2,
1238 (rcBBox.top + rcBBox.bottom) / 2); 1243 (rcBBox.top + rcBBox.bottom) / 2);
1239 if (IsFloatBigger(rcBBox.right - rcBBox.left, 6) && 1244 if (IsFloatBigger(rcBBox.right - rcBBox.left, 6) &&
1240 IsFloatBigger(rcBBox.top - rcBBox.bottom, 6)) { 1245 IsFloatBigger(rcBBox.top - rcBBox.bottom, 6)) {
1241 sAppStream << "q\n" 1246 sAppStream << "q\n"
1242 << " 0 g\n"; 1247 << " 0 g\n";
1243 sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " m\n"; 1248 sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " m\n";
1244 sAppStream << ptCenter.x + 3 << " " << ptCenter.y + 1.5f << " l\n"; 1249 sAppStream << ptCenter.x + 3 << " " << ptCenter.y + 1.5f << " l\n";
1245 sAppStream << ptCenter.x << " " << ptCenter.y - 1.5f << " l\n"; 1250 sAppStream << ptCenter.x << " " << ptCenter.y - 1.5f << " l\n";
1246 sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " l f\n"; 1251 sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " l f\n";
1247 sAppStream << "Q\n"; 1252 sAppStream << "Q\n";
1248 } 1253 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 FX_FLOAT dBlue = 0; 1363 FX_FLOAT dBlue = 0;
1359 1364
1360 PWLColorToARGB(color, nAlpha, dRed, dGreen, dBlue); 1365 PWLColorToARGB(color, nAlpha, dRed, dGreen, dBlue);
1361 1366
1362 return ArgbEncode(nAlpha, (int32_t)(dRed * 255), (int32_t)(dGreen * 255), 1367 return ArgbEncode(nAlpha, (int32_t)(dRed * 255), (int32_t)(dGreen * 255),
1363 (int32_t)(dBlue * 255)); 1368 (int32_t)(dBlue * 255));
1364 } 1369 }
1365 1370
1366 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, 1371 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice,
1367 CFX_Matrix* pUser2Device, 1372 CFX_Matrix* pUser2Device,
1368 const CPDF_Rect& rect, 1373 const CFX_FloatRect& rect,
1369 const FX_COLORREF& color) { 1374 const FX_COLORREF& color) {
1370 CFX_PathData path; 1375 CFX_PathData path;
1371 CPDF_Rect rcTemp(rect); 1376 CFX_FloatRect rcTemp(rect);
1372 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); 1377 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top);
1373 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_WINDING); 1378 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_WINDING);
1374 } 1379 }
1375 1380
1376 void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, 1381 void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice,
1377 CFX_Matrix* pUser2Device, 1382 CFX_Matrix* pUser2Device,
1378 const CPDF_Point* pPts, 1383 const CFX_FloatPoint* pPts,
1379 int32_t nCount, 1384 int32_t nCount,
1380 const FX_COLORREF& color) { 1385 const FX_COLORREF& color) {
1381 CFX_PathData path; 1386 CFX_PathData path;
1382 path.SetPointCount(nCount); 1387 path.SetPointCount(nCount);
1383 1388
1384 path.SetPoint(0, pPts[0].x, pPts[0].y, FXPT_MOVETO); 1389 path.SetPoint(0, pPts[0].x, pPts[0].y, FXPT_MOVETO);
1385 for (int32_t i = 1; i < nCount; i++) 1390 for (int32_t i = 1; i < nCount; i++)
1386 path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO); 1391 path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO);
1387 1392
1388 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_ALTERNATE); 1393 pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_ALTERNATE);
1389 } 1394 }
1390 1395
1391 void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, 1396 void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice,
1392 CFX_Matrix* pUser2Device, 1397 CFX_Matrix* pUser2Device,
1393 const CPDF_Rect& rect, 1398 const CFX_FloatRect& rect,
1394 const FX_COLORREF& color, 1399 const FX_COLORREF& color,
1395 FX_FLOAT fWidth) { 1400 FX_FLOAT fWidth) {
1396 CFX_PathData path; 1401 CFX_PathData path;
1397 CPDF_Rect rcTemp(rect); 1402 CFX_FloatRect rcTemp(rect);
1398 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top); 1403 path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top);
1399 1404
1400 CFX_GraphStateData gsd; 1405 CFX_GraphStateData gsd;
1401 gsd.m_LineWidth = fWidth; 1406 gsd.m_LineWidth = fWidth;
1402 1407
1403 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE); 1408 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE);
1404 } 1409 }
1405 1410
1406 void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice, 1411 void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice,
1407 CFX_Matrix* pUser2Device, 1412 CFX_Matrix* pUser2Device,
1408 const CPDF_Point& ptMoveTo, 1413 const CFX_FloatPoint& ptMoveTo,
1409 const CPDF_Point& ptLineTo, 1414 const CFX_FloatPoint& ptLineTo,
1410 const FX_COLORREF& color, 1415 const FX_COLORREF& color,
1411 FX_FLOAT fWidth) { 1416 FX_FLOAT fWidth) {
1412 CFX_PathData path; 1417 CFX_PathData path;
1413 path.SetPointCount(2); 1418 path.SetPointCount(2);
1414 path.SetPoint(0, ptMoveTo.x, ptMoveTo.y, FXPT_MOVETO); 1419 path.SetPoint(0, ptMoveTo.x, ptMoveTo.y, FXPT_MOVETO);
1415 path.SetPoint(1, ptLineTo.x, ptLineTo.y, FXPT_LINETO); 1420 path.SetPoint(1, ptLineTo.x, ptLineTo.y, FXPT_LINETO);
1416 1421
1417 CFX_GraphStateData gsd; 1422 CFX_GraphStateData gsd;
1418 gsd.m_LineWidth = fWidth; 1423 gsd.m_LineWidth = fWidth;
1419 1424
1420 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE); 1425 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE);
1421 } 1426 }
1422 1427
1423 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, 1428 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice,
1424 CFX_Matrix* pUser2Device, 1429 CFX_Matrix* pUser2Device,
1425 const CPDF_Rect& rect, 1430 const CFX_FloatRect& rect,
1426 const CPWL_Color& color, 1431 const CPWL_Color& color,
1427 int32_t nTransparancy) { 1432 int32_t nTransparancy) {
1428 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rect, 1433 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rect,
1429 PWLColorToFXColor(color, nTransparancy)); 1434 PWLColorToFXColor(color, nTransparancy));
1430 } 1435 }
1431 1436
1432 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, 1437 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
1433 CFX_Matrix* pUser2Device, 1438 CFX_Matrix* pUser2Device,
1434 FX_BOOL bVertical, 1439 FX_BOOL bVertical,
1435 FX_BOOL bHorizontal, 1440 FX_BOOL bHorizontal,
1436 CPDF_Rect rect, 1441 CFX_FloatRect rect,
1437 int32_t nTransparancy, 1442 int32_t nTransparancy,
1438 int32_t nStartGray, 1443 int32_t nStartGray,
1439 int32_t nEndGray) { 1444 int32_t nEndGray) {
1440 FX_FLOAT fStepGray = 1.0f; 1445 FX_FLOAT fStepGray = 1.0f;
1441 1446
1442 if (bVertical) { 1447 if (bVertical) {
1443 fStepGray = (nEndGray - nStartGray) / rect.Height(); 1448 fStepGray = (nEndGray - nStartGray) / rect.Height();
1444 1449
1445 for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { 1450 for (FX_FLOAT fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) {
1446 int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom)); 1451 int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom));
1447 CPWL_Utils::DrawStrokeLine( 1452 CPWL_Utils::DrawStrokeLine(
1448 pDevice, pUser2Device, CPDF_Point(rect.left, fy), 1453 pDevice, pUser2Device, CFX_FloatPoint(rect.left, fy),
1449 CPDF_Point(rect.right, fy), 1454 CFX_FloatPoint(rect.right, fy),
1450 ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); 1455 ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f);
1451 } 1456 }
1452 } 1457 }
1453 1458
1454 if (bHorizontal) { 1459 if (bHorizontal) {
1455 fStepGray = (nEndGray - nStartGray) / rect.Width(); 1460 fStepGray = (nEndGray - nStartGray) / rect.Width();
1456 1461
1457 for (FX_FLOAT fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) { 1462 for (FX_FLOAT fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) {
1458 int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left)); 1463 int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left));
1459 CPWL_Utils::DrawStrokeLine( 1464 CPWL_Utils::DrawStrokeLine(
1460 pDevice, pUser2Device, CPDF_Point(fx, rect.bottom), 1465 pDevice, pUser2Device, CFX_FloatPoint(fx, rect.bottom),
1461 CPDF_Point(fx, rect.top), 1466 CFX_FloatPoint(fx, rect.top),
1462 ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f); 1467 ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f);
1463 } 1468 }
1464 } 1469 }
1465 } 1470 }
1466 1471
1467 void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, 1472 void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
1468 CFX_Matrix* pUser2Device, 1473 CFX_Matrix* pUser2Device,
1469 const CPDF_Rect& rect, 1474 const CFX_FloatRect& rect,
1470 FX_FLOAT fWidth, 1475 FX_FLOAT fWidth,
1471 const CPWL_Color& color, 1476 const CPWL_Color& color,
1472 const CPWL_Color& crLeftTop, 1477 const CPWL_Color& crLeftTop,
1473 const CPWL_Color& crRightBottom, 1478 const CPWL_Color& crRightBottom,
1474 int32_t nStyle, 1479 int32_t nStyle,
1475 int32_t nTransparancy) { 1480 int32_t nTransparancy) {
1476 FX_FLOAT fLeft = rect.left; 1481 FX_FLOAT fLeft = rect.left;
1477 FX_FLOAT fRight = rect.right; 1482 FX_FLOAT fRight = rect.right;
1478 FX_FLOAT fTop = rect.top; 1483 FX_FLOAT fTop = rect.top;
1479 FX_FLOAT fBottom = rect.bottom; 1484 FX_FLOAT fBottom = rect.bottom;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 1671
1667 if (bBreak) 1672 if (bBreak)
1668 break; 1673 break;
1669 } while (pIterator->NextLine()); 1674 } while (pIterator->NextLine());
1670 } 1675 }
1671 } 1676 }
1672 1677
1673 void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, 1678 void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice,
1674 CFX_Matrix* pUser2Device, 1679 CFX_Matrix* pUser2Device,
1675 IFX_Edit* pEdit, 1680 IFX_Edit* pEdit,
1676 const CPDF_Rect& rcClip, 1681 const CFX_FloatRect& rcClip,
1677 const CPDF_Point& ptOffset, 1682 const CFX_FloatPoint& ptOffset,
1678 const CPVT_WordRange* pRange, 1683 const CPVT_WordRange* pRange,
1679 IPWL_SpellCheck* pSpellCheck) { 1684 IPWL_SpellCheck* pSpellCheck) {
1680 const FX_COLORREF crSpell = ArgbEncode(255, 255, 0, 0); 1685 const FX_COLORREF crSpell = ArgbEncode(255, 255, 0, 0);
1681 1686
1682 // for spellcheck 1687 // for spellcheck
1683 FX_BOOL bLatinWord = FALSE; 1688 FX_BOOL bLatinWord = FALSE;
1684 CPVT_WordPlace wpWordStart; 1689 CPVT_WordPlace wpWordStart;
1685 CFX_ByteString sLatinWord; 1690 CFX_ByteString sLatinWord;
1686 1691
1687 CFX_PathData pathSpell; 1692 CFX_PathData pathSpell;
1688 1693
1689 pDevice->SaveState(); 1694 pDevice->SaveState();
1690 1695
1691 if (!rcClip.IsEmpty()) { 1696 if (!rcClip.IsEmpty()) {
1692 CPDF_Rect rcTemp = rcClip; 1697 CFX_FloatRect rcTemp = rcClip;
1693 pUser2Device->TransformRect(rcTemp); 1698 pUser2Device->TransformRect(rcTemp);
1694 FX_RECT rcDevClip; 1699 FX_RECT rcDevClip;
1695 rcDevClip.left = (int32_t)rcTemp.left; 1700 rcDevClip.left = (int32_t)rcTemp.left;
1696 rcDevClip.right = (int32_t)rcTemp.right; 1701 rcDevClip.right = (int32_t)rcTemp.right;
1697 rcDevClip.top = (int32_t)rcTemp.top; 1702 rcDevClip.top = (int32_t)rcTemp.top;
1698 rcDevClip.bottom = (int32_t)rcTemp.bottom; 1703 rcDevClip.bottom = (int32_t)rcTemp.bottom;
1699 pDevice->SetClip_Rect(&rcDevClip); 1704 pDevice->SetClip_Rect(&rcDevClip);
1700 } 1705 }
1701 1706
1702 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 1707 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 crRet.fColor2 = 1.0f - crRet.fColor2; 1810 crRet.fColor2 = 1.0f - crRet.fColor2;
1806 crRet.fColor3 = 1.0f - crRet.fColor3; 1811 crRet.fColor3 = 1.0f - crRet.fColor3;
1807 crRet.fColor4 = 1.0f - crRet.fColor4; 1812 crRet.fColor4 = 1.0f - crRet.fColor4;
1808 break; 1813 break;
1809 } 1814 }
1810 1815
1811 return crRet; 1816 return crRet;
1812 } 1817 }
1813 1818
1814 CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, 1819 CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType,
1815 const CPDF_Rect& rect, 1820 const CFX_FloatRect& rect,
1816 const CPWL_Color& crFill, 1821 const CPWL_Color& crFill,
1817 const CPWL_Color& crStroke) { 1822 const CPWL_Color& crStroke) {
1818 CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE); 1823 CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE);
1819 sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE); 1824 sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE);
1820 1825
1821 CFX_ByteString sPath; 1826 CFX_ByteString sPath;
1822 CFX_PathData path; 1827 CFX_PathData path;
1823 1828
1824 switch (nType) { 1829 switch (nType) {
1825 case PWL_ICONTYPE_CHECKMARK: 1830 case PWL_ICONTYPE_CHECKMARK:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 sAppStream += "B*\n"; 1894 sAppStream += "B*\n";
1890 else 1895 else
1891 sAppStream += "f*\n"; 1896 sAppStream += "f*\n";
1892 1897
1893 return sAppStream; 1898 return sAppStream;
1894 } 1899 }
1895 1900
1896 void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice, 1901 void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice,
1897 CFX_Matrix* pUser2Device, 1902 CFX_Matrix* pUser2Device,
1898 int32_t nType, 1903 int32_t nType,
1899 const CPDF_Rect& rect, 1904 const CFX_FloatRect& rect,
1900 const CPWL_Color& crFill, 1905 const CPWL_Color& crFill,
1901 const CPWL_Color& crStroke, 1906 const CPWL_Color& crStroke,
1902 const int32_t nTransparancy) { 1907 const int32_t nTransparancy) {
1903 CFX_GraphStateData gsd; 1908 CFX_GraphStateData gsd;
1904 gsd.m_LineWidth = 1.0f; 1909 gsd.m_LineWidth = 1.0f;
1905 1910
1906 CFX_ByteString sPath; 1911 CFX_ByteString sPath;
1907 CFX_PathData path; 1912 CFX_PathData path;
1908 1913
1909 switch (nType) { 1914 switch (nType) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 return; 1976 return;
1972 } 1977 }
1973 1978
1974 pDevice->DrawPath( 1979 pDevice->DrawPath(
1975 &path, pUser2Device, &gsd, PWLColorToFXColor(crFill, nTransparancy), 1980 &path, pUser2Device, &gsd, PWLColorToFXColor(crFill, nTransparancy),
1976 PWLColorToFXColor(crStroke, nTransparancy), FXFILL_ALTERNATE); 1981 PWLColorToFXColor(crStroke, nTransparancy), FXFILL_ALTERNATE);
1977 } 1982 }
1978 1983
1979 void CPWL_Utils::GetGraphics_Checkmark(CFX_ByteString& sPathData, 1984 void CPWL_Utils::GetGraphics_Checkmark(CFX_ByteString& sPathData,
1980 CFX_PathData& path, 1985 CFX_PathData& path,
1981 const CPDF_Rect& crBBox, 1986 const CFX_FloatRect& crBBox,
1982 const PWL_PATH_TYPE type) { 1987 const PWL_PATH_TYPE type) {
1983 FX_FLOAT fWidth = crBBox.right - crBBox.left; 1988 FX_FLOAT fWidth = crBBox.right - crBBox.left;
1984 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 1989 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
1985 1990
1986 CPWL_PathData PathArray[] = { 1991 CPWL_PathData PathArray[] = {
1987 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, 1992 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f,
1988 crBBox.bottom + fHeight * 2 / 5.0f), 1993 crBBox.bottom + fHeight * 2 / 5.0f),
1989 PWLPT_MOVETO), 1994 PWLPT_MOVETO),
1990 CPWL_PathData( 1995 CPWL_PathData(
1991 CPWL_Point(crBBox.left + fWidth / 15.0f + 1996 CPWL_Point(crBBox.left + fWidth / 15.0f +
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 PWLPT_BEZIERTO)}; 2063 PWLPT_BEZIERTO)};
2059 2064
2060 if (type == PWLPT_STREAM) 2065 if (type == PWLPT_STREAM)
2061 sPathData = GetAppStreamFromArray(PathArray, 16); 2066 sPathData = GetAppStreamFromArray(PathArray, 16);
2062 else 2067 else
2063 GetPathDataFromArray(path, PathArray, 16); 2068 GetPathDataFromArray(path, PathArray, 16);
2064 } 2069 }
2065 2070
2066 void CPWL_Utils::GetGraphics_Circle(CFX_ByteString& sPathData, 2071 void CPWL_Utils::GetGraphics_Circle(CFX_ByteString& sPathData,
2067 CFX_PathData& path, 2072 CFX_PathData& path,
2068 const CPDF_Rect& crBBox, 2073 const CFX_FloatRect& crBBox,
2069 const PWL_PATH_TYPE type) { 2074 const PWL_PATH_TYPE type) {
2070 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2075 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2071 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2076 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2072 2077
2073 CPWL_PathData PathArray[] = { 2078 CPWL_PathData PathArray[] = {
2074 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f, 2079 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 15.0f,
2075 crBBox.bottom + fHeight / 2.0f), 2080 crBBox.bottom + fHeight / 2.0f),
2076 PWLPT_MOVETO), 2081 PWLPT_MOVETO),
2077 CPWL_PathData( 2082 CPWL_PathData(
2078 CPWL_Point(crBBox.left + fWidth / 15.0f, 2083 CPWL_Point(crBBox.left + fWidth / 15.0f,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 PWLPT_BEZIERTO)}; 2186 PWLPT_BEZIERTO)};
2182 2187
2183 if (type == PWLPT_STREAM) 2188 if (type == PWLPT_STREAM)
2184 sPathData = GetAppStreamFromArray(PathArray, 26); 2189 sPathData = GetAppStreamFromArray(PathArray, 26);
2185 else 2190 else
2186 GetPathDataFromArray(path, PathArray, 26); 2191 GetPathDataFromArray(path, PathArray, 26);
2187 } 2192 }
2188 2193
2189 void CPWL_Utils::GetGraphics_Comment(CFX_ByteString& sPathData, 2194 void CPWL_Utils::GetGraphics_Comment(CFX_ByteString& sPathData,
2190 CFX_PathData& path, 2195 CFX_PathData& path,
2191 const CPDF_Rect& crBBox, 2196 const CFX_FloatRect& crBBox,
2192 const PWL_PATH_TYPE type) { 2197 const PWL_PATH_TYPE type) {
2193 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2198 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2194 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2199 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2195 2200
2196 CPWL_PathData PathArray[] = { 2201 CPWL_PathData PathArray[] = {
2197 CPWL_PathData( 2202 CPWL_PathData(
2198 CPWL_Point(crBBox.left + fWidth / 15.0f, crBBox.top - fHeight / 6.0f), 2203 CPWL_Point(crBBox.left + fWidth / 15.0f, crBBox.top - fHeight / 6.0f),
2199 PWLPT_MOVETO), 2204 PWLPT_MOVETO),
2200 CPWL_PathData( 2205 CPWL_PathData(
2201 CPWL_Point(crBBox.left + fWidth / 15.0f, 2206 CPWL_Point(crBBox.left + fWidth / 15.0f,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 PWLPT_LINETO)}; 2305 PWLPT_LINETO)};
2301 2306
2302 if (type == PWLPT_STREAM) 2307 if (type == PWLPT_STREAM)
2303 sPathData = GetAppStreamFromArray(PathArray, 30); 2308 sPathData = GetAppStreamFromArray(PathArray, 30);
2304 else 2309 else
2305 GetPathDataFromArray(path, PathArray, 30); 2310 GetPathDataFromArray(path, PathArray, 30);
2306 } 2311 }
2307 2312
2308 void CPWL_Utils::GetGraphics_Cross(CFX_ByteString& sPathData, 2313 void CPWL_Utils::GetGraphics_Cross(CFX_ByteString& sPathData,
2309 CFX_PathData& path, 2314 CFX_PathData& path,
2310 const CPDF_Rect& crBBox, 2315 const CFX_FloatRect& crBBox,
2311 const PWL_PATH_TYPE type) { 2316 const PWL_PATH_TYPE type) {
2312 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2317 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2313 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2318 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2314 CPWL_Point center_point(crBBox.left + fWidth / 2, 2319 CPWL_Point center_point(crBBox.left + fWidth / 2,
2315 crBBox.bottom + fHeight / 2); 2320 crBBox.bottom + fHeight / 2);
2316 2321
2317 CPWL_PathData PathArray[] = { 2322 CPWL_PathData PathArray[] = {
2318 CPWL_PathData( 2323 CPWL_PathData(
2319 CPWL_Point(center_point.x, center_point.y + fHeight / 10.0f), 2324 CPWL_Point(center_point.x, center_point.y + fHeight / 10.0f),
2320 PWLPT_MOVETO), 2325 PWLPT_MOVETO),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 PWLPT_LINETO)}; 2362 PWLPT_LINETO)};
2358 2363
2359 if (type == PWLPT_STREAM) 2364 if (type == PWLPT_STREAM)
2360 sPathData = GetAppStreamFromArray(PathArray, 13); 2365 sPathData = GetAppStreamFromArray(PathArray, 13);
2361 else 2366 else
2362 GetPathDataFromArray(path, PathArray, 13); 2367 GetPathDataFromArray(path, PathArray, 13);
2363 } 2368 }
2364 2369
2365 void CPWL_Utils::GetGraphics_Help(CFX_ByteString& sPathData, 2370 void CPWL_Utils::GetGraphics_Help(CFX_ByteString& sPathData,
2366 CFX_PathData& path, 2371 CFX_PathData& path,
2367 const CPDF_Rect& crBBox, 2372 const CFX_FloatRect& crBBox,
2368 const PWL_PATH_TYPE type) { 2373 const PWL_PATH_TYPE type) {
2369 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2374 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2370 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2375 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2371 2376
2372 CPWL_PathData PathArray[] = { 2377 CPWL_PathData PathArray[] = {
2373 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60.0f, 2378 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60.0f,
2374 crBBox.bottom + fHeight / 2.0f), 2379 crBBox.bottom + fHeight / 2.0f),
2375 PWLPT_MOVETO), 2380 PWLPT_MOVETO),
2376 CPWL_PathData( 2381 CPWL_PathData(
2377 CPWL_Point(crBBox.left + fWidth / 60.0f, 2382 CPWL_Point(crBBox.left + fWidth / 60.0f,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 PWLPT_BEZIERTO)}; 2592 PWLPT_BEZIERTO)};
2588 2593
2589 if (type == PWLPT_STREAM) 2594 if (type == PWLPT_STREAM)
2590 sPathData = GetAppStreamFromArray(PathArray, 59); 2595 sPathData = GetAppStreamFromArray(PathArray, 59);
2591 else 2596 else
2592 GetPathDataFromArray(path, PathArray, 59); 2597 GetPathDataFromArray(path, PathArray, 59);
2593 } 2598 }
2594 2599
2595 void CPWL_Utils::GetGraphics_InsertText(CFX_ByteString& sPathData, 2600 void CPWL_Utils::GetGraphics_InsertText(CFX_ByteString& sPathData,
2596 CFX_PathData& path, 2601 CFX_PathData& path,
2597 const CPDF_Rect& crBBox, 2602 const CFX_FloatRect& crBBox,
2598 const PWL_PATH_TYPE type) { 2603 const PWL_PATH_TYPE type) {
2599 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2604 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2600 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2605 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2601 2606
2602 CPWL_PathData PathArray[] = { 2607 CPWL_PathData PathArray[] = {
2603 CPWL_PathData( 2608 CPWL_PathData(
2604 CPWL_Point(crBBox.left + fWidth / 10, crBBox.bottom + fHeight / 10), 2609 CPWL_Point(crBBox.left + fWidth / 10, crBBox.bottom + fHeight / 10),
2605 PWLPT_MOVETO), 2610 PWLPT_MOVETO),
2606 CPWL_PathData( 2611 CPWL_PathData(
2607 CPWL_Point(crBBox.left + fWidth / 2, crBBox.top - fHeight * 2 / 15), 2612 CPWL_Point(crBBox.left + fWidth / 2, crBBox.top - fHeight * 2 / 15),
2608 PWLPT_LINETO), 2613 PWLPT_LINETO),
2609 CPWL_PathData( 2614 CPWL_PathData(
2610 CPWL_Point(crBBox.right - fWidth / 10, crBBox.bottom + fHeight / 10), 2615 CPWL_Point(crBBox.right - fWidth / 10, crBBox.bottom + fHeight / 10),
2611 PWLPT_LINETO), 2616 PWLPT_LINETO),
2612 CPWL_PathData( 2617 CPWL_PathData(
2613 CPWL_Point(crBBox.left + fWidth / 10, crBBox.bottom + fHeight / 10), 2618 CPWL_Point(crBBox.left + fWidth / 10, crBBox.bottom + fHeight / 10),
2614 PWLPT_LINETO)}; 2619 PWLPT_LINETO)};
2615 2620
2616 if (type == PWLPT_STREAM) 2621 if (type == PWLPT_STREAM)
2617 sPathData = GetAppStreamFromArray(PathArray, 4); 2622 sPathData = GetAppStreamFromArray(PathArray, 4);
2618 else 2623 else
2619 GetPathDataFromArray(path, PathArray, 4); 2624 GetPathDataFromArray(path, PathArray, 4);
2620 } 2625 }
2621 2626
2622 void CPWL_Utils::GetGraphics_Key(CFX_ByteString& sPathData, 2627 void CPWL_Utils::GetGraphics_Key(CFX_ByteString& sPathData,
2623 CFX_PathData& path, 2628 CFX_PathData& path,
2624 const CPDF_Rect& crBBox, 2629 const CFX_FloatRect& crBBox,
2625 const PWL_PATH_TYPE type) { 2630 const PWL_PATH_TYPE type) {
2626 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2631 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2627 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2632 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2628 FX_FLOAT k = -fHeight / fWidth; 2633 FX_FLOAT k = -fHeight / fWidth;
2629 CPWL_Point tail; 2634 CPWL_Point tail;
2630 CPWL_Point CicleCenter; 2635 CPWL_Point CicleCenter;
2631 tail.x = crBBox.left + fWidth * 0.9f; 2636 tail.x = crBBox.left + fWidth * 0.9f;
2632 tail.y = k * (tail.x - crBBox.right) + crBBox.bottom; 2637 tail.y = k * (tail.x - crBBox.right) + crBBox.bottom;
2633 CicleCenter.x = crBBox.left + fWidth * 0.15f; 2638 CicleCenter.x = crBBox.left + fWidth * 0.15f;
2634 CicleCenter.y = k * (CicleCenter.x - crBBox.right) + crBBox.bottom; 2639 CicleCenter.y = k * (CicleCenter.x - crBBox.right) + crBBox.bottom;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2745 PWLPT_BEZIERTO)}; 2750 PWLPT_BEZIERTO)};
2746 2751
2747 if (type == PWLPT_STREAM) 2752 if (type == PWLPT_STREAM)
2748 sPathData = GetAppStreamFromArray(PathArray, 28); 2753 sPathData = GetAppStreamFromArray(PathArray, 28);
2749 else 2754 else
2750 GetPathDataFromArray(path, PathArray, 28); 2755 GetPathDataFromArray(path, PathArray, 28);
2751 } 2756 }
2752 2757
2753 void CPWL_Utils::GetGraphics_NewParagraph(CFX_ByteString& sPathData, 2758 void CPWL_Utils::GetGraphics_NewParagraph(CFX_ByteString& sPathData,
2754 CFX_PathData& path, 2759 CFX_PathData& path,
2755 const CPDF_Rect& crBBox, 2760 const CFX_FloatRect& crBBox,
2756 const PWL_PATH_TYPE type) { 2761 const PWL_PATH_TYPE type) {
2757 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2762 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2758 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2763 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2759 2764
2760 CPWL_PathData PathArray[] = { 2765 CPWL_PathData PathArray[] = {
2761 CPWL_PathData( 2766 CPWL_PathData(
2762 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 20.0f), 2767 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 20.0f),
2763 PWLPT_MOVETO), 2768 PWLPT_MOVETO),
2764 CPWL_PathData( 2769 CPWL_PathData(
2765 CPWL_Point(crBBox.left + fWidth / 10.0f, crBBox.top - fHeight / 2.0f), 2770 CPWL_Point(crBBox.left + fWidth / 10.0f, crBBox.top - fHeight / 2.0f),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 PWLPT_LINETO)}; 2854 PWLPT_LINETO)};
2850 2855
2851 if (type == PWLPT_STREAM) 2856 if (type == PWLPT_STREAM)
2852 sPathData = GetAppStreamFromArray(PathArray, 28); 2857 sPathData = GetAppStreamFromArray(PathArray, 28);
2853 else 2858 else
2854 GetPathDataFromArray(path, PathArray, 28); 2859 GetPathDataFromArray(path, PathArray, 28);
2855 } 2860 }
2856 2861
2857 void CPWL_Utils::GetGraphics_TextNote(CFX_ByteString& sPathData, 2862 void CPWL_Utils::GetGraphics_TextNote(CFX_ByteString& sPathData,
2858 CFX_PathData& path, 2863 CFX_PathData& path,
2859 const CPDF_Rect& crBBox, 2864 const CFX_FloatRect& crBBox,
2860 const PWL_PATH_TYPE type) { 2865 const PWL_PATH_TYPE type) {
2861 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2866 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2862 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2867 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2863 2868
2864 CPWL_PathData PathArray[] = { 2869 CPWL_PathData PathArray[] = {
2865 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 3 / 10.0f, 2870 CPWL_PathData(CPWL_Point(crBBox.right - fWidth * 3 / 10.0f,
2866 crBBox.bottom + fHeight / 15.0f), 2871 crBBox.bottom + fHeight / 15.0f),
2867 PWLPT_MOVETO), 2872 PWLPT_MOVETO),
2868 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 7 / 10.0f, 2873 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 7 / 10.0f,
2869 crBBox.bottom + fHeight * 4 / 15.0f), 2874 crBBox.bottom + fHeight * 4 / 15.0f),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2915 PWLPT_LINETO)}; 2920 PWLPT_LINETO)};
2916 2921
2917 if (type == PWLPT_STREAM) 2922 if (type == PWLPT_STREAM)
2918 sPathData = GetAppStreamFromArray(PathArray, 17); 2923 sPathData = GetAppStreamFromArray(PathArray, 17);
2919 else 2924 else
2920 GetPathDataFromArray(path, PathArray, 17); 2925 GetPathDataFromArray(path, PathArray, 17);
2921 } 2926 }
2922 2927
2923 void CPWL_Utils::GetGraphics_Paragraph(CFX_ByteString& sPathData, 2928 void CPWL_Utils::GetGraphics_Paragraph(CFX_ByteString& sPathData,
2924 CFX_PathData& path, 2929 CFX_PathData& path,
2925 const CPDF_Rect& crBBox, 2930 const CFX_FloatRect& crBBox,
2926 const PWL_PATH_TYPE type) { 2931 const PWL_PATH_TYPE type) {
2927 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2932 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2928 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2933 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2929 2934
2930 CPWL_PathData PathArray[] = { 2935 CPWL_PathData PathArray[] = {
2931 CPWL_PathData( 2936 CPWL_PathData(
2932 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f), 2937 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f),
2933 PWLPT_MOVETO), 2938 PWLPT_MOVETO),
2934 CPWL_PathData( 2939 CPWL_PathData(
2935 CPWL_Point(crBBox.left + fWidth * 0.7f, crBBox.top - fHeight / 15.0f), 2940 CPWL_Point(crBBox.left + fWidth * 0.7f, crBBox.top - fHeight / 15.0f),
(...skipping 30 matching lines...) Expand all
2966 PWLPT_BEZIERTO)}; 2971 PWLPT_BEZIERTO)};
2967 2972
2968 if (type == PWLPT_STREAM) 2973 if (type == PWLPT_STREAM)
2969 sPathData = GetAppStreamFromArray(PathArray, 12); 2974 sPathData = GetAppStreamFromArray(PathArray, 12);
2970 else 2975 else
2971 GetPathDataFromArray(path, PathArray, 12); 2976 GetPathDataFromArray(path, PathArray, 12);
2972 } 2977 }
2973 2978
2974 void CPWL_Utils::GetGraphics_RightArrow(CFX_ByteString& sPathData, 2979 void CPWL_Utils::GetGraphics_RightArrow(CFX_ByteString& sPathData,
2975 CFX_PathData& path, 2980 CFX_PathData& path,
2976 const CPDF_Rect& crBBox, 2981 const CFX_FloatRect& crBBox,
2977 const PWL_PATH_TYPE type) { 2982 const PWL_PATH_TYPE type) {
2978 FX_FLOAT fWidth = crBBox.right - crBBox.left; 2983 FX_FLOAT fWidth = crBBox.right - crBBox.left;
2979 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 2984 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
2980 2985
2981 CPWL_PathData PathArray[] = { 2986 CPWL_PathData PathArray[] = {
2982 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f, 2987 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 15.0f,
2983 crBBox.top - fHeight / 2.0f), 2988 crBBox.top - fHeight / 2.0f),
2984 PWLPT_MOVETO), 2989 PWLPT_MOVETO),
2985 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f + fWidth / 8.0f, 2990 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 2.0f + fWidth / 8.0f,
2986 crBBox.bottom + fHeight / 5.0f), 2991 crBBox.bottom + fHeight / 5.0f),
(...skipping 24 matching lines...) Expand all
3011 PWLPT_LINETO)}; 3016 PWLPT_LINETO)};
3012 3017
3013 if (type == PWLPT_STREAM) 3018 if (type == PWLPT_STREAM)
3014 sPathData = GetAppStreamFromArray(PathArray, 10); 3019 sPathData = GetAppStreamFromArray(PathArray, 10);
3015 else 3020 else
3016 GetPathDataFromArray(path, PathArray, 10); 3021 GetPathDataFromArray(path, PathArray, 10);
3017 } 3022 }
3018 3023
3019 void CPWL_Utils::GetGraphics_RightPointer(CFX_ByteString& sPathData, 3024 void CPWL_Utils::GetGraphics_RightPointer(CFX_ByteString& sPathData,
3020 CFX_PathData& path, 3025 CFX_PathData& path,
3021 const CPDF_Rect& crBBox, 3026 const CFX_FloatRect& crBBox,
3022 const PWL_PATH_TYPE type) { 3027 const PWL_PATH_TYPE type) {
3023 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3028 FX_FLOAT fWidth = crBBox.right - crBBox.left;
3024 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3029 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
3025 3030
3026 CPWL_PathData PathArray[] = { 3031 CPWL_PathData PathArray[] = {
3027 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30.0f, 3032 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30.0f,
3028 crBBox.top - fHeight / 2.0f), 3033 crBBox.top - fHeight / 2.0f),
3029 PWLPT_MOVETO), 3034 PWLPT_MOVETO),
3030 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 30.0f, 3035 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 30.0f,
3031 crBBox.bottom + fHeight / 6.0f), 3036 crBBox.bottom + fHeight / 6.0f),
3032 PWLPT_LINETO), 3037 PWLPT_LINETO),
3033 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 4 / 15.0f, 3038 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 4 / 15.0f,
3034 crBBox.top - fHeight / 2.0f), 3039 crBBox.top - fHeight / 2.0f),
3035 PWLPT_LINETO), 3040 PWLPT_LINETO),
3036 CPWL_PathData( 3041 CPWL_PathData(
3037 CPWL_Point(crBBox.left + fWidth / 30.0f, crBBox.top - fHeight / 6.0f), 3042 CPWL_Point(crBBox.left + fWidth / 30.0f, crBBox.top - fHeight / 6.0f),
3038 PWLPT_LINETO), 3043 PWLPT_LINETO),
3039 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30.0f, 3044 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 30.0f,
3040 crBBox.top - fHeight / 2.0f), 3045 crBBox.top - fHeight / 2.0f),
3041 PWLPT_LINETO)}; 3046 PWLPT_LINETO)};
3042 3047
3043 if (type == PWLPT_STREAM) 3048 if (type == PWLPT_STREAM)
3044 sPathData = GetAppStreamFromArray(PathArray, 5); 3049 sPathData = GetAppStreamFromArray(PathArray, 5);
3045 else 3050 else
3046 GetPathDataFromArray(path, PathArray, 5); 3051 GetPathDataFromArray(path, PathArray, 5);
3047 } 3052 }
3048 3053
3049 void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, 3054 void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData,
3050 CFX_PathData& path, 3055 CFX_PathData& path,
3051 const CPDF_Rect& crBBox, 3056 const CFX_FloatRect& crBBox,
3052 const PWL_PATH_TYPE type) { 3057 const PWL_PATH_TYPE type) {
3053 FX_FLOAT fLongRadius = 3058 FX_FLOAT fLongRadius =
3054 (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); 3059 (crBBox.top - crBBox.bottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f));
3055 fLongRadius = fLongRadius * 0.7f; 3060 fLongRadius = fLongRadius * 0.7f;
3056 FX_FLOAT fShortRadius = fLongRadius * 0.55f; 3061 FX_FLOAT fShortRadius = fLongRadius * 0.55f;
3057 CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f, 3062 CFX_FloatPoint ptCenter = CFX_FloatPoint((crBBox.left + crBBox.right) / 2.0f,
3058 (crBBox.top + crBBox.bottom) / 2.0f); 3063 (crBBox.top + crBBox.bottom) / 2.0f);
3059 3064
3060 FX_FLOAT px1[5], py1[5]; 3065 FX_FLOAT px1[5], py1[5];
3061 FX_FLOAT px2[5], py2[5]; 3066 FX_FLOAT px2[5], py2[5];
3062 3067
3063 FX_FLOAT fAngel = FX_PI / 10.0f; 3068 FX_FLOAT fAngel = FX_PI / 10.0f;
3064 3069
3065 for (int32_t i = 0; i < 5; i++) { 3070 for (int32_t i = 0; i < 5; i++) {
3066 px1[i] = ptCenter.x + fLongRadius * (FX_FLOAT)cos(fAngel); 3071 px1[i] = ptCenter.x + fLongRadius * (FX_FLOAT)cos(fAngel);
3067 py1[i] = ptCenter.y + fLongRadius * (FX_FLOAT)sin(fAngel); 3072 py1[i] = ptCenter.y + fLongRadius * (FX_FLOAT)sin(fAngel);
3068 3073
(...skipping 23 matching lines...) Expand all
3092 PathArray[10] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_LINETO); 3097 PathArray[10] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_LINETO);
3093 3098
3094 if (type == PWLPT_STREAM) 3099 if (type == PWLPT_STREAM)
3095 sPathData = GetAppStreamFromArray(PathArray, 11); 3100 sPathData = GetAppStreamFromArray(PathArray, 11);
3096 else 3101 else
3097 GetPathDataFromArray(path, PathArray, 11); 3102 GetPathDataFromArray(path, PathArray, 11);
3098 } 3103 }
3099 3104
3100 void CPWL_Utils::GetGraphics_UpArrow(CFX_ByteString& sPathData, 3105 void CPWL_Utils::GetGraphics_UpArrow(CFX_ByteString& sPathData,
3101 CFX_PathData& path, 3106 CFX_PathData& path,
3102 const CPDF_Rect& crBBox, 3107 const CFX_FloatRect& crBBox,
3103 const PWL_PATH_TYPE type) { 3108 const PWL_PATH_TYPE type) {
3104 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3109 FX_FLOAT fWidth = crBBox.right - crBBox.left;
3105 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3110 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
3106 3111
3107 CPWL_PathData PathArray[] = { 3112 CPWL_PathData PathArray[] = {
3108 CPWL_PathData( 3113 CPWL_PathData(
3109 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f), 3114 CPWL_Point(crBBox.left + fWidth / 2.0f, crBBox.top - fHeight / 15.0f),
3110 PWLPT_MOVETO), 3115 PWLPT_MOVETO),
3111 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 10.0f, 3116 CPWL_PathData(CPWL_Point(crBBox.right - fWidth / 10.0f,
3112 crBBox.top - fWidth * 3 / 5.0f), 3117 crBBox.top - fWidth * 3 / 5.0f),
(...skipping 18 matching lines...) Expand all
3131 PWLPT_LINETO)}; 3136 PWLPT_LINETO)};
3132 3137
3133 if (type == PWLPT_STREAM) 3138 if (type == PWLPT_STREAM)
3134 sPathData = GetAppStreamFromArray(PathArray, 8); 3139 sPathData = GetAppStreamFromArray(PathArray, 8);
3135 else 3140 else
3136 GetPathDataFromArray(path, PathArray, 8); 3141 GetPathDataFromArray(path, PathArray, 8);
3137 } 3142 }
3138 3143
3139 void CPWL_Utils::GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, 3144 void CPWL_Utils::GetGraphics_UpLeftArrow(CFX_ByteString& sPathData,
3140 CFX_PathData& path, 3145 CFX_PathData& path,
3141 const CPDF_Rect& crBBox, 3146 const CFX_FloatRect& crBBox,
3142 const PWL_PATH_TYPE type) { 3147 const PWL_PATH_TYPE type) {
3143 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3148 FX_FLOAT fWidth = crBBox.right - crBBox.left;
3144 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3149 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
3145 CPWL_Point leftup(crBBox.left, crBBox.top); 3150 CPWL_Point leftup(crBBox.left, crBBox.top);
3146 CPWL_Point rightdown(crBBox.right, crBBox.bottom); 3151 CPWL_Point rightdown(crBBox.right, crBBox.bottom);
3147 FX_FLOAT k = -fHeight / fWidth; 3152 FX_FLOAT k = -fHeight / fWidth;
3148 CPWL_Point tail; 3153 CPWL_Point tail;
3149 tail.x = crBBox.left + fWidth * 4 / 5.0f; 3154 tail.x = crBBox.left + fWidth * 4 / 5.0f;
3150 tail.y = k * (tail.x - crBBox.right) + rightdown.y; 3155 tail.y = k * (tail.x - crBBox.right) + rightdown.y;
3151 3156
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 PWLPT_LINETO)}; 3191 PWLPT_LINETO)};
3187 3192
3188 if (type == PWLPT_STREAM) 3193 if (type == PWLPT_STREAM)
3189 sPathData = GetAppStreamFromArray(PathArray, 8); 3194 sPathData = GetAppStreamFromArray(PathArray, 8);
3190 else 3195 else
3191 GetPathDataFromArray(path, PathArray, 8); 3196 GetPathDataFromArray(path, PathArray, 8);
3192 } 3197 }
3193 3198
3194 void CPWL_Utils::GetGraphics_Graph(CFX_ByteString& sPathData, 3199 void CPWL_Utils::GetGraphics_Graph(CFX_ByteString& sPathData,
3195 CFX_PathData& path, 3200 CFX_PathData& path,
3196 const CPDF_Rect& crBBox, 3201 const CFX_FloatRect& crBBox,
3197 const PWL_PATH_TYPE type) { 3202 const PWL_PATH_TYPE type) {
3198 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3203 FX_FLOAT fWidth = crBBox.right - crBBox.left;
3199 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3204 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
3200 3205
3201 CPWL_PathData PathArray[] = { 3206 CPWL_PathData PathArray[] = {
3202 CPWL_PathData( 3207 CPWL_PathData(
3203 CPWL_Point(crBBox.left + fWidth * 0.05f, crBBox.top - fWidth * 0.15f), 3208 CPWL_Point(crBBox.left + fWidth * 0.05f, crBBox.top - fWidth * 0.15f),
3204 PWLPT_MOVETO), 3209 PWLPT_MOVETO),
3205 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.25f, 3210 CPWL_PathData(CPWL_Point(crBBox.left + fWidth * 0.25f,
3206 crBBox.top - fHeight * 0.15f), 3211 crBBox.top - fHeight * 0.15f),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3264 PWLPT_LINETO)}; 3269 PWLPT_LINETO)};
3265 3270
3266 if (type == PWLPT_STREAM) 3271 if (type == PWLPT_STREAM)
3267 sPathData = GetAppStreamFromArray(PathArray, 20); 3272 sPathData = GetAppStreamFromArray(PathArray, 20);
3268 else 3273 else
3269 GetPathDataFromArray(path, PathArray, 20); 3274 GetPathDataFromArray(path, PathArray, 20);
3270 } 3275 }
3271 3276
3272 void CPWL_Utils::GetGraphics_Paperclip(CFX_ByteString& sPathData, 3277 void CPWL_Utils::GetGraphics_Paperclip(CFX_ByteString& sPathData,
3273 CFX_PathData& path, 3278 CFX_PathData& path,
3274 const CPDF_Rect& crBBox, 3279 const CFX_FloatRect& crBBox,
3275 const PWL_PATH_TYPE type) { 3280 const PWL_PATH_TYPE type) {
3276 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3281 FX_FLOAT fWidth = crBBox.right - crBBox.left;
3277 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3282 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
3278 3283
3279 CPWL_PathData PathArray[] = { 3284 CPWL_PathData PathArray[] = {
3280 CPWL_PathData( 3285 CPWL_PathData(
3281 CPWL_Point(crBBox.left + fWidth / 60, crBBox.top - fHeight * 0.25f), 3286 CPWL_Point(crBBox.left + fWidth / 60, crBBox.top - fHeight * 0.25f),
3282 PWLPT_MOVETO), 3287 PWLPT_MOVETO),
3283 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60, 3288 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 60,
3284 crBBox.bottom + fHeight * 0.25f), 3289 crBBox.bottom + fHeight * 0.25f),
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 PWLPT_BEZIERTO)}; 3412 PWLPT_BEZIERTO)};
3408 3413
3409 if (type == PWLPT_STREAM) 3414 if (type == PWLPT_STREAM)
3410 sPathData = GetAppStreamFromArray(PathArray, 33); 3415 sPathData = GetAppStreamFromArray(PathArray, 33);
3411 else 3416 else
3412 GetPathDataFromArray(path, PathArray, 33); 3417 GetPathDataFromArray(path, PathArray, 33);
3413 } 3418 }
3414 3419
3415 void CPWL_Utils::GetGraphics_Attachment(CFX_ByteString& sPathData, 3420 void CPWL_Utils::GetGraphics_Attachment(CFX_ByteString& sPathData,
3416 CFX_PathData& path, 3421 CFX_PathData& path,
3417 const CPDF_Rect& crBBox, 3422 const CFX_FloatRect& crBBox,
3418 const PWL_PATH_TYPE type) { 3423 const PWL_PATH_TYPE type) {
3419 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3424 FX_FLOAT fWidth = crBBox.right - crBBox.left;
3420 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3425 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
3421 3426
3422 CPWL_PathData PathArray[] = { 3427 CPWL_PathData PathArray[] = {
3423 CPWL_PathData( 3428 CPWL_PathData(
3424 CPWL_Point(crBBox.left + fWidth * 0.25f, crBBox.top - fHeight * 0.1f), 3429 CPWL_Point(crBBox.left + fWidth * 0.25f, crBBox.top - fHeight * 0.1f),
3425 PWLPT_MOVETO), 3430 PWLPT_MOVETO),
3426 CPWL_PathData( 3431 CPWL_PathData(
3427 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.23f), 3432 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.23f),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
3503 PWLPT_LINETO)}; 3508 PWLPT_LINETO)};
3504 3509
3505 if (type == PWLPT_STREAM) 3510 if (type == PWLPT_STREAM)
3506 sPathData = GetAppStreamFromArray(PathArray, 24); 3511 sPathData = GetAppStreamFromArray(PathArray, 24);
3507 else 3512 else
3508 GetPathDataFromArray(path, PathArray, 24); 3513 GetPathDataFromArray(path, PathArray, 24);
3509 } 3514 }
3510 3515
3511 void CPWL_Utils::GetGraphics_Tag(CFX_ByteString& sPathData, 3516 void CPWL_Utils::GetGraphics_Tag(CFX_ByteString& sPathData,
3512 CFX_PathData& path, 3517 CFX_PathData& path,
3513 const CPDF_Rect& crBBox, 3518 const CFX_FloatRect& crBBox,
3514 const PWL_PATH_TYPE type) { 3519 const PWL_PATH_TYPE type) {
3515 FX_FLOAT fWidth = crBBox.right - crBBox.left; 3520 FX_FLOAT fWidth = crBBox.right - crBBox.left;
3516 FX_FLOAT fHeight = crBBox.top - crBBox.bottom; 3521 FX_FLOAT fHeight = crBBox.top - crBBox.bottom;
3517 3522
3518 CPWL_PathData PathArray[] = { 3523 CPWL_PathData PathArray[] = {
3519 CPWL_PathData( 3524 CPWL_PathData(
3520 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.1f), 3525 CPWL_Point(crBBox.left + fWidth * 0.4f, crBBox.top - fHeight * 0.1f),
3521 PWLPT_MOVETO), 3526 PWLPT_MOVETO),
3522 CPWL_PathData( 3527 CPWL_PathData(
3523 CPWL_Point(crBBox.left + fWidth * 0.1f, crBBox.top - fHeight * 0.5f), 3528 CPWL_Point(crBBox.left + fWidth * 0.1f, crBBox.top - fHeight * 0.5f),
(...skipping 30 matching lines...) Expand all
3554 PWLPT_LINETO)}; 3559 PWLPT_LINETO)};
3555 3560
3556 if (type == PWLPT_STREAM) 3561 if (type == PWLPT_STREAM)
3557 sPathData = GetAppStreamFromArray(PathArray, 12); 3562 sPathData = GetAppStreamFromArray(PathArray, 12);
3558 else 3563 else
3559 GetPathDataFromArray(path, PathArray, 12); 3564 GetPathDataFromArray(path, PathArray, 12);
3560 } 3565 }
3561 3566
3562 void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, 3567 void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData,
3563 CFX_PathData& path, 3568 CFX_PathData& path,
3564 const CPDF_Rect& crBBox, 3569 const CFX_FloatRect& crBBox,
3565 const PWL_PATH_TYPE type) { 3570 const PWL_PATH_TYPE type) {
3566 FX_FLOAT fOutWidth = crBBox.right - crBBox.left; 3571 FX_FLOAT fOutWidth = crBBox.right - crBBox.left;
3567 FX_FLOAT fOutHeight = crBBox.top - crBBox.bottom; 3572 FX_FLOAT fOutHeight = crBBox.top - crBBox.bottom;
3568 3573
3569 CPDF_Rect crInBox = crBBox; 3574 CFX_FloatRect crInBox = crBBox;
3570 crInBox.left = crBBox.left + fOutWidth * 0.08f; 3575 crInBox.left = crBBox.left + fOutWidth * 0.08f;
3571 crInBox.right = crBBox.right - fOutWidth * 0.08f; 3576 crInBox.right = crBBox.right - fOutWidth * 0.08f;
3572 crInBox.top = crBBox.top - fOutHeight * 0.08f; 3577 crInBox.top = crBBox.top - fOutHeight * 0.08f;
3573 crInBox.bottom = crBBox.bottom + fOutHeight * 0.08f; 3578 crInBox.bottom = crBBox.bottom + fOutHeight * 0.08f;
3574 3579
3575 FX_FLOAT fWidth = crInBox.right - crInBox.left; 3580 FX_FLOAT fWidth = crInBox.right - crInBox.left;
3576 FX_FLOAT fHeight = crInBox.top - crInBox.bottom; 3581 FX_FLOAT fHeight = crInBox.top - crInBox.bottom;
3577 3582
3578 CPWL_PathData PathArray[] = { 3583 CPWL_PathData PathArray[] = {
3579 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top), PWLPT_MOVETO), 3584 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top), PWLPT_MOVETO),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
3672 break; 3677 break;
3673 case COLORTYPE_RGB: 3678 case COLORTYPE_RGB:
3674 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, 3679 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4,
3675 fColor1, fColor2, fColor3); 3680 fColor1, fColor2, fColor3);
3676 break; 3681 break;
3677 } 3682 }
3678 break; 3683 break;
3679 } 3684 }
3680 nColorType = other_nColorType; 3685 nColorType = other_nColorType;
3681 } 3686 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Wnd.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698