diff options
author | dsinclair <dsinclair@chromium.org> | 2016-09-15 10:15:32 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-15 10:15:32 -0700 |
commit | 38fd84428a1ea007a043be0b7d9b289e47aa5da0 (patch) | |
tree | 2bae09e8ae60d6d86e451eb7fa212f7aa9d899a8 /core/fpdfapi/fpdf_render | |
parent | 41d6bbe3d413e7854be89142b70c42a89e315cba (diff) | |
download | pdfium-38fd84428a1ea007a043be0b7d9b289e47aa5da0.tar.xz |
Rename dictionary set and get methods
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For.
BUG=pdfium:596
Review-Url: https://codereview.chromium.org/2334323005
Diffstat (limited to 'core/fpdfapi/fpdf_render')
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 18 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 40 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 24 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 2 |
5 files changed, 47 insertions, 47 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index fbb0745506..59c8397f54 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -424,7 +424,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, if (pObj->IsForm()) { const CPDF_FormObject* pFormObj = pObj->AsForm(); if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { - pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); + pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictFor("Resources"); } } CPDF_RenderStatus status; @@ -440,7 +440,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, #if defined _SKIA_SUPPORT_ DebugVerifyDeviceIsPreMultiplied(); #endif - CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictBy("OC"); + CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictFor("OC"); if (pOC && m_Options.m_pOCContext && !m_Options.m_pOCContext->CheckOCGVisible(pOC)) { return TRUE; @@ -449,7 +449,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, matrix.Concat(*pObj2Device); CPDF_Dictionary* pResources = nullptr; if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { - pResources = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); + pResources = pFormObj->m_pForm->m_pFormDict->GetDictFor("Resources"); } CPDF_RenderStatus status; status.Initialize(m_pContext, m_pDevice, nullptr, m_pStopObj, this, pFormObj, @@ -707,7 +707,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, Transparency = pFormObj->m_pForm->m_Transparency; bGroupTransparent = !!(Transparency & PDFTRANS_ISOLATED); if (pFormObj->m_pForm->m_pFormDict) { - pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); + pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictFor("Resources"); } } bool bTextClip = @@ -730,7 +730,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, ->GetImage() ->GetStream() ->GetDict() - ->GetDirectObjectBy("ColorSpace"); + ->GetDirectObjectFor("ColorSpace"); CPDF_ColorSpace* pColorSpace = pDocument->LoadColorSpace(pCSObj, pPageResources); if (pColorSpace) { diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index e23cab3546..6b842198ed 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -444,7 +444,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } if (m_pRenderStatus->m_pDevice->GetDeviceClass() != FXDC_DISPLAY) { CPDF_Object* pFilters = - m_pImageObject->GetImage()->GetStream()->GetDict()->GetDirectObjectBy( + m_pImageObject->GetImage()->GetStream()->GetDict()->GetDirectObjectFor( "Filter"); if (pFilters) { if (pFilters->IsName()) { @@ -490,7 +490,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : nullptr; CPDF_Object* pCSObj = - m_pImageObject->GetImage()->GetStream()->GetDict()->GetDirectObjectBy( + m_pImageObject->GetImage()->GetStream()->GetDict()->GetDirectObjectFor( "ColorSpace"); CPDF_ColorSpace* pColorSpace = pDocument->LoadColorSpace(pCSObj, pPageResources); @@ -954,12 +954,12 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (!pSMaskDict) return nullptr; - CPDF_Stream* pGroup = pSMaskDict->GetStreamBy("G"); + CPDF_Stream* pGroup = pSMaskDict->GetStreamFor("G"); if (!pGroup) return nullptr; std::unique_ptr<CPDF_Function> pFunc; - CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectBy("TR"); + CPDF_Object* pFuncObj = pSMaskDict->GetDirectObjectFor("TR"); if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream())) pFunc = CPDF_Function::Load(pFuncObj); @@ -971,7 +971,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, form.ParseContent(nullptr, nullptr, nullptr); CFX_FxgeDevice bitmap_device; - FX_BOOL bLuminosity = pSMaskDict->GetStringBy("S") != "Alpha"; + FX_BOOL bLuminosity = pSMaskDict->GetStringFor("S") != "Alpha"; int width = pClipRect->right - pClipRect->left; int height = pClipRect->bottom - pClipRect->top; FXDIB_Format format; @@ -987,12 +987,12 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, CPDF_Object* pCSObj = nullptr; CPDF_ColorSpace* pCS = nullptr; if (bLuminosity) { - CPDF_Array* pBC = pSMaskDict->GetArrayBy("BC"); + CPDF_Array* pBC = pSMaskDict->GetArrayFor("BC"); FX_ARGB back_color = 0xff000000; if (pBC) { CPDF_Dictionary* pDict = pGroup->GetDict(); - if (pDict && pDict->GetDictBy("Group")) - pCSObj = pDict->GetDictBy("Group")->GetDirectObjectBy("CS"); + if (pDict && pDict->GetDictFor("Group")) + pCSObj = pDict->GetDictFor("Group")->GetDirectObjectFor("CS"); else pCSObj = nullptr; pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); @@ -1026,7 +1026,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, } CPDF_Dictionary* pFormResource = nullptr; if (form.m_pFormDict) { - pFormResource = form.m_pFormDict->GetDictBy("Resources"); + pFormResource = form.m_pFormDict->GetDictFor("Resources"); } CPDF_RenderOptions options; options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA; diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index f02c59a9af..20eaba7e63 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -155,8 +155,8 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, return FALSE; } m_pStream = pStream; - m_Width = m_pDict->GetIntegerBy("Width"); - m_Height = m_pDict->GetIntegerBy("Height"); + m_Width = m_pDict->GetIntegerFor("Width"); + m_Height = m_pDict->GetIntegerFor("Height"); if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension || m_Height > kMaxImageDimension) { return FALSE; @@ -277,8 +277,8 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, m_pStream = pStream; m_bStdCS = bStdCS; m_bHasMask = bHasMask; - m_Width = m_pDict->GetIntegerBy("Width"); - m_Height = m_pDict->GetIntegerBy("Height"); + m_Width = m_pDict->GetIntegerFor("Width"); + m_Height = m_pDict->GetIntegerFor("Height"); if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension || m_Height > kMaxImageDimension) { return 0; @@ -342,7 +342,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { m_pJbig2Context.reset(new CCodec_Jbig2Context()); if (m_pStreamAcc->GetImageParam()) { CPDF_Stream* pGlobals = - m_pStreamAcc->GetImageParam()->GetStreamBy("JBIG2Globals"); + m_pStreamAcc->GetImageParam()->GetStreamFor("JBIG2Globals"); if (pGlobals) { m_pGlobalStream.reset(new CPDF_StreamAcc); m_pGlobalStream->LoadAllData(pGlobals, FALSE); @@ -405,13 +405,13 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources) { - m_bpc_orig = m_pDict->GetIntegerBy("BitsPerComponent"); - if (m_pDict->GetIntegerBy("ImageMask")) + m_bpc_orig = m_pDict->GetIntegerFor("BitsPerComponent"); + if (m_pDict->GetIntegerFor("ImageMask")) m_bImageMask = TRUE; if (m_bImageMask || !m_pDict->KeyExist("ColorSpace")) { if (!m_bImageMask) { - CPDF_Object* pFilter = m_pDict->GetDirectObjectBy("Filter"); + CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter"); if (pFilter) { CFX_ByteString filter; if (pFilter->IsName()) { @@ -428,12 +428,12 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, } m_bImageMask = TRUE; m_bpc = m_nComponents = 1; - CPDF_Array* pDecode = m_pDict->GetArrayBy("Decode"); + CPDF_Array* pDecode = m_pDict->GetArrayFor("Decode"); m_bDefaultDecode = !pDecode || !pDecode->GetIntegerAt(0); return true; } - CPDF_Object* pCSObj = m_pDict->GetDirectObjectBy("ColorSpace"); + CPDF_Object* pCSObj = m_pDict->GetDirectObjectFor("ColorSpace"); if (!pCSObj) return false; @@ -469,7 +469,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, } DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents); int max_data = (1 << m_bpc) - 1; - CPDF_Array* pDecode = m_pDict->GetArrayBy("Decode"); + CPDF_Array* pDecode = m_pDict->GetArrayFor("Decode"); if (pDecode) { for (uint32_t i = 0; i < m_nComponents; i++) { pCompData[i].m_DecodeMin = pDecode->GetNumberAt(i * 2); @@ -499,7 +499,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, } } if (!m_pDict->KeyExist("SMask")) { - CPDF_Object* pMask = m_pDict->GetDirectObjectBy("Mask"); + CPDF_Object* pMask = m_pDict->GetDirectObjectFor("Mask"); if (!pMask) { return pCompData; } @@ -551,7 +551,7 @@ int CPDF_DIBSource::CreateDecoder() { } else if (decoder == "DCTDecode") { m_pDecoder.reset(CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( src_data, src_size, m_Width, m_Height, m_nComponents, - pParams ? pParams->GetIntegerBy("ColorTransform", 1) : 1)); + pParams ? pParams->GetIntegerFor("ColorTransform", 1) : 1)); if (!m_pDecoder) { bool bTransform = false; int comps; @@ -700,9 +700,9 @@ void CPDF_DIBSource::LoadJpxBitmap() { CPDF_DIBSource* CPDF_DIBSource::LoadMask(uint32_t& MatteColor) { MatteColor = 0xFFFFFFFF; - CPDF_Stream* pSoftMask = m_pDict->GetStreamBy("SMask"); + CPDF_Stream* pSoftMask = m_pDict->GetStreamFor("SMask"); if (pSoftMask) { - CPDF_Array* pMatte = pSoftMask->GetDict()->GetArrayBy("Matte"); + CPDF_Array* pMatte = pSoftMask->GetDict()->GetArrayFor("Matte"); if (pMatte && m_pColorSpace && m_pColorSpace->CountComponents() <= m_nComponents) { std::vector<FX_FLOAT> colors(m_nComponents); @@ -717,7 +717,7 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMask(uint32_t& MatteColor) { return LoadMaskDIB(pSoftMask); } - if (CPDF_Stream* pStream = ToStream(m_pDict->GetDirectObjectBy("Mask"))) + if (CPDF_Stream* pStream = ToStream(m_pDict->GetDirectObjectFor("Mask"))) return LoadMaskDIB(pStream); return nullptr; @@ -725,9 +725,9 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMask(uint32_t& MatteColor) { int CPDF_DIBSource::StratLoadMask() { m_MatteColor = 0XFFFFFFFF; - m_pMaskStream = m_pDict->GetStreamBy("SMask"); + m_pMaskStream = m_pDict->GetStreamFor("SMask"); if (m_pMaskStream) { - CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArrayBy("Matte"); + CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArrayFor("Matte"); if (pMatte && m_pColorSpace && m_pColorSpace->CountComponents() <= m_nComponents) { FX_FLOAT R, G, B; @@ -742,7 +742,7 @@ int CPDF_DIBSource::StratLoadMask() { return StartLoadMaskDIB(); } - m_pMaskStream = ToStream(m_pDict->GetDirectObjectBy("Mask")); + m_pMaskStream = ToStream(m_pDict->GetDirectObjectFor("Mask")); return m_pMaskStream ? StartLoadMaskDIB() : 1; } @@ -869,7 +869,7 @@ void CPDF_DIBSource::LoadPalette() { void CPDF_DIBSource::ValidateDictParam() { m_bpc = m_bpc_orig; - CPDF_Object* pFilter = m_pDict->GetDirectObjectBy("Filter"); + CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter"); if (pFilter) { if (pFilter->IsName()) { CFX_ByteString filter = pFilter->GetString(); diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 63c67cc013..e20138c8e0 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -46,7 +46,7 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pCoords = pDict->GetArrayBy("Coords"); + CPDF_Array* pCoords = pDict->GetArrayFor("Coords"); if (!pCoords) { return; } @@ -55,13 +55,13 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap, FX_FLOAT end_x = pCoords->GetNumberAt(2); FX_FLOAT end_y = pCoords->GetNumberAt(3); FX_FLOAT t_min = 0, t_max = 1.0f; - CPDF_Array* pArray = pDict->GetArrayBy("Domain"); + CPDF_Array* pArray = pDict->GetArrayFor("Domain"); if (pArray) { t_min = pArray->GetNumberAt(0); t_max = pArray->GetNumberAt(1); } FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE; - pArray = pDict->GetArrayBy("Extend"); + pArray = pDict->GetArrayFor("Extend"); if (pArray) { bStartExtend = pArray->GetIntegerAt(0); bEndExtend = pArray->GetIntegerAt(1); @@ -127,7 +127,7 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pCoords = pDict->GetArrayBy("Coords"); + CPDF_Array* pCoords = pDict->GetArrayFor("Coords"); if (!pCoords) { return; } @@ -140,13 +140,13 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, CFX_Matrix matrix; matrix.SetReverse(*pObject2Bitmap); FX_FLOAT t_min = 0, t_max = 1.0f; - CPDF_Array* pArray = pDict->GetArrayBy("Domain"); + CPDF_Array* pArray = pDict->GetArrayFor("Domain"); if (pArray) { t_min = pArray->GetNumberAt(0); t_max = pArray->GetNumberAt(1); } FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE; - pArray = pDict->GetArrayBy("Extend"); + pArray = pDict->GetArrayFor("Extend"); if (pArray) { bStartExtend = pArray->GetIntegerAt(0); bEndExtend = pArray->GetIntegerAt(1); @@ -256,7 +256,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pDomain = pDict->GetArrayBy("Domain"); + CPDF_Array* pDomain = pDict->GetArrayFor("Domain"); FX_FLOAT xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f; if (pDomain) { xmin = pDomain->GetNumberAt(0); @@ -264,7 +264,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, ymin = pDomain->GetNumberAt(2); ymax = pDomain->GetNumberAt(3); } - CFX_Matrix mtDomain2Target = pDict->GetMatrixBy("Matrix"); + CFX_Matrix mtDomain2Target = pDict->GetMatrixFor("Matrix"); CFX_Matrix matrix, reverse_matrix; matrix.SetReverse(*pObject2Bitmap); reverse_matrix.SetReverse(mtDomain2Target); @@ -450,7 +450,7 @@ void DrawLatticeGouraudShading( int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - int row_verts = pShadingStream->GetDict()->GetIntegerBy("VerticesPerRow"); + int row_verts = pShadingStream->GetDict()->GetIntegerFor("VerticesPerRow"); if (row_verts < 2) return; @@ -855,7 +855,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, FX_ARGB background = 0; if (!pPattern->IsShadingObject() && pDict->KeyExist("Background")) { - CPDF_Array* pBackColor = pDict->GetArrayBy("Background"); + CPDF_Array* pBackColor = pDict->GetArrayFor("Background"); if (pBackColor && pBackColor->GetCount() >= pColorSpace->CountComponents()) { CFX_FixedBufGrow<FX_FLOAT, 16> comps(pColorSpace->CountComponents()); @@ -868,7 +868,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, } } if (pDict->KeyExist("BBox")) { - CFX_FloatRect rect = pDict->GetRectBy("BBox"); + CFX_FloatRect rect = pDict->GetRectFor("BBox"); rect.Transform(pMatrix); clip_rect.Intersect(rect.GetOuterRect()); } @@ -1055,7 +1055,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_Dictionary* pFormResource = nullptr; if (pPattern->form()->m_pFormDict) - pFormResource = pPattern->form()->m_pFormDict->GetDictBy("Resources"); + pFormResource = pPattern->form()->m_pFormDict->GetDictFor("Resources"); for (int col = min_col; col <= max_col; col++) for (int row = min_row; row <= max_row; row++) { diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index fef0bcdb79..265948f1d5 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -237,7 +237,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, CPDF_Dictionary* pFormResource = nullptr; if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) { pFormResource = - pType3Char->m_pForm->m_pFormDict->GetDictBy("Resources"); + pType3Char->m_pForm->m_pFormDict->GetDictFor("Resources"); } if (fill_alpha == 255) { CPDF_RenderStatus status; |