summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/fpdf_page')
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorspace.cpp26
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_contentmark.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_form.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_image.cpp72
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_meshstream.cpp8
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_page.cpp4
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp8
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp10
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp12
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_doc.cpp28
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_func.cpp30
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp22
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp28
13 files changed, 126 insertions, 126 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
index 759d0f37b5..88a74f0189 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
@@ -568,16 +568,16 @@ FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (!pDict)
return FALSE;
- CPDF_Array* pParam = pDict->GetArrayBy("WhitePoint");
+ CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
int i;
for (i = 0; i < 3; i++)
m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
- pParam = pDict->GetArrayBy("BlackPoint");
+ pParam = pDict->GetArrayFor("BlackPoint");
for (i = 0; i < 3; i++)
m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
- m_Gamma = pDict->GetNumberBy("Gamma");
+ m_Gamma = pDict->GetNumberFor("Gamma");
if (m_Gamma == 0)
m_Gamma = 1.0f;
return TRUE;
@@ -623,16 +623,16 @@ FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (!pDict)
return FALSE;
- CPDF_Array* pParam = pDict->GetArrayBy("WhitePoint");
+ CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
int i;
for (i = 0; i < 3; i++)
m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
- pParam = pDict->GetArrayBy("BlackPoint");
+ pParam = pDict->GetArrayFor("BlackPoint");
for (i = 0; i < 3; i++)
m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
- pParam = pDict->GetArrayBy("Gamma");
+ pParam = pDict->GetArrayFor("Gamma");
if (pParam) {
m_bGamma = TRUE;
for (i = 0; i < 3; i++)
@@ -641,7 +641,7 @@ FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
m_bGamma = FALSE;
}
- pParam = pDict->GetArrayBy("Matrix");
+ pParam = pDict->GetArrayFor("Matrix");
if (pParam) {
m_bMatrix = TRUE;
for (i = 0; i < 9; i++)
@@ -745,16 +745,16 @@ FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (!pDict)
return FALSE;
- CPDF_Array* pParam = pDict->GetArrayBy("WhitePoint");
+ CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint");
int i;
for (i = 0; i < 3; i++)
m_WhitePoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
- pParam = pDict->GetArrayBy("BlackPoint");
+ pParam = pDict->GetArrayFor("BlackPoint");
for (i = 0; i < 3; i++)
m_BlackPoint[i] = pParam ? pParam->GetNumberAt(i) : 0;
- pParam = pDict->GetArrayBy("Range");
+ pParam = pDict->GetArrayFor("Range");
const FX_FLOAT def_ranges[4] = {-100 * 1.0f, 100 * 1.0f, -100 * 1.0f,
100 * 1.0f};
for (i = 0; i < 4; i++)
@@ -852,7 +852,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Dictionary* pDict = pStream->GetDict();
if (!m_pProfile->m_pTransform) { // No valid ICC profile or using sRGB
CPDF_Object* pAlterCSObj =
- pDict ? pDict->GetDirectObjectBy("Alternate") : nullptr;
+ pDict ? pDict->GetDirectObjectFor("Alternate") : nullptr;
if (pAlterCSObj) {
CPDF_ColorSpace* pAlterCS = CPDF_ColorSpace::Load(pDoc, pAlterCSObj);
if (pAlterCS) {
@@ -863,7 +863,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
m_bOwn = TRUE;
} else { // No valid alternative colorspace
pAlterCS->ReleaseCS();
- int32_t nDictComponents = pDict ? pDict->GetIntegerBy("N") : 0;
+ int32_t nDictComponents = pDict ? pDict->GetIntegerFor("N") : 0;
if (nDictComponents != 1 && nDictComponents != 3 &&
nDictComponents != 4) {
return FALSE;
@@ -890,7 +890,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
m_pAlterCS = GetStockCS(PDFCS_DEVICECMYK);
}
}
- CPDF_Array* pRanges = pDict->GetArrayBy("Range");
+ CPDF_Array* pRanges = pDict->GetArrayFor("Range");
m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2);
for (uint32_t i = 0; i < m_nComponents * 2; i++) {
if (pRanges)
diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp
index 2e28989976..99a16004cd 100644
--- a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp
@@ -104,7 +104,7 @@ int CPDF_ContentMark::MarkData::GetMCID() const {
type == CPDF_ContentMarkItem::DirectDict) {
CPDF_Dictionary* pDict = mark.GetParam();
if (pDict->KeyExist("MCID"))
- return pDict->GetIntegerBy("MCID");
+ return pDict->GetIntegerFor("MCID");
}
}
return -1;
diff --git a/core/fpdfapi/fpdf_page/cpdf_form.cpp b/core/fpdfapi/fpdf_page/cpdf_form.cpp
index 570419f58f..bf0dade4b1 100644
--- a/core/fpdfapi/fpdf_page/cpdf_form.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_form.cpp
@@ -19,7 +19,7 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc,
m_pDocument = pDoc;
m_pFormStream = pFormStream;
m_pFormDict = pFormStream ? pFormStream->GetDict() : nullptr;
- m_pResources = m_pFormDict->GetDictBy("Resources");
+ m_pResources = m_pFormDict->GetDictFor("Resources");
m_pPageResources = pPageResources;
if (!m_pResources)
m_pResources = pParentResources;
diff --git a/core/fpdfapi/fpdf_page/cpdf_image.cpp b/core/fpdfapi/fpdf_page/cpdf_image.cpp
index 2b3625bfc2..02e492b27d 100644
--- a/core/fpdfapi/fpdf_page/cpdf_image.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_image.cpp
@@ -45,12 +45,12 @@ CPDF_Image::CPDF_Image(CPDF_Document* pDoc, CPDF_Stream* pStream, bool bInline)
if (m_bInline)
m_pInlineDict = ToDictionary(pDict->Clone());
- m_pOC = pDict->GetDictBy("OC");
+ m_pOC = pDict->GetDictFor("OC");
m_bIsMask =
- !pDict->KeyExist("ColorSpace") || pDict->GetIntegerBy("ImageMask");
- m_bInterpolate = !!pDict->GetIntegerBy("Interpolate");
- m_Height = pDict->GetIntegerBy("Height");
- m_Width = pDict->GetIntegerBy("Width");
+ !pDict->KeyExist("ColorSpace") || pDict->GetIntegerFor("ImageMask");
+ m_bInterpolate = !!pDict->GetIntegerFor("Interpolate");
+ m_Height = pDict->GetIntegerFor("Height");
+ m_Width = pDict->GetIntegerFor("Width");
}
CPDF_Image::~CPDF_Image() {
@@ -86,10 +86,10 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) {
}
CPDF_Dictionary* pDict = new CPDF_Dictionary;
- pDict->SetAtName("Type", "XObject");
- pDict->SetAtName("Subtype", "Image");
- pDict->SetAtInteger("Width", width);
- pDict->SetAtInteger("Height", height);
+ pDict->SetNameFor("Type", "XObject");
+ pDict->SetNameFor("Subtype", "Image");
+ pDict->SetIntegerFor("Width", width);
+ pDict->SetIntegerFor("Height", height);
const FX_CHAR* csname = nullptr;
if (num_comps == 1) {
csname = "DeviceGray";
@@ -102,15 +102,15 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) {
pDecode->AddInteger(1);
pDecode->AddInteger(0);
}
- pDict->SetAt("Decode", pDecode);
+ pDict->SetFor("Decode", pDecode);
}
- pDict->SetAtName("ColorSpace", csname);
- pDict->SetAtInteger("BitsPerComponent", bits);
- pDict->SetAtName("Filter", "DCTDecode");
+ pDict->SetNameFor("ColorSpace", csname);
+ pDict->SetIntegerFor("BitsPerComponent", bits);
+ pDict->SetNameFor("Filter", "DCTDecode");
if (!color_trans) {
CPDF_Dictionary* pParms = new CPDF_Dictionary;
- pDict->SetAt("DecodeParms", pParms);
- pParms->SetAtInteger("ColorTransform", 0);
+ pDict->SetFor("DecodeParms", pParms);
+ pParms->SetIntegerFor("ColorTransform", 0);
}
m_bIsMask = FALSE;
m_Width = width;
@@ -151,10 +151,10 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
int32_t bpp = pBitmap->GetBPP();
CPDF_Dictionary* pDict = new CPDF_Dictionary;
- pDict->SetAtName("Type", "XObject");
- pDict->SetAtName("Subtype", "Image");
- pDict->SetAtInteger("Width", BitmapWidth);
- pDict->SetAtInteger("Height", BitmapHeight);
+ pDict->SetNameFor("Type", "XObject");
+ pDict->SetNameFor("Subtype", "Image");
+ pDict->SetIntegerFor("Width", BitmapWidth);
+ pDict->SetIntegerFor("Height", BitmapHeight);
uint8_t* dest_buf = nullptr;
FX_STRSIZE dest_pitch = 0, dest_size = 0, opType = -1;
if (bpp == 1) {
@@ -166,12 +166,12 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b);
}
if (set_a == 0 || reset_a == 0) {
- pDict->SetAt("ImageMask", new CPDF_Boolean(TRUE));
+ pDict->SetFor("ImageMask", new CPDF_Boolean(TRUE));
if (reset_a == 0) {
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(1);
pArray->AddInteger(0);
- pDict->SetAt("Decode", pArray);
+ pDict->SetFor("Decode", pArray);
}
} else {
CPDF_Array* pCS = new CPDF_Array;
@@ -188,9 +188,9 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
pBuf[5] = (FX_CHAR)set_b;
ct.ReleaseBuffer(6);
pCS->Add(new CPDF_String(ct, TRUE));
- pDict->SetAt("ColorSpace", pCS);
+ pDict->SetFor("ColorSpace", pCS);
}
- pDict->SetAtInteger("BitsPerComponent", 1);
+ pDict->SetIntegerFor("BitsPerComponent", 1);
dest_pitch = (BitmapWidth + 7) / 8;
if ((iCompress & 0x03) == PDF_IMAGE_NO_COMPRESS) {
opType = 1;
@@ -218,11 +218,11 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
new CPDF_Stream(pColorTable, iPalette * 3, new CPDF_Dictionary);
m_pDocument->AddIndirectObject(pCTS);
pCS->AddReference(m_pDocument, pCTS);
- pDict->SetAtReference("ColorSpace", m_pDocument, pCS);
+ pDict->SetReferenceFor("ColorSpace", m_pDocument, pCS);
} else {
- pDict->SetAtName("ColorSpace", "DeviceGray");
+ pDict->SetNameFor("ColorSpace", "DeviceGray");
}
- pDict->SetAtInteger("BitsPerComponent", 8);
+ pDict->SetIntegerFor("BitsPerComponent", 8);
if ((iCompress & 0x03) == PDF_IMAGE_NO_COMPRESS) {
dest_pitch = BitmapWidth;
opType = 1;
@@ -230,8 +230,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
opType = 0;
}
} else {
- pDict->SetAtName("ColorSpace", "DeviceRGB");
- pDict->SetAtInteger("BitsPerComponent", 8);
+ pDict->SetNameFor("ColorSpace", "DeviceRGB");
+ pDict->SetIntegerFor("BitsPerComponent", 8);
if ((iCompress & 0x03) == PDF_IMAGE_NO_COMPRESS) {
dest_pitch = BitmapWidth * 3;
opType = 2;
@@ -251,12 +251,12 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
uint8_t* mask_buf = nullptr;
FX_STRSIZE mask_size = 0;
CPDF_Dictionary* pMaskDict = new CPDF_Dictionary;
- pMaskDict->SetAtName("Type", "XObject");
- pMaskDict->SetAtName("Subtype", "Image");
- pMaskDict->SetAtInteger("Width", maskWidth);
- pMaskDict->SetAtInteger("Height", maskHeight);
- pMaskDict->SetAtName("ColorSpace", "DeviceGray");
- pMaskDict->SetAtInteger("BitsPerComponent", 8);
+ pMaskDict->SetNameFor("Type", "XObject");
+ pMaskDict->SetNameFor("Subtype", "Image");
+ pMaskDict->SetIntegerFor("Width", maskWidth);
+ pMaskDict->SetIntegerFor("Height", maskHeight);
+ pMaskDict->SetNameFor("ColorSpace", "DeviceGray");
+ pMaskDict->SetIntegerFor("BitsPerComponent", 8);
if (pMaskBitmap->GetBPP() == 8 &&
(iCompress & PDF_IMAGE_MASK_LOSSY_COMPRESS) != 0) {
} else if (pMaskBitmap->GetFormat() == FXDIB_1bppMask) {
@@ -268,11 +268,11 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
maskWidth);
}
}
- pMaskDict->SetAtInteger("Length", mask_size);
+ pMaskDict->SetIntegerFor("Length", mask_size);
CPDF_Stream* pMaskStream = new CPDF_Stream(mask_buf, mask_size, pMaskDict);
m_pDocument->AddIndirectObject(pMaskStream);
- pDict->SetAtReference("SMask", m_pDocument, pMaskStream);
+ pDict->SetReferenceFor("SMask", m_pDocument, pMaskStream);
if (bDeleteMask) {
delete pMaskBitmap;
}
diff --git a/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp b/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp
index 1d9c56046a..d2dfac34be 100644
--- a/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp
@@ -110,8 +110,8 @@ bool CPDF_MeshStream::Load() {
m_Stream.LoadAllData(m_pShadingStream);
m_BitStream.Init(m_Stream.GetData(), m_Stream.GetSize());
CPDF_Dictionary* pDict = m_pShadingStream->GetDict();
- m_nCoordBits = pDict->GetIntegerBy("BitsPerCoordinate");
- m_nComponentBits = pDict->GetIntegerBy("BitsPerComponent");
+ m_nCoordBits = pDict->GetIntegerFor("BitsPerCoordinate");
+ m_nComponentBits = pDict->GetIntegerFor("BitsPerComponent");
if (ShouldCheckBPC(m_type)) {
if (!IsValidBitsPerCoordinate(m_nCoordBits))
return false;
@@ -119,7 +119,7 @@ bool CPDF_MeshStream::Load() {
return false;
}
- m_nFlagBits = pDict->GetIntegerBy("BitsPerFlag");
+ m_nFlagBits = pDict->GetIntegerFor("BitsPerFlag");
if (ShouldCheckBitsPerFlag(m_type) && !IsValidBitsPerFlag(m_nFlagBits))
return false;
@@ -128,7 +128,7 @@ bool CPDF_MeshStream::Load() {
return false;
m_nComponents = m_funcs.empty() ? nComponents : 1;
- CPDF_Array* pDecode = pDict->GetArrayBy("Decode");
+ CPDF_Array* pDecode = pDict->GetArrayFor("Decode");
if (!pDecode || pDecode->GetCount() != 4 + m_nComponents * 2)
return false;
diff --git a/core/fpdfapi/fpdf_page/cpdf_page.cpp b/core/fpdfapi/fpdf_page/cpdf_page.cpp
index 289ef717c4..b9931713c4 100644
--- a/core/fpdfapi/fpdf_page/cpdf_page.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_page.cpp
@@ -106,10 +106,10 @@ CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
std::set<CPDF_Dictionary*> visited;
while (1) {
visited.insert(pPageDict);
- if (CPDF_Object* pObj = pPageDict->GetDirectObjectBy(name))
+ if (CPDF_Object* pObj = pPageDict->GetDirectObjectFor(name))
return pObj;
- pPageDict = pPageDict->GetDictBy("Parent");
+ pPageDict = pPageDict->GetDictFor("Parent");
if (!pPageDict || pdfium::ContainsKey(visited, pPageDict))
break;
}
diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp
index 77ec205518..eb7cb8e2f5 100644
--- a/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp
@@ -60,18 +60,18 @@ void CPDF_PageObjectHolder::LoadTransInfo() {
if (!m_pFormDict) {
return;
}
- CPDF_Dictionary* pGroup = m_pFormDict->GetDictBy("Group");
+ CPDF_Dictionary* pGroup = m_pFormDict->GetDictFor("Group");
if (!pGroup) {
return;
}
- if (pGroup->GetStringBy("S") != "Transparency") {
+ if (pGroup->GetStringFor("S") != "Transparency") {
return;
}
m_Transparency |= PDFTRANS_GROUP;
- if (pGroup->GetIntegerBy("I")) {
+ if (pGroup->GetIntegerFor("I")) {
m_Transparency |= PDFTRANS_ISOLATED;
}
- if (pGroup->GetIntegerBy("K")) {
+ if (pGroup->GetIntegerFor("K")) {
m_Transparency |= PDFTRANS_KNOCKOUT;
}
}
diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp
index e2205f956d..8da9b4769f 100644
--- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp
@@ -38,8 +38,8 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc,
m_pCountedCS(nullptr) {
if (!bShading) {
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
- m_Pattern2Form = pDict->GetMatrixBy("Matrix");
- m_pShadingObj = pDict->GetDirectObjectBy("Shading");
+ m_Pattern2Form = pDict->GetMatrixFor("Matrix");
+ m_pShadingObj = pDict->GetDirectObjectFor("Shading");
m_Pattern2Form.Concat(parentMatrix);
}
}
@@ -68,7 +68,7 @@ bool CPDF_ShadingPattern::Load() {
return FALSE;
m_pFunctions.clear();
- CPDF_Object* pFunc = pShadingDict->GetDirectObjectBy("Function");
+ CPDF_Object* pFunc = pShadingDict->GetDirectObjectFor("Function");
if (pFunc) {
if (CPDF_Array* pArray = pFunc->AsArray()) {
m_pFunctions.resize(std::min<size_t>(pArray->GetCount(), 4));
@@ -78,7 +78,7 @@ bool CPDF_ShadingPattern::Load() {
m_pFunctions.push_back(CPDF_Function::Load(pFunc));
}
}
- CPDF_Object* pCSObj = pShadingDict->GetDirectObjectBy("ColorSpace");
+ CPDF_Object* pCSObj = pShadingDict->GetDirectObjectFor("ColorSpace");
if (!pCSObj)
return FALSE;
@@ -87,7 +87,7 @@ bool CPDF_ShadingPattern::Load() {
if (m_pCS)
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
- m_ShadingType = ToShadingType(pShadingDict->GetIntegerBy("ShadingType"));
+ m_ShadingType = ToShadingType(pShadingDict->GetIntegerFor("ShadingType"));
// We expect to have a stream if our shading type is a mesh.
if (IsMeshShading() && !ToStream(m_pShadingObj))
diff --git a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp
index f7370de0bc..7c1716dc01 100644
--- a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp
@@ -16,8 +16,8 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc,
const CFX_Matrix& parentMatrix)
: CPDF_Pattern(TILING, pDoc, pPatternObj, parentMatrix) {
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
- m_Pattern2Form = pDict->GetMatrixBy("Matrix");
- m_bColored = pDict->GetIntegerBy("PaintType") == 1;
+ m_Pattern2Form = pDict->GetMatrixFor("Matrix");
+ m_bColored = pDict->GetIntegerFor("PaintType") == 1;
m_Pattern2Form.Concat(parentMatrix);
}
@@ -40,9 +40,9 @@ FX_BOOL CPDF_TilingPattern::Load() {
if (!pDict)
return FALSE;
- m_bColored = pDict->GetIntegerBy("PaintType") == 1;
- m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberBy("XStep"));
- m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberBy("YStep"));
+ m_bColored = pDict->GetIntegerFor("PaintType") == 1;
+ m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("XStep"));
+ m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("YStep"));
CPDF_Stream* pStream = m_pPatternObj->AsStream();
if (!pStream)
@@ -50,6 +50,6 @@ FX_BOOL CPDF_TilingPattern::Load() {
m_pForm.reset(new CPDF_Form(m_pDocument, nullptr, pStream));
m_pForm->ParseContent(nullptr, &m_ParentMatrix, nullptr);
- m_BBox = pDict->GetRectBy("BBox");
+ m_BBox = pDict->GetRectFor("BBox");
return TRUE;
}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index fa242ffb85..9e586e326f 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -185,11 +185,11 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteString& fontName,
}
CPDF_Dictionary* pDict = new CPDF_Dictionary;
- pDict->SetAtName("Type", "Font");
- pDict->SetAtName("Subtype", "Type1");
- pDict->SetAtName("BaseFont", fontName);
+ pDict->SetNameFor("Type", "Font");
+ pDict->SetNameFor("Subtype", "Type1");
+ pDict->SetNameFor("BaseFont", fontName);
if (pEncoding) {
- pDict->SetAt("Encoding", pEncoding->Realize());
+ pDict->SetFor("Encoding", pEncoding->Realize());
}
m_pPDFDoc->AddIndirectObject(pDict);
CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict);
@@ -241,30 +241,30 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceImpl(
CFX_ByteString name = pCSObj->GetString();
CPDF_ColorSpace* pCS = CPDF_ColorSpace::ColorspaceFromName(name);
if (!pCS && pResources) {
- CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace");
+ CPDF_Dictionary* pList = pResources->GetDictFor("ColorSpace");
if (pList) {
pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pCSObj);
- return GetColorSpaceImpl(pList->GetDirectObjectBy(name), nullptr,
+ return GetColorSpaceImpl(pList->GetDirectObjectFor(name), nullptr,
pVisited);
}
}
if (!pCS || !pResources)
return pCS;
- CPDF_Dictionary* pColorSpaces = pResources->GetDictBy("ColorSpace");
+ CPDF_Dictionary* pColorSpaces = pResources->GetDictFor("ColorSpace");
if (!pColorSpaces)
return pCS;
CPDF_Object* pDefaultCS = nullptr;
switch (pCS->GetFamily()) {
case PDFCS_DEVICERGB:
- pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultRGB");
+ pDefaultCS = pColorSpaces->GetDirectObjectFor("DefaultRGB");
break;
case PDFCS_DEVICEGRAY:
- pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultGray");
+ pDefaultCS = pColorSpaces->GetDirectObjectFor("DefaultGray");
break;
case PDFCS_DEVICECMYK:
- pDefaultCS = pColorSpaces->GetDirectObjectBy("DefaultCMYK");
+ pDefaultCS = pColorSpaces->GetDirectObjectFor("DefaultCMYK");
break;
}
if (!pDefaultCS)
@@ -357,7 +357,7 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj,
} else {
CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : nullptr;
if (pDict) {
- int type = pDict->GetIntegerBy("PatternType");
+ int type = pDict->GetIntegerFor("PatternType");
if (type == CPDF_Pattern::TILING) {
pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix);
} else if (type == CPDF_Pattern::SHADING) {
@@ -491,9 +491,9 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(
return it->second->AddRef();
CPDF_Dictionary* pFontDict = pFontStream->GetDict();
- int32_t org_size = pFontDict->GetIntegerBy("Length1") +
- pFontDict->GetIntegerBy("Length2") +
- pFontDict->GetIntegerBy("Length3");
+ int32_t org_size = pFontDict->GetIntegerFor("Length1") +
+ pFontDict->GetIntegerFor("Length2") +
+ pFontDict->GetIntegerFor("Length3");
org_size = std::max(org_size, 0);
CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc;
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 6a5bbacda5..63ab3056c7 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -471,10 +471,10 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
return false;
CPDF_Dictionary* pDict = pStream->GetDict();
- CPDF_Array* pSize = pDict->GetArrayBy("Size");
- CPDF_Array* pEncode = pDict->GetArrayBy("Encode");
- CPDF_Array* pDecode = pDict->GetArrayBy("Decode");
- m_nBitsPerSample = pDict->GetIntegerBy("BitsPerSample");
+ CPDF_Array* pSize = pDict->GetArrayFor("Size");
+ CPDF_Array* pEncode = pDict->GetArrayFor("Encode");
+ CPDF_Array* pDecode = pDict->GetArrayFor("Decode");
+ m_nBitsPerSample = pDict->GetIntegerFor("BitsPerSample");
if (!IsValidBitsPerSample(m_nBitsPerSample))
return FALSE;
@@ -486,7 +486,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
for (uint32_t i = 0; i < m_nInputs; i++) {
m_EncodeInfo[i].sizes = pSize ? pSize->GetIntegerAt(i) : 0;
if (!pSize && i == 0)
- m_EncodeInfo[i].sizes = pDict->GetIntegerBy("Size");
+ m_EncodeInfo[i].sizes = pDict->GetIntegerFor("Size");
nTotalSampleBits *= m_EncodeInfo[i].sizes;
if (pEncode) {
m_EncodeInfo[i].encode_min = pEncode->GetFloatAt(i * 2);
@@ -601,21 +601,21 @@ FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
if (!pDict) {
return FALSE;
}
- CPDF_Array* pArray0 = pDict->GetArrayBy("C0");
+ CPDF_Array* pArray0 = pDict->GetArrayFor("C0");
if (m_nOutputs == 0) {
m_nOutputs = 1;
if (pArray0) {
m_nOutputs = pArray0->GetCount();
}
}
- CPDF_Array* pArray1 = pDict->GetArrayBy("C1");
+ CPDF_Array* pArray1 = pDict->GetArrayFor("C1");
m_pBeginValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2);
m_pEndValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2);
for (uint32_t i = 0; i < m_nOutputs; i++) {
m_pBeginValues[i] = pArray0 ? pArray0->GetFloatAt(i) : 0.0f;
m_pEndValues[i] = pArray1 ? pArray1->GetFloatAt(i) : 1.0f;
}
- m_Exponent = pDict->GetFloatBy("N");
+ m_Exponent = pDict->GetFloatFor("N");
m_nOrigOutputs = m_nOutputs;
if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) {
return FALSE;
@@ -652,7 +652,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
if (m_nInputs != kRequiredNumInputs) {
return FALSE;
}
- CPDF_Array* pArray = pDict->GetArrayBy("Functions");
+ CPDF_Array* pArray = pDict->GetArrayFor("Functions");
if (!pArray) {
return FALSE;
}
@@ -682,14 +682,14 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
}
m_pBounds = FX_Alloc(FX_FLOAT, nSubs + 1);
m_pBounds[0] = m_pDomains[0];
- pArray = pDict->GetArrayBy("Bounds");
+ pArray = pDict->GetArrayFor("Bounds");
if (!pArray)
return FALSE;
for (uint32_t i = 0; i < nSubs - 1; i++)
m_pBounds[i + 1] = pArray->GetFloatAt(i);
m_pBounds[nSubs] = m_pDomains[1];
m_pEncode = FX_Alloc2D(FX_FLOAT, nSubs, 2);
- pArray = pDict->GetArrayBy("Encode");
+ pArray = pDict->GetArrayFor("Encode");
if (!pArray)
return FALSE;
@@ -720,9 +720,9 @@ std::unique_ptr<CPDF_Function> CPDF_Function::Load(CPDF_Object* pFuncObj) {
int iType = -1;
if (CPDF_Stream* pStream = pFuncObj->AsStream())
- iType = pStream->GetDict()->GetIntegerBy("FunctionType");
+ iType = pStream->GetDict()->GetIntegerFor("FunctionType");
else if (CPDF_Dictionary* pDict = pFuncObj->AsDictionary())
- iType = pDict->GetIntegerBy("FunctionType");
+ iType = pDict->GetIntegerFor("FunctionType");
Type type = IntegerToFunctionType(iType);
if (type == Type::kType0Sampled)
@@ -764,7 +764,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
CPDF_Stream* pStream = pObj->AsStream();
CPDF_Dictionary* pDict = pStream ? pStream->GetDict() : pObj->AsDictionary();
- CPDF_Array* pDomains = pDict->GetArrayBy("Domain");
+ CPDF_Array* pDomains = pDict->GetArrayFor("Domain");
if (!pDomains)
return FALSE;
@@ -776,7 +776,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
for (uint32_t i = 0; i < m_nInputs * 2; i++) {
m_pDomains[i] = pDomains->GetFloatAt(i);
}
- CPDF_Array* pRanges = pDict->GetArrayBy("Range");
+ CPDF_Array* pRanges = pDict->GetArrayFor("Range");
m_nOutputs = 0;
if (pRanges) {
m_nOutputs = pRanges->GetCount() / 2;
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index d7f1f3c3e0..46ab067b3e 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -611,22 +611,22 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
if (!key.IsEmpty()) {
uint32_t dwObjNum = pObj ? pObj->GetObjNum() : 0;
if (dwObjNum)
- pDict->SetAtReference(key, m_pDocument, dwObjNum);
+ pDict->SetReferenceFor(key, m_pDocument, dwObjNum);
else
- pDict->SetAt(key, pObj.release());
+ pDict->SetFor(key, pObj.release());
}
}
PDF_ReplaceAbbr(pDict);
CPDF_Object* pCSObj = nullptr;
if (pDict->KeyExist("ColorSpace")) {
- pCSObj = pDict->GetDirectObjectBy("ColorSpace");
+ pCSObj = pDict->GetDirectObjectFor("ColorSpace");
if (pCSObj->IsName()) {
CFX_ByteString name = pCSObj->GetString();
if (name != "DeviceRGB" && name != "DeviceGray" && name != "DeviceCMYK") {
pCSObj = FindResourceObj("ColorSpace", name);
if (pCSObj && !pCSObj->GetObjNum()) {
pCSObj = pCSObj->Clone();
- pDict->SetAt("ColorSpace", pCSObj);
+ pDict->SetFor("ColorSpace", pCSObj);
}
}
}
@@ -646,7 +646,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
break;
}
}
- pDict->SetAtName("Subtype", "Image");
+ pDict->SetNameFor("Subtype", "Image");
CPDF_ImageObject* pImgObj = AddImage(pStream, nullptr, true);
if (!pImgObj) {
if (pStream) {
@@ -737,7 +737,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
CFX_ByteString type;
if (pXObject->GetDict())
- type = pXObject->GetDict()->GetStringBy("Subtype");
+ type = pXObject->GetDict()->GetStringFor("Subtype");
if (type == "Image") {
CPDF_ImageObject* pObj = AddImage(pXObject, nullptr, false);
@@ -1134,14 +1134,14 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
const CFX_ByteString& name) {
if (!m_pResources)
return nullptr;
- CPDF_Dictionary* pDict = m_pResources->GetDictBy(type);
+ CPDF_Dictionary* pDict = m_pResources->GetDictFor(type);
if (pDict)
- return pDict->GetDirectObjectBy(name);
+ return pDict->GetDirectObjectFor(name);
if (m_pResources == m_pPageResources || !m_pPageResources)
return nullptr;
- CPDF_Dictionary* pPageDict = m_pPageResources->GetDictBy(type);
- return pPageDict ? pPageDict->GetDirectObjectBy(name) : nullptr;
+ CPDF_Dictionary* pPageDict = m_pPageResources->GetDictFor(type);
+ return pPageDict ? pPageDict->GetDirectObjectFor(name) : nullptr;
}
CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
@@ -1652,7 +1652,7 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
if (op.is_replace_key)
pDict->ReplaceKey(op.key, CFX_ByteString(op.replacement));
else
- pDict->SetAtName(op.key, CFX_ByteString(op.replacement));
+ pDict->SetNameFor(op.key, CFX_ByteString(op.replacement));
}
break;
}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 745a707902..eab0ee595b 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -121,7 +121,7 @@ uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf,
CCodec_ScanlineDecoder* pDecoder =
CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
src_buf, limit, width, height, 0,
- pParam ? pParam->GetIntegerBy("ColorTransform", 1) : 1);
+ pParam ? pParam->GetIntegerFor("ColorTransform", 1) : 1);
return DecodeAllScanlines(pDecoder, dest_buf, dest_size);
}
if (decoder == "RunLengthDecode" || decoder == "RL") {
@@ -143,23 +143,23 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
CFX_ByteString Decoder;
CPDF_Dictionary* pParam = nullptr;
- CPDF_Object* pFilter = pDict->GetDirectObjectBy("Filter");
+ CPDF_Object* pFilter = pDict->GetDirectObjectFor("Filter");
if (pFilter) {
if (CPDF_Array* pArray = pFilter->AsArray()) {
Decoder = pArray->GetStringAt(0);
- CPDF_Array* pParams = pDict->GetArrayBy("DecodeParms");
+ CPDF_Array* pParams = pDict->GetArrayFor("DecodeParms");
if (pParams)
pParam = pParams->GetDictAt(0);
} else {
Decoder = pFilter->GetString();
- pParam = pDict->GetDictBy("DecodeParms");
+ pParam = pDict->GetDictFor("DecodeParms");
}
}
- uint32_t width = pDict->GetIntegerBy("Width");
- uint32_t height = pDict->GetIntegerBy("Height");
+ uint32_t width = pDict->GetIntegerFor("Width");
+ uint32_t height = pDict->GetIntegerFor("Height");
uint32_t OrigSize = 0;
if (pCSObj) {
- uint32_t bpc = pDict->GetIntegerBy("BitsPerComponent");
+ uint32_t bpc = pDict->GetIntegerFor("BitsPerComponent");
uint32_t nComponents = 1;
CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj);
if (pCS) {
@@ -236,7 +236,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
FXSYS_memcpy(pData, m_pBuf + m_Pos, dwStreamSize);
m_Pos += dwStreamSize;
}
- pDict->SetAtInteger("Length", (int)dwStreamSize);
+ pDict->SetIntegerFor("Length", (int)dwStreamSize);
return new CPDF_Stream(pData, dwStreamSize, pDict);
}
@@ -369,7 +369,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(bool bAllowNestedArray,
if (key.IsEmpty())
pObj->Release();
else
- pDict->SetAt(key, pObj);
+ pDict->SetFor(key, pObj);
}
return pDict;
}
@@ -651,7 +651,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage) {
m_InternalStage = STAGE_GETCONTENT;
m_CurrentOffset = 0;
- CPDF_Object* pContent = pPage->m_pFormDict->GetDirectObjectBy("Contents");
+ CPDF_Object* pContent = pPage->m_pFormDict->GetDirectObjectFor("Contents");
if (!pContent) {
m_Status = Done;
return;
@@ -679,11 +679,11 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm,
m_pType3Char = pType3Char;
m_pObjectHolder = pForm;
m_bForm = TRUE;
- CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix");
+ CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixFor("Matrix");
if (pGraphicStates) {
form_matrix.Concat(pGraphicStates->m_CTM);
}
- CPDF_Array* pBBox = pForm->m_pFormDict->GetArrayBy("BBox");
+ CPDF_Array* pBBox = pForm->m_pFormDict->GetArrayFor("BBox");
CFX_FloatRect form_bbox;
CPDF_Path ClipPath;
if (pBBox) {
@@ -700,7 +700,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm,
form_bbox.Transform(pParentMatrix);
}
}
- CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDictBy("Resources");
+ CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDictFor("Resources");
m_pParser.reset(new CPDF_StreamContentParser(
pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources,
pParentMatrix, pForm, pResources, &form_bbox, pGraphicStates, level));
@@ -759,7 +759,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
m_CurrentOffset = 0;
} else {
CPDF_Array* pContent =
- m_pObjectHolder->m_pFormDict->GetArrayBy("Contents");
+ m_pObjectHolder->m_pFormDict->GetArrayFor("Contents");
m_StreamArray[m_CurrentOffset].reset(new CPDF_StreamAcc);
CPDF_Stream* pStreamObj = ToStream(
pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr);