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

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

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