diff options
author | Lei Zhang <thestig@chromium.org> | 2018-02-09 22:28:49 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-09 22:28:49 +0000 |
commit | 257900b6dae0fe8d82d48ecc91d92e5dbb3a28bf (patch) | |
tree | e3b53963f47cb34166baafb5eb17b07d1c66c9fe /fpdfsdk/fpdf_flatten.cpp | |
parent | bc5dd9e7901ee56e0db66e76bf2e4903ab3d3fcd (diff) | |
download | pdfium-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.cpp | 18 |
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) |