| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fxge/cfx_pathdata.h" | 7 #include "core/fxge/cfx_pathdata.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/fx_system.h" | 9 #include "core/fxcrt/fx_system.h" |
| 10 #include "third_party/base/numerics/safe_math.h" | 10 #include "third_party/base/numerics/safe_math.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 FX_FLOAT start_x, | 153 FX_FLOAT start_x, |
| 154 FX_FLOAT start_y, | 154 FX_FLOAT start_y, |
| 155 FX_FLOAT middle_x, | 155 FX_FLOAT middle_x, |
| 156 FX_FLOAT middle_y, | 156 FX_FLOAT middle_y, |
| 157 FX_FLOAT end_x, | 157 FX_FLOAT end_x, |
| 158 FX_FLOAT end_y, | 158 FX_FLOAT end_y, |
| 159 FX_FLOAT half_width, | 159 FX_FLOAT half_width, |
| 160 FX_FLOAT miter_limit) { | 160 FX_FLOAT miter_limit) { |
| 161 FX_FLOAT start_k = 0, start_c = 0, end_k = 0, end_c = 0, start_len = 0, | 161 FX_FLOAT start_k = 0, start_c = 0, end_k = 0, end_c = 0, start_len = 0, |
| 162 start_dc = 0, end_len = 0, end_dc = 0; | 162 start_dc = 0, end_len = 0, end_dc = 0; |
| 163 FX_BOOL bStartVert = FXSYS_fabs(start_x - middle_x) < 1.0f / 20; | 163 bool bStartVert = FXSYS_fabs(start_x - middle_x) < 1.0f / 20; |
| 164 FX_BOOL bEndVert = FXSYS_fabs(middle_x - end_x) < 1.0f / 20; | 164 bool bEndVert = FXSYS_fabs(middle_x - end_x) < 1.0f / 20; |
| 165 if (bStartVert && bEndVert) { | 165 if (bStartVert && bEndVert) { |
| 166 int start_dir = middle_y > start_y ? 1 : -1; | 166 int start_dir = middle_y > start_y ? 1 : -1; |
| 167 FX_FLOAT point_y = middle_y + half_width * start_dir; | 167 FX_FLOAT point_y = middle_y + half_width * start_dir; |
| 168 rect.UpdateRect(middle_x + half_width, point_y); | 168 rect.UpdateRect(middle_x + half_width, point_y); |
| 169 rect.UpdateRect(middle_x - half_width, point_y); | 169 rect.UpdateRect(middle_x - half_width, point_y); |
| 170 return; | 170 return; |
| 171 } | 171 } |
| 172 if (!bStartVert) { | 172 if (!bStartVert) { |
| 173 start_k = (middle_y - start_y) / (middle_x - start_x); | 173 start_k = (middle_y - start_y) / (middle_x - start_x); |
| 174 start_c = middle_y - (start_k * middle_x); | 174 start_c = middle_y - (start_k * middle_x); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width, | 245 CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width, |
| 246 FX_FLOAT miter_limit) const { | 246 FX_FLOAT miter_limit) const { |
| 247 CFX_FloatRect rect(100000 * 1.0f, 100000 * 1.0f, -100000 * 1.0f, | 247 CFX_FloatRect rect(100000 * 1.0f, 100000 * 1.0f, -100000 * 1.0f, |
| 248 -100000 * 1.0f); | 248 -100000 * 1.0f); |
| 249 int iPoint = 0; | 249 int iPoint = 0; |
| 250 FX_FLOAT half_width = line_width; | 250 FX_FLOAT half_width = line_width; |
| 251 int iStartPoint = 0; | 251 int iStartPoint = 0; |
| 252 int iEndPoint = 0; | 252 int iEndPoint = 0; |
| 253 int iMiddlePoint = 0; | 253 int iMiddlePoint = 0; |
| 254 FX_BOOL bJoin; | 254 bool bJoin; |
| 255 while (iPoint < m_PointCount) { | 255 while (iPoint < m_PointCount) { |
| 256 if (m_pPoints[iPoint].m_Flag == FXPT_MOVETO) { | 256 if (m_pPoints[iPoint].m_Flag == FXPT_MOVETO) { |
| 257 iStartPoint = iPoint + 1; | 257 iStartPoint = iPoint + 1; |
| 258 iEndPoint = iPoint; | 258 iEndPoint = iPoint; |
| 259 bJoin = FALSE; | 259 bJoin = false; |
| 260 } else { | 260 } else { |
| 261 if (m_pPoints[iPoint].m_Flag == FXPT_BEZIERTO) { | 261 if (m_pPoints[iPoint].m_Flag == FXPT_BEZIERTO) { |
| 262 rect.UpdateRect(m_pPoints[iPoint].m_PointX, m_pPoints[iPoint].m_PointY); | 262 rect.UpdateRect(m_pPoints[iPoint].m_PointX, m_pPoints[iPoint].m_PointY); |
| 263 rect.UpdateRect(m_pPoints[iPoint + 1].m_PointX, | 263 rect.UpdateRect(m_pPoints[iPoint + 1].m_PointX, |
| 264 m_pPoints[iPoint + 1].m_PointY); | 264 m_pPoints[iPoint + 1].m_PointY); |
| 265 iPoint += 2; | 265 iPoint += 2; |
| 266 } | 266 } |
| 267 if (iPoint == m_PointCount - 1 || | 267 if (iPoint == m_PointCount - 1 || |
| 268 m_pPoints[iPoint + 1].m_Flag == FXPT_MOVETO) { | 268 m_pPoints[iPoint + 1].m_Flag == FXPT_MOVETO) { |
| 269 iStartPoint = iPoint - 1; | 269 iStartPoint = iPoint - 1; |
| 270 iEndPoint = iPoint; | 270 iEndPoint = iPoint; |
| 271 bJoin = FALSE; | 271 bJoin = false; |
| 272 } else { | 272 } else { |
| 273 iStartPoint = iPoint - 1; | 273 iStartPoint = iPoint - 1; |
| 274 iMiddlePoint = iPoint; | 274 iMiddlePoint = iPoint; |
| 275 iEndPoint = iPoint + 1; | 275 iEndPoint = iPoint + 1; |
| 276 bJoin = TRUE; | 276 bJoin = true; |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 FX_FLOAT start_x = m_pPoints[iStartPoint].m_PointX; | 279 FX_FLOAT start_x = m_pPoints[iStartPoint].m_PointX; |
| 280 FX_FLOAT start_y = m_pPoints[iStartPoint].m_PointY; | 280 FX_FLOAT start_y = m_pPoints[iStartPoint].m_PointY; |
| 281 FX_FLOAT end_x = m_pPoints[iEndPoint].m_PointX; | 281 FX_FLOAT end_x = m_pPoints[iEndPoint].m_PointX; |
| 282 FX_FLOAT end_y = m_pPoints[iEndPoint].m_PointY; | 282 FX_FLOAT end_y = m_pPoints[iEndPoint].m_PointY; |
| 283 if (bJoin) { | 283 if (bJoin) { |
| 284 FX_FLOAT middle_x = m_pPoints[iMiddlePoint].m_PointX; | 284 FX_FLOAT middle_x = m_pPoints[iMiddlePoint].m_PointX; |
| 285 FX_FLOAT middle_y = m_pPoints[iMiddlePoint].m_PointY; | 285 FX_FLOAT middle_y = m_pPoints[iMiddlePoint].m_PointY; |
| 286 _UpdateLineJoinPoints(rect, start_x, start_y, middle_x, middle_y, end_x, | 286 _UpdateLineJoinPoints(rect, start_x, start_y, middle_x, middle_y, end_x, |
| 287 end_y, half_width, miter_limit); | 287 end_y, half_width, miter_limit); |
| 288 } else { | 288 } else { |
| 289 _UpdateLineEndPoints(rect, start_x, start_y, end_x, end_y, half_width); | 289 _UpdateLineEndPoints(rect, start_x, start_y, end_x, end_y, half_width); |
| 290 } | 290 } |
| 291 iPoint++; | 291 iPoint++; |
| 292 } | 292 } |
| 293 return rect; | 293 return rect; |
| 294 } | 294 } |
| 295 | 295 |
| 296 void CFX_PathData::Transform(const CFX_Matrix* pMatrix) { | 296 void CFX_PathData::Transform(const CFX_Matrix* pMatrix) { |
| 297 if (!pMatrix) { | 297 if (!pMatrix) { |
| 298 return; | 298 return; |
| 299 } | 299 } |
| 300 for (int i = 0; i < m_PointCount; i++) { | 300 for (int i = 0; i < m_PointCount; i++) { |
| 301 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); | 301 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 FX_BOOL CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, | 305 bool CFX_PathData::GetZeroAreaPath(CFX_PathData& NewPath, |
| 306 CFX_Matrix* pMatrix, | 306 CFX_Matrix* pMatrix, |
| 307 FX_BOOL& bThin, | 307 bool& bThin, |
| 308 FX_BOOL bAdjust) const { | 308 bool bAdjust) const { |
| 309 if (m_PointCount < 3) { | 309 if (m_PointCount < 3) { |
| 310 return FALSE; | 310 return false; |
| 311 } | 311 } |
| 312 if (m_PointCount == 3 && (m_pPoints[0].m_Flag & FXPT_TYPE) == FXPT_MOVETO && | 312 if (m_PointCount == 3 && (m_pPoints[0].m_Flag & FXPT_TYPE) == FXPT_MOVETO && |
| 313 (m_pPoints[1].m_Flag & FXPT_TYPE) == FXPT_LINETO && | 313 (m_pPoints[1].m_Flag & FXPT_TYPE) == FXPT_LINETO && |
| 314 (m_pPoints[2].m_Flag & FXPT_TYPE) == FXPT_LINETO && | 314 (m_pPoints[2].m_Flag & FXPT_TYPE) == FXPT_LINETO && |
| 315 m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && | 315 m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && |
| 316 m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) { | 316 m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) { |
| 317 NewPath.AddPointCount(2); | 317 NewPath.AddPointCount(2); |
| 318 if (bAdjust) { | 318 if (bAdjust) { |
| 319 if (pMatrix) { | 319 if (pMatrix) { |
| 320 FX_FLOAT x = m_pPoints[0].m_PointX, y = m_pPoints[0].m_PointY; | 320 FX_FLOAT x = m_pPoints[0].m_PointX, y = m_pPoints[0].m_PointY; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 337 NewPath.SetPoint(1, x, y, FXPT_LINETO); | 337 NewPath.SetPoint(1, x, y, FXPT_LINETO); |
| 338 } | 338 } |
| 339 } else { | 339 } else { |
| 340 NewPath.SetPoint(0, m_pPoints[0].m_PointX, m_pPoints[0].m_PointY, | 340 NewPath.SetPoint(0, m_pPoints[0].m_PointX, m_pPoints[0].m_PointY, |
| 341 FXPT_MOVETO); | 341 FXPT_MOVETO); |
| 342 NewPath.SetPoint(1, m_pPoints[1].m_PointX, m_pPoints[1].m_PointY, | 342 NewPath.SetPoint(1, m_pPoints[1].m_PointX, m_pPoints[1].m_PointY, |
| 343 FXPT_LINETO); | 343 FXPT_LINETO); |
| 344 } | 344 } |
| 345 if (m_pPoints[0].m_PointX != m_pPoints[1].m_PointX && | 345 if (m_pPoints[0].m_PointX != m_pPoints[1].m_PointX && |
| 346 m_pPoints[0].m_PointY != m_pPoints[1].m_PointY) { | 346 m_pPoints[0].m_PointY != m_pPoints[1].m_PointY) { |
| 347 bThin = TRUE; | 347 bThin = true; |
| 348 } | 348 } |
| 349 return TRUE; | 349 return true; |
| 350 } | 350 } |
| 351 if (((m_PointCount > 3) && (m_PointCount % 2))) { | 351 if (((m_PointCount > 3) && (m_PointCount % 2))) { |
| 352 int mid = m_PointCount / 2; | 352 int mid = m_PointCount / 2; |
| 353 FX_BOOL bZeroArea = FALSE; | 353 bool bZeroArea = false; |
| 354 CFX_PathData t_path; | 354 CFX_PathData t_path; |
| 355 for (int i = 0; i < mid; i++) { | 355 for (int i = 0; i < mid; i++) { |
| 356 if (!(m_pPoints[mid - i - 1].m_PointX == | 356 if (!(m_pPoints[mid - i - 1].m_PointX == |
| 357 m_pPoints[mid + i + 1].m_PointX && | 357 m_pPoints[mid + i + 1].m_PointX && |
| 358 m_pPoints[mid - i - 1].m_PointY == | 358 m_pPoints[mid - i - 1].m_PointY == |
| 359 m_pPoints[mid + i + 1].m_PointY && | 359 m_pPoints[mid + i + 1].m_PointY && |
| 360 ((m_pPoints[mid - i - 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO && | 360 ((m_pPoints[mid - i - 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO && |
| 361 (m_pPoints[mid + i + 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO))) { | 361 (m_pPoints[mid + i + 1].m_Flag & FXPT_TYPE) != FXPT_BEZIERTO))) { |
| 362 bZeroArea = TRUE; | 362 bZeroArea = true; |
| 363 break; | 363 break; |
| 364 } | 364 } |
| 365 int new_count = t_path.GetPointCount(); | 365 int new_count = t_path.GetPointCount(); |
| 366 t_path.AddPointCount(2); | 366 t_path.AddPointCount(2); |
| 367 t_path.SetPoint(new_count, m_pPoints[mid - i].m_PointX, | 367 t_path.SetPoint(new_count, m_pPoints[mid - i].m_PointX, |
| 368 m_pPoints[mid - i].m_PointY, FXPT_MOVETO); | 368 m_pPoints[mid - i].m_PointY, FXPT_MOVETO); |
| 369 t_path.SetPoint(new_count + 1, m_pPoints[mid - i - 1].m_PointX, | 369 t_path.SetPoint(new_count + 1, m_pPoints[mid - i - 1].m_PointX, |
| 370 m_pPoints[mid - i - 1].m_PointY, FXPT_LINETO); | 370 m_pPoints[mid - i - 1].m_PointY, FXPT_LINETO); |
| 371 } | 371 } |
| 372 if (!bZeroArea) { | 372 if (!bZeroArea) { |
| 373 NewPath.Append(&t_path, nullptr); | 373 NewPath.Append(&t_path, nullptr); |
| 374 bThin = TRUE; | 374 bThin = true; |
| 375 return TRUE; | 375 return true; |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 int stratPoint = 0; | 378 int stratPoint = 0; |
| 379 int next = 0, i; | 379 int next = 0, i; |
| 380 for (i = 0; i < m_PointCount; i++) { | 380 for (i = 0; i < m_PointCount; i++) { |
| 381 int point_type = m_pPoints[i].m_Flag & FXPT_TYPE; | 381 int point_type = m_pPoints[i].m_Flag & FXPT_TYPE; |
| 382 if (point_type == FXPT_MOVETO) { | 382 if (point_type == FXPT_MOVETO) { |
| 383 stratPoint = i; | 383 stratPoint = i; |
| 384 } else if (point_type == FXPT_LINETO) { | 384 } else if (point_type == FXPT_LINETO) { |
| 385 next = (i + 1 - stratPoint) % (m_PointCount - stratPoint) + stratPoint; | 385 next = (i + 1 - stratPoint) % (m_PointCount - stratPoint) + stratPoint; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 (m_pPoints[next].m_Flag & FXPT_TYPE) == FXPT_LINETO && | 423 (m_pPoints[next].m_Flag & FXPT_TYPE) == FXPT_LINETO && |
| 424 m_pPoints[i - 1].m_PointX == m_pPoints[next].m_PointX && | 424 m_pPoints[i - 1].m_PointX == m_pPoints[next].m_PointX && |
| 425 m_pPoints[i - 1].m_PointY == m_pPoints[next].m_PointY && | 425 m_pPoints[i - 1].m_PointY == m_pPoints[next].m_PointY && |
| 426 m_pPoints[next].m_Flag & FXPT_CLOSEFIGURE) { | 426 m_pPoints[next].m_Flag & FXPT_CLOSEFIGURE) { |
| 427 int new_count = NewPath.GetPointCount(); | 427 int new_count = NewPath.GetPointCount(); |
| 428 NewPath.AddPointCount(2); | 428 NewPath.AddPointCount(2); |
| 429 NewPath.SetPoint(new_count, m_pPoints[i - 1].m_PointX, | 429 NewPath.SetPoint(new_count, m_pPoints[i - 1].m_PointX, |
| 430 m_pPoints[i - 1].m_PointY, FXPT_MOVETO); | 430 m_pPoints[i - 1].m_PointY, FXPT_MOVETO); |
| 431 NewPath.SetPoint(new_count + 1, m_pPoints[i].m_PointX, | 431 NewPath.SetPoint(new_count + 1, m_pPoints[i].m_PointX, |
| 432 m_pPoints[i].m_PointY, FXPT_LINETO); | 432 m_pPoints[i].m_PointY, FXPT_LINETO); |
| 433 bThin = TRUE; | 433 bThin = true; |
| 434 } | 434 } |
| 435 } | 435 } |
| 436 } else if (point_type == FXPT_BEZIERTO) { | 436 } else if (point_type == FXPT_BEZIERTO) { |
| 437 i += 2; | 437 i += 2; |
| 438 continue; | 438 continue; |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 if (m_PointCount > 3 && NewPath.GetPointCount()) { | 441 if (m_PointCount > 3 && NewPath.GetPointCount()) { |
| 442 bThin = TRUE; | 442 bThin = true; |
| 443 } | 443 } |
| 444 if (NewPath.GetPointCount() == 0) { | 444 if (NewPath.GetPointCount() == 0) { |
| 445 return FALSE; | 445 return false; |
| 446 } | 446 } |
| 447 return TRUE; | 447 return true; |
| 448 } | 448 } |
| 449 | 449 |
| 450 FX_BOOL CFX_PathData::IsRect() const { | 450 bool CFX_PathData::IsRect() const { |
| 451 if (m_PointCount != 5 && m_PointCount != 4) { | 451 if (m_PointCount != 5 && m_PointCount != 4) { |
| 452 return FALSE; | 452 return false; |
| 453 } | 453 } |
| 454 if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX || | 454 if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX || |
| 455 m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) || | 455 m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) || |
| 456 (m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && | 456 (m_pPoints[0].m_PointX == m_pPoints[2].m_PointX && |
| 457 m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) || | 457 m_pPoints[0].m_PointY == m_pPoints[2].m_PointY) || |
| 458 (m_pPoints[1].m_PointX == m_pPoints[3].m_PointX && | 458 (m_pPoints[1].m_PointX == m_pPoints[3].m_PointX && |
| 459 m_pPoints[1].m_PointY == m_pPoints[3].m_PointY)) { | 459 m_pPoints[1].m_PointY == m_pPoints[3].m_PointY)) { |
| 460 return FALSE; | 460 return false; |
| 461 } | 461 } |
| 462 if (m_pPoints[0].m_PointX != m_pPoints[3].m_PointX && | 462 if (m_pPoints[0].m_PointX != m_pPoints[3].m_PointX && |
| 463 m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) { | 463 m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) { |
| 464 return FALSE; | 464 return false; |
| 465 } | 465 } |
| 466 for (int i = 1; i < 4; i++) { | 466 for (int i = 1; i < 4; i++) { |
| 467 if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) { | 467 if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) { |
| 468 return FALSE; | 468 return false; |
| 469 } | 469 } |
| 470 if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX && | 470 if (m_pPoints[i].m_PointX != m_pPoints[i - 1].m_PointX && |
| 471 m_pPoints[i].m_PointY != m_pPoints[i - 1].m_PointY) { | 471 m_pPoints[i].m_PointY != m_pPoints[i - 1].m_PointY) { |
| 472 return FALSE; | 472 return false; |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE); | 475 return m_PointCount == 5 || (m_pPoints[3].m_Flag & FXPT_CLOSEFIGURE); |
| 476 } | 476 } |
| 477 | 477 |
| 478 FX_BOOL CFX_PathData::IsRect(const CFX_Matrix* pMatrix, | 478 bool CFX_PathData::IsRect(const CFX_Matrix* pMatrix, |
| 479 CFX_FloatRect* pRect) const { | 479 CFX_FloatRect* pRect) const { |
| 480 if (!pMatrix) { | 480 if (!pMatrix) { |
| 481 if (!IsRect()) { | 481 if (!IsRect()) { |
| 482 return FALSE; | 482 return false; |
| 483 } | 483 } |
| 484 if (pRect) { | 484 if (pRect) { |
| 485 pRect->left = m_pPoints[0].m_PointX; | 485 pRect->left = m_pPoints[0].m_PointX; |
| 486 pRect->right = m_pPoints[2].m_PointX; | 486 pRect->right = m_pPoints[2].m_PointX; |
| 487 pRect->bottom = m_pPoints[0].m_PointY; | 487 pRect->bottom = m_pPoints[0].m_PointY; |
| 488 pRect->top = m_pPoints[2].m_PointY; | 488 pRect->top = m_pPoints[2].m_PointY; |
| 489 pRect->Normalize(); | 489 pRect->Normalize(); |
| 490 } | 490 } |
| 491 return TRUE; | 491 return true; |
| 492 } | 492 } |
| 493 if (m_PointCount != 5 && m_PointCount != 4) { | 493 if (m_PointCount != 5 && m_PointCount != 4) { |
| 494 return FALSE; | 494 return false; |
| 495 } | 495 } |
| 496 if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX || | 496 if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX || |
| 497 m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) || | 497 m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) || |
| 498 (m_pPoints[1].m_PointX == m_pPoints[3].m_PointX && | 498 (m_pPoints[1].m_PointX == m_pPoints[3].m_PointX && |
| 499 m_pPoints[1].m_PointY == m_pPoints[3].m_PointY)) { | 499 m_pPoints[1].m_PointY == m_pPoints[3].m_PointY)) { |
| 500 return FALSE; | 500 return false; |
| 501 } | 501 } |
| 502 if (m_PointCount == 4 && m_pPoints[0].m_PointX != m_pPoints[3].m_PointX && | 502 if (m_PointCount == 4 && m_pPoints[0].m_PointX != m_pPoints[3].m_PointX && |
| 503 m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) { | 503 m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) { |
| 504 return FALSE; | 504 return false; |
| 505 } | 505 } |
| 506 FX_FLOAT x[5], y[5]; | 506 FX_FLOAT x[5], y[5]; |
| 507 for (int i = 0; i < m_PointCount; i++) { | 507 for (int i = 0; i < m_PointCount; i++) { |
| 508 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY, x[i], | 508 pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY, x[i], |
| 509 y[i]); | 509 y[i]); |
| 510 if (i) { | 510 if (i) { |
| 511 if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) { | 511 if ((m_pPoints[i].m_Flag & FXPT_TYPE) != FXPT_LINETO) { |
| 512 return FALSE; | 512 return false; |
| 513 } | 513 } |
| 514 if (x[i] != x[i - 1] && y[i] != y[i - 1]) { | 514 if (x[i] != x[i - 1] && y[i] != y[i - 1]) { |
| 515 return FALSE; | 515 return false; |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 if (pRect) { | 519 if (pRect) { |
| 520 pRect->left = x[0]; | 520 pRect->left = x[0]; |
| 521 pRect->right = x[2]; | 521 pRect->right = x[2]; |
| 522 pRect->bottom = y[0]; | 522 pRect->bottom = y[0]; |
| 523 pRect->top = y[2]; | 523 pRect->top = y[2]; |
| 524 pRect->Normalize(); | 524 pRect->Normalize(); |
| 525 } | 525 } |
| 526 return TRUE; | 526 return true; |
| 527 } | 527 } |
| 528 | 528 |
| 529 void CFX_PathData::Copy(const CFX_PathData& src) { | 529 void CFX_PathData::Copy(const CFX_PathData& src) { |
| 530 SetPointCount(src.m_PointCount); | 530 SetPointCount(src.m_PointCount); |
| 531 FXSYS_memcpy(m_pPoints, src.m_pPoints, sizeof(FX_PATHPOINT) * m_PointCount); | 531 FXSYS_memcpy(m_pPoints, src.m_pPoints, sizeof(FX_PATHPOINT) * m_PointCount); |
| 532 } | 532 } |
| OLD | NEW |