summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_transformpage.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-02-09 22:28:49 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-09 22:28:49 +0000
commit257900b6dae0fe8d82d48ecc91d92e5dbb3a28bf (patch)
treee3b53963f47cb34166baafb5eb17b07d1c66c9fe /fpdfsdk/fpdf_transformpage.cpp
parentbc5dd9e7901ee56e0db66e76bf2e4903ab3d3fcd (diff)
downloadpdfium-257900b6dae0fe8d82d48ecc91d92e5dbb3a28bf.tar.xz
Use CPDF_Dictionary::SetRectFor() when appropriate.
Change-Id: I4ced221fb5691927485deceb7002dac880c2c210 Reviewed-on: https://pdfium-review.googlesource.com/26110 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_transformpage.cpp')
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 565d90be4c..5a7e094b07 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -26,15 +26,8 @@ namespace {
void SetBoundingBox(CPDF_Page* page,
const ByteString& key,
- float left,
- float bottom,
- float right,
- float top) {
- CPDF_Array* pBoundingBoxArray = page->m_pFormDict->SetNewFor<CPDF_Array>(key);
- pBoundingBoxArray->AddNew<CPDF_Number>(left);
- pBoundingBoxArray->AddNew<CPDF_Number>(bottom);
- pBoundingBoxArray->AddNew<CPDF_Number>(right);
- pBoundingBoxArray->AddNew<CPDF_Number>(top);
+ const CFX_FloatRect& rect) {
+ page->m_pFormDict->SetRectFor(key, rect);
}
bool GetBoundingBox(CPDF_Page* page,
@@ -69,7 +62,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetMediaBox(FPDF_PAGE page,
if (!pPage)
return;
- SetBoundingBox(pPage, "MediaBox", left, bottom, right, top);
+ SetBoundingBox(pPage, "MediaBox", CFX_FloatRect(left, bottom, right, top));
}
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page,
@@ -81,7 +74,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page,
if (!pPage)
return;
- SetBoundingBox(pPage, "CropBox", left, bottom, right, top);
+ SetBoundingBox(pPage, "CropBox", CFX_FloatRect(left, bottom, right, top));
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetMediaBox(FPDF_PAGE page,