summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_flatten.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_flatten.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_flatten.cpp')
-rw-r--r--fpdfsdk/fpdf_flatten.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index 4d06693006..299318bd08 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -269,21 +269,11 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
else
rcOriginalCB = rcOriginalMB;
- if (!rcOriginalMB.IsEmpty()) {
- CPDF_Array* pMediaBox = pPageDict->SetNewFor<CPDF_Array>("MediaBox");
- pMediaBox->AddNew<CPDF_Number>(rcOriginalMB.left);
- pMediaBox->AddNew<CPDF_Number>(rcOriginalMB.bottom);
- pMediaBox->AddNew<CPDF_Number>(rcOriginalMB.right);
- pMediaBox->AddNew<CPDF_Number>(rcOriginalMB.top);
- }
+ if (!rcOriginalMB.IsEmpty())
+ pPageDict->SetRectFor("MediaBox", rcOriginalMB);
- if (!rcOriginalCB.IsEmpty()) {
- CPDF_Array* pCropBox = pPageDict->SetNewFor<CPDF_Array>("ArtBox");
- pCropBox->AddNew<CPDF_Number>(rcOriginalCB.left);
- pCropBox->AddNew<CPDF_Number>(rcOriginalCB.bottom);
- pCropBox->AddNew<CPDF_Number>(rcOriginalCB.right);
- pCropBox->AddNew<CPDF_Number>(rcOriginalCB.top);
- }
+ if (!rcOriginalCB.IsEmpty())
+ pPageDict->SetRectFor("ArtBox", rcOriginalCB);
CPDF_Dictionary* pRes = pPageDict->GetDictFor("Resources");
if (!pRes)