diff options
Diffstat (limited to 'fpdfsdk/fpdf_transformpage.cpp')
-rw-r--r-- | fpdfsdk/fpdf_transformpage.cpp | 24 |
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()); } } |