summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorjaepark <jaepark@google.com>2016-08-25 13:33:34 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-25 13:33:34 -0700
commita1d2111945acb35cb3403226e68a1920910fa23e (patch)
treef8e0dafb97832a0cad15adc50c9b55c0d5b0c48a /core
parentd99a833da49272ee487293177f62274f58762033 (diff)
downloadpdfium-a1d2111945acb35cb3403226e68a1920910fa23e.tar.xz
CPDF_Annot::GetRect() should return CFX_FloatRect.
Avoid using reference argument and return CFX_FloatRect instead. Review-Url: https://codereview.chromium.org/2278153005
Diffstat (limited to 'core')
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp18
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp3
-rw-r--r--core/fpdfdoc/include/cpdf_annot.h2
3 files changed, 10 insertions, 13 deletions
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 76d3f9c6d4..e70ee27a98 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -55,12 +55,13 @@ CFX_ByteString CPDF_Annot::GetSubType() const {
return m_sSubtype;
}
-void CPDF_Annot::GetRect(CFX_FloatRect& rect) const {
- if (!m_pAnnotDict) {
- return;
- }
- rect = m_pAnnotDict->GetRectBy("Rect");
+CFX_FloatRect CPDF_Annot::GetRect() const {
+ if (!m_pAnnotDict)
+ return CFX_FloatRect();
+
+ CFX_FloatRect rect = m_pAnnotDict->GetRectBy("Rect");
rect.Normalize();
+ return rect;
}
uint32_t CPDF_Annot::GetFlags() const {
@@ -133,9 +134,7 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage,
CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox");
CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix");
form_matrix.TransformRect(form_bbox);
- CFX_FloatRect arect;
- pAnnot->GetRect(arect);
- matrix.MatchRect(arect, form_bbox);
+ matrix.MatchRect(pAnnot->GetRect(), form_bbox);
matrix.Concat(*pUser2Device);
return pForm;
}
@@ -272,8 +271,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
graph_state.m_DashArray[0] = graph_state.m_DashArray[1] = 3 * 1.0f;
}
}
- CFX_FloatRect rect;
- GetRect(rect);
+ CFX_FloatRect rect = GetRect();
CFX_PathData path;
width /= 2;
path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width,
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 9dc0e9587d..153b25fac4 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -84,8 +84,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
continue;
}
}
- CFX_FloatRect annot_rect_f;
- pAnnot->GetRect(annot_rect_f);
+ CFX_FloatRect annot_rect_f = pAnnot->GetRect();
CFX_Matrix matrix = *pMatrix;
if (clip_rect) {
annot_rect_f.Transform(&matrix);
diff --git a/core/fpdfdoc/include/cpdf_annot.h b/core/fpdfdoc/include/cpdf_annot.h
index 4029bba4cc..9f8671633c 100644
--- a/core/fpdfdoc/include/cpdf_annot.h
+++ b/core/fpdfdoc/include/cpdf_annot.h
@@ -44,7 +44,7 @@ class CPDF_Annot {
CFX_ByteString GetSubType() const;
uint32_t GetFlags() const;
- void GetRect(CFX_FloatRect& rect) const;
+ CFX_FloatRect GetRect() const;
const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; }
CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; }
FX_BOOL DrawAppearance(CPDF_Page* pPage,