summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-10 17:28:53 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-10 17:28:53 +0000
commit7a8d3d6f8cf6989b43de24995171ab309a1c94fa (patch)
tree1703caebd3fe455c9f5e489a81b7e80bc57be627 /core/fpdfapi/page
parent2c4c95d545c6e27b775a286e88130caadf8d5a7c (diff)
downloadpdfium-7a8d3d6f8cf6989b43de24995171ab309a1c94fa.tar.xz
Simplify some object rect calculations.
Change-Id: I46ae4fb4e0f8d51130f5e5beae286dae5466b629 Reviewed-on: https://pdfium-review.googlesource.com/c/43574 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_pathobject.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_textobject.cpp5
2 files changed, 3 insertions, 10 deletions
diff --git a/core/fpdfapi/page/cpdf_pathobject.cpp b/core/fpdfapi/page/cpdf_pathobject.cpp
index 84cf45d7e0..4fb8f10a6b 100644
--- a/core/fpdfapi/page/cpdf_pathobject.cpp
+++ b/core/fpdfapi/page/cpdf_pathobject.cpp
@@ -47,11 +47,7 @@ void CPDF_PathObject::CalcBoundingBox() {
}
rect = m_Matrix.TransformRect(rect);
- if (width == 0 && m_bStroke) {
- rect.left += -0.5f;
- rect.right += 0.5f;
- rect.bottom += -0.5f;
- rect.top += 0.5f;
- }
+ if (width == 0 && m_bStroke)
+ rect.Inflate(0.5f, 0.5f);
SetRect(rect);
}
diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp
index b158376293..2b866baa25 100644
--- a/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/core/fpdfapi/page/cpdf_textobject.cpp
@@ -293,10 +293,7 @@ void CPDF_TextObject::SetPosition(float x, float y) {
float dy = y - m_Pos.y;
m_Pos.x = x;
m_Pos.y = y;
- m_Rect.left += dx;
- m_Rect.right += dx;
- m_Rect.top += dy;
- m_Rect.bottom += dy;
+ m_Rect.Translate(dx, dy);
}
void CPDF_TextObject::RecalcPositionData() {