summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_transformpage.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-06-08 20:40:15 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-08 20:40:15 +0000
commitfc615c63d34037896963f636e4b5d9e05efd41de (patch)
tree30ab4b41c8eaf07297ff1255b2d62c1cccde9377 /fpdfsdk/fpdf_transformpage.cpp
parent8ef4ef26481d8ed80d33b898bcff829fa7c0999c (diff)
downloadpdfium-fc615c63d34037896963f636e4b5d9e05efd41de.tar.xz
Add constants for PDF 1.7 spec, table 3.27.
BUG=pdfium:1049 Change-Id: Ie8bdb893d2af8d63420027a7ef95baf58cd97aa6 Reviewed-on: https://pdfium-review.googlesource.com/34691 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_transformpage.cpp')
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 210c6b6fde..af6ac792fb 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -10,6 +10,7 @@
#include <sstream>
#include <vector>
+#include "constants/page_object.h"
#include "core/fpdfapi/page/cpdf_clippath.h"
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/page/cpdf_pageobject.h"
@@ -51,7 +52,9 @@ bool GetBoundingBox(CPDF_Page* page,
}
CPDF_Object* GetPageContent(CPDF_Dictionary* pPageDict) {
- return pPageDict ? pPageDict->GetDirectObjectFor("Contents") : nullptr;
+ return pPageDict
+ ? pPageDict->GetDirectObjectFor(pdfium::page_object::kContents)
+ : nullptr;
}
} // namespace
@@ -65,7 +68,8 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetMediaBox(FPDF_PAGE page,
if (!pPage)
return;
- SetBoundingBox(pPage, "MediaBox", CFX_FloatRect(left, bottom, right, top));
+ SetBoundingBox(pPage, pdfium::page_object::kMediaBox,
+ CFX_FloatRect(left, bottom, right, top));
}
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page,
@@ -77,7 +81,8 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page,
if (!pPage)
return;
- SetBoundingBox(pPage, "CropBox", CFX_FloatRect(left, bottom, right, top));
+ SetBoundingBox(pPage, pdfium::page_object::kCropBox,
+ CFX_FloatRect(left, bottom, right, top));
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetMediaBox(FPDF_PAGE page,
@@ -86,7 +91,8 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetMediaBox(FPDF_PAGE page,
float* right,
float* top) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
- return pPage && GetBoundingBox(pPage, "MediaBox", left, bottom, right, top);
+ return pPage && GetBoundingBox(pPage, pdfium::page_object::kMediaBox, left,
+ bottom, right, top);
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetCropBox(FPDF_PAGE page,
@@ -95,7 +101,8 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetCropBox(FPDF_PAGE page,
float* right,
float* top) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
- return pPage && GetBoundingBox(pPage, "CropBox", left, bottom, right, top);
+ return pPage && GetBoundingBox(pPage, pdfium::page_object::kCropBox, left,
+ bottom, right, top);
}
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
@@ -151,12 +158,13 @@ FPDFPage_TransFormWithClip(FPDF_PAGE page,
pContentArray->AddNew<CPDF_Reference>(pDoc, pStream->GetObjNum());
pContentArray->AddNew<CPDF_Reference>(pDoc, pContentObj->GetObjNum());
pContentArray->AddNew<CPDF_Reference>(pDoc, pEndStream->GetObjNum());
- pPageDict->SetNewFor<CPDF_Reference>("Contents", pDoc,
+ pPageDict->SetNewFor<CPDF_Reference>(pdfium::page_object::kContents, pDoc,
pContentArray->GetObjNum());
}
// Need to transform the patterns as well.
- CPDF_Dictionary* pRes = pPageDict->GetDictFor("Resources");
+ CPDF_Dictionary* pRes =
+ pPageDict->GetDictFor(pdfium::page_object::kResources);
if (pRes) {
CPDF_Dictionary* pPattenDict = pRes->GetDictFor("Pattern");
if (pPattenDict) {
@@ -302,7 +310,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page,
CPDF_Array* pContentArray = pDoc->NewIndirect<CPDF_Array>();
pContentArray->AddNew<CPDF_Reference>(pDoc, pStream->GetObjNum());
pContentArray->AddNew<CPDF_Reference>(pDoc, pContentObj->GetObjNum());
- pPageDict->SetNewFor<CPDF_Reference>("Contents", pDoc,
+ pPageDict->SetNewFor<CPDF_Reference>(pdfium::page_object::kContents, pDoc,
pContentArray->GetObjNum());
}
}