diff options
author | Jane Liu <janeliulwq@google.com> | 2017-08-18 14:42:58 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-21 15:05:56 +0000 |
commit | 69ad278881f83a1f8cf45d5a42a88752c0871c7e (patch) | |
tree | 0118fe1b71175b3c5b2da9c49b33ef9a349f8444 /core/fxge/cfx_pathdata.cpp | |
parent | 8c6dc95678810e3a054744a6a229606ac0d75134 (diff) | |
download | pdfium-69ad278881f83a1f8cf45d5a42a88752c0871c7e.tar.xz |
Converted CFX_FloatRect::{Init|Update}Rect() to take point objects
Converted CFX_FloatRect::Init() and CFX_FloatRect::UpdateRect() to take
in a CFX_PointF object instead of two coordinates.
Bug=pdfium:770
Change-Id: Ibcb620f192d6c086158c39f23c411777286005d0
Reviewed-on: https://pdfium-review.googlesource.com/11450
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/cfx_pathdata.cpp')
-rw-r--r-- | core/fxge/cfx_pathdata.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/core/fxge/cfx_pathdata.cpp b/core/fxge/cfx_pathdata.cpp index 1dbb44638c..4ac5cf6a7a 100644 --- a/core/fxge/cfx_pathdata.cpp +++ b/core/fxge/cfx_pathdata.cpp @@ -17,8 +17,8 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, float hw) { if (start_pos.x == end_pos.x) { if (start_pos.y == end_pos.y) { - rect->UpdateRect(end_pos.x + hw, end_pos.y + hw); - rect->UpdateRect(end_pos.x - hw, end_pos.y - hw); + rect->UpdateRect(end_pos + CFX_PointF(hw, hw)); + rect->UpdateRect(end_pos - CFX_PointF(hw, hw)); return; } @@ -28,8 +28,8 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, else point_y = end_pos.y + hw; - rect->UpdateRect(end_pos.x + hw, point_y); - rect->UpdateRect(end_pos.x - hw, point_y); + rect->UpdateRect(CFX_PointF(end_pos.x + hw, point_y)); + rect->UpdateRect(CFX_PointF(end_pos.x - hw, point_y)); return; } @@ -40,8 +40,8 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, else point_x = end_pos.x + hw; - rect->UpdateRect(point_x, end_pos.y + hw); - rect->UpdateRect(point_x, end_pos.y - hw); + rect->UpdateRect(CFX_PointF(point_x, end_pos.y + hw)); + rect->UpdateRect(CFX_PointF(point_x, end_pos.y - hw)); return; } @@ -51,8 +51,8 @@ void UpdateLineEndPoints(CFX_FloatRect* rect, float my = end_pos.y + hw * diff.y / ll; float dx1 = hw * diff.y / ll; float dy1 = hw * diff.x / ll; - rect->UpdateRect(mx - dx1, my + dy1); - rect->UpdateRect(mx + dx1, my - dy1); + rect->UpdateRect(CFX_PointF(mx - dx1, my + dy1)); + rect->UpdateRect(CFX_PointF(mx + dx1, my - dy1)); } void UpdateLineJoinPoints(CFX_FloatRect* rect, @@ -76,8 +76,8 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, if (bStartVert && bEndVert) { int start_dir = mid_pos.y > start_pos.y ? 1 : -1; float point_y = mid_pos.y + half_width * start_dir; - rect->UpdateRect(mid_pos.x + half_width, point_y); - rect->UpdateRect(mid_pos.x - half_width, point_y); + rect->UpdateRect(CFX_PointF(mid_pos.x + half_width, point_y)); + rect->UpdateRect(CFX_PointF(mid_pos.x - half_width, point_y)); return; } @@ -108,7 +108,7 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, else outside.y = (end_k * outside.x) + end_c - end_dc; - rect->UpdateRect(outside.x, outside.y); + rect->UpdateRect(outside); return; } @@ -124,7 +124,7 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, else outside.y = (start_k * outside.x) + start_c - start_dc; - rect->UpdateRect(outside.x, outside.y); + rect->UpdateRect(outside); return; } @@ -152,7 +152,7 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, float join_x = (end_outside_c - start_outside_c) / (start_k - end_k); float join_y = start_k * join_x + start_outside_c; - rect->UpdateRect(join_x, join_y); + rect->UpdateRect(CFX_PointF(join_x, join_y)); } } // namespace @@ -231,9 +231,9 @@ CFX_FloatRect CFX_PathData::GetBoundingBox() const { return CFX_FloatRect(); CFX_FloatRect rect; - rect.InitRect(m_Points[0].m_Point.x, m_Points[0].m_Point.y); + rect.InitRect(m_Points[0].m_Point); for (size_t i = 1; i < m_Points.size(); i++) - rect.UpdateRect(m_Points[i].m_Point.x, m_Points[i].m_Point.y); + rect.UpdateRect(m_Points[i].m_Point); return rect; } @@ -256,9 +256,8 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width, bJoin = false; } else { if (m_Points[iPoint].IsTypeAndOpen(FXPT_TYPE::BezierTo)) { - rect.UpdateRect(m_Points[iPoint].m_Point.x, m_Points[iPoint].m_Point.y); - rect.UpdateRect(m_Points[iPoint + 1].m_Point.x, - m_Points[iPoint + 1].m_Point.y); + rect.UpdateRect(m_Points[iPoint].m_Point); + rect.UpdateRect(m_Points[iPoint + 1].m_Point); iPoint += 2; } if (iPoint == m_Points.size() - 1 || |