diff options
Diffstat (limited to 'core/src/fpdfapi/fpdf_render')
5 files changed, 72 insertions, 71 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 28a5fe1eef..35d62ce0b3 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -446,7 +446,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, if (pObj->m_Type == CPDF_PageObject::FORM) { CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj; if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { - pFormResource = pFormObj->m_pForm->m_pFormDict->GetDict("Resources"); + pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); } } CPDF_RenderStatus status; @@ -458,7 +458,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, } FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_Matrix* pObj2Device) { - CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDict("OC"); + CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictBy("OC"); if (pOC && m_Options.m_pOCContext && !m_Options.m_pOCContext->CheckOCGVisible(pOC)) { return TRUE; @@ -467,7 +467,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, matrix.Concat(*pObj2Device); CPDF_Dictionary* pResources = NULL; if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { - pResources = pFormObj->m_pForm->m_pFormDict->GetDict("Resources"); + pResources = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); } CPDF_RenderStatus status; status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj, this, pFormObj, @@ -746,7 +746,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const 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->GetDict("Resources"); + pFormResource = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); } } FX_BOOL bTextClip = FALSE; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index a0b3059e5b..d31e214ffd 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -406,7 +406,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } } else if (CPDF_Array* pArray = pFilters->AsArray()) { for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { - CFX_ByteStringC bsDecodeType = pArray->GetConstString(i); + CFX_ByteStringC bsDecodeType = pArray->GetConstStringAt(i); if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { m_Flags |= FXRENDER_IMAGE_LOSSY; break; @@ -871,8 +871,8 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, int width = pClipRect->right - pClipRect->left; int height = pClipRect->bottom - pClipRect->top; FX_BOOL bLuminosity = FALSE; - bLuminosity = pSMaskDict->GetConstString("S") != "Alpha"; - CPDF_Stream* pGroup = pSMaskDict->GetStream("G"); + bLuminosity = pSMaskDict->GetConstStringBy("S") != "Alpha"; + CPDF_Stream* pGroup = pSMaskDict->GetStreamBy("G"); if (!pGroup) { return NULL; } @@ -902,12 +902,12 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, CPDF_Object* pCSObj = NULL; CPDF_ColorSpace* pCS = NULL; if (bLuminosity) { - CPDF_Array* pBC = pSMaskDict->GetArray("BC"); + CPDF_Array* pBC = pSMaskDict->GetArrayBy("BC"); FX_ARGB back_color = 0xff000000; if (pBC) { CPDF_Dictionary* pDict = pGroup->GetDict(); - if (pDict && pDict->GetDict("Group")) - pCSObj = pDict->GetDict("Group")->GetElementValue("CS"); + if (pDict && pDict->GetDictBy("Group")) + pCSObj = pDict->GetDictBy("Group")->GetElementValue("CS"); else pCSObj = NULL; pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); @@ -927,7 +927,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, FXSYS_memset(pFloats, 0, num_floats.ValueOrDie()); int count = pBC->GetCount() > 8 ? 8 : pBC->GetCount(); for (int i = 0; i < count; i++) { - pFloats[i] = pBC->GetNumber(i); + pFloats[i] = pBC->GetNumberAt(i); } pCS->GetRGB(pFloats, R, G, B); back_color = 0xff000000 | ((int32_t)(R * 255) << 16) | @@ -941,7 +941,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, } CPDF_Dictionary* pFormResource = NULL; if (form.m_pFormDict) { - pFormResource = form.m_pFormDict->GetDict("Resources"); + pFormResource = form.m_pFormDict->GetDictBy("Resources"); } CPDF_RenderOptions options; options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index f690c209a0..452103afca 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -222,8 +222,8 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, return FALSE; } m_pStream = pStream; - m_Width = m_pDict->GetInteger("Width"); - m_Height = m_pDict->GetInteger("Height"); + m_Width = m_pDict->GetIntegerBy("Width"); + m_Height = m_pDict->GetIntegerBy("Height"); if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension || m_Height > kMaxImageDimension) { return FALSE; @@ -342,8 +342,8 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, m_pStream = pStream; m_bStdCS = bStdCS; m_bHasMask = bHasMask; - m_Width = m_pDict->GetInteger("Width"); - m_Height = m_pDict->GetInteger("Height"); + m_Width = m_pDict->GetIntegerBy("Width"); + m_Height = m_pDict->GetIntegerBy("Height"); if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension || m_Height > kMaxImageDimension) { return 0; @@ -406,7 +406,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { m_pJbig2Context = pJbig2Module->CreateJbig2Context(); if (m_pStreamAcc->GetImageParam()) { CPDF_Stream* pGlobals = - m_pStreamAcc->GetImageParam()->GetStream("JBIG2Globals"); + m_pStreamAcc->GetImageParam()->GetStreamBy("JBIG2Globals"); if (pGlobals) { m_pGlobalStream = new CPDF_StreamAcc; m_pGlobalStream->LoadAllData(pGlobals, FALSE); @@ -473,8 +473,8 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) { bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, const CPDF_Dictionary* pPageResources) { - m_bpc_orig = m_pDict->GetInteger("BitsPerComponent"); - if (m_pDict->GetInteger("ImageMask")) + m_bpc_orig = m_pDict->GetIntegerBy("BitsPerComponent"); + if (m_pDict->GetIntegerBy("ImageMask")) m_bImageMask = TRUE; if (m_bImageMask || !m_pDict->KeyExist("ColorSpace")) { @@ -485,7 +485,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, if (pFilter->IsName()) { filter = pFilter->GetString(); } else if (CPDF_Array* pArray = pFilter->AsArray()) { - filter = pArray->GetString(pArray->GetCount() - 1); + filter = pArray->GetStringAt(pArray->GetCount() - 1); } if (filter == "JPXDecode") { @@ -496,8 +496,8 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources, } m_bImageMask = TRUE; m_bpc = m_nComponents = 1; - CPDF_Array* pDecode = m_pDict->GetArray("Decode"); - m_bDefaultDecode = !pDecode || !pDecode->GetInteger(0); + CPDF_Array* pDecode = m_pDict->GetArrayBy("Decode"); + m_bDefaultDecode = !pDecode || !pDecode->GetIntegerAt(0); return true; } @@ -537,11 +537,11 @@ 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->GetArray("Decode"); + CPDF_Array* pDecode = m_pDict->GetArrayBy("Decode"); if (pDecode) { for (FX_DWORD i = 0; i < m_nComponents; i++) { - pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2); - FX_FLOAT max = pDecode->GetNumber(i * 2 + 1); + pCompData[i].m_DecodeMin = pDecode->GetNumberAt(i * 2); + FX_FLOAT max = pDecode->GetNumberAt(i * 2 + 1); pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_data; FX_FLOAT def_value, def_min, def_max; m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max); @@ -572,8 +572,8 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, if (CPDF_Array* pArray = pMask->AsArray()) { if (pArray->GetCount() >= m_nComponents * 2) { for (FX_DWORD i = 0; i < m_nComponents; i++) { - int min_num = pArray->GetInteger(i * 2); - int max_num = pArray->GetInteger(i * 2 + 1); + int min_num = pArray->GetIntegerAt(i * 2); + int max_num = pArray->GetIntegerAt(i * 2 + 1); pCompData[i].m_ColorKeyMin = std::max(min_num, 0); pCompData[i].m_ColorKeyMax = std::min(max_num, max_data); } @@ -614,7 +614,7 @@ int CPDF_DIBSource::CreateDecoder() { } else if (decoder == "DCTDecode") { m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder( src_data, src_size, m_Width, m_Height, m_nComponents, - pParams ? pParams->GetInteger("ColorTransform", 1) : 1); + pParams ? pParams->GetIntegerBy("ColorTransform", 1) : 1); if (!m_pDecoder) { FX_BOOL bTransform = FALSE; int comps, bpc; @@ -759,14 +759,14 @@ void CPDF_DIBSource::LoadJpxBitmap() { } CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) { MatteColor = 0xFFFFFFFF; - CPDF_Stream* pSoftMask = m_pDict->GetStream("SMask"); + CPDF_Stream* pSoftMask = m_pDict->GetStreamBy("SMask"); if (pSoftMask) { - CPDF_Array* pMatte = pSoftMask->GetDict()->GetArray("Matte"); + CPDF_Array* pMatte = pSoftMask->GetDict()->GetArrayBy("Matte"); if (pMatte && m_pColorSpace && (FX_DWORD)m_pColorSpace->CountComponents() <= m_nComponents) { FX_FLOAT* pColor = FX_Alloc(FX_FLOAT, m_nComponents); for (FX_DWORD i = 0; i < m_nComponents; i++) { - pColor[i] = pMatte->GetFloat(i); + pColor[i] = pMatte->GetFloatAt(i); } FX_FLOAT R, G, B; m_pColorSpace->GetRGB(pColor, R, G, B); @@ -784,15 +784,15 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) { } int CPDF_DIBSource::StratLoadMask() { m_MatteColor = 0XFFFFFFFF; - m_pMaskStream = m_pDict->GetStream("SMask"); + m_pMaskStream = m_pDict->GetStreamBy("SMask"); if (m_pMaskStream) { - CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArray("Matte"); + CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArrayBy("Matte"); if (pMatte && m_pColorSpace && (FX_DWORD)m_pColorSpace->CountComponents() <= m_nComponents) { FX_FLOAT R, G, B; FX_FLOAT* pColor = FX_Alloc(FX_FLOAT, m_nComponents); for (FX_DWORD i = 0; i < m_nComponents; i++) { - pColor[i] = pMatte->GetFloat(i); + pColor[i] = pMatte->GetFloatAt(i); } m_pColorSpace->GetRGB(pColor, R, G, B); FX_Free(pColor); @@ -939,7 +939,7 @@ void CPDF_DIBSource::ValidateDictParam() { m_bpc = 8; } } else if (CPDF_Array* pArray = pFilter->AsArray()) { - CFX_ByteString filter = pArray->GetString(pArray->GetCount() - 1); + CFX_ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1); if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") { m_bpc = 1; m_nComponents = 1; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 6aeed548a3..ed44a04181 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -20,25 +20,25 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pCoords = pDict->GetArray("Coords"); + CPDF_Array* pCoords = pDict->GetArrayBy("Coords"); if (!pCoords) { return; } - FX_FLOAT start_x = pCoords->GetNumber(0); - FX_FLOAT start_y = pCoords->GetNumber(1); - FX_FLOAT end_x = pCoords->GetNumber(2); - FX_FLOAT end_y = pCoords->GetNumber(3); + FX_FLOAT start_x = pCoords->GetNumberAt(0); + FX_FLOAT start_y = pCoords->GetNumberAt(1); + 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->GetArray("Domain"); + CPDF_Array* pArray = pDict->GetArrayBy("Domain"); if (pArray) { - t_min = pArray->GetNumber(0); - t_max = pArray->GetNumber(1); + t_min = pArray->GetNumberAt(0); + t_max = pArray->GetNumberAt(1); } FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE; - pArray = pDict->GetArray("Extend"); + pArray = pDict->GetArrayBy("Extend"); if (pArray) { - bStartExtend = pArray->GetInteger(0); - bEndExtend = pArray->GetInteger(1); + bStartExtend = pArray->GetIntegerAt(0); + bEndExtend = pArray->GetIntegerAt(1); } int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); @@ -111,29 +111,29 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pCoords = pDict->GetArray("Coords"); + CPDF_Array* pCoords = pDict->GetArrayBy("Coords"); if (!pCoords) { return; } - FX_FLOAT start_x = pCoords->GetNumber(0); - FX_FLOAT start_y = pCoords->GetNumber(1); - FX_FLOAT start_r = pCoords->GetNumber(2); - FX_FLOAT end_x = pCoords->GetNumber(3); - FX_FLOAT end_y = pCoords->GetNumber(4); - FX_FLOAT end_r = pCoords->GetNumber(5); + FX_FLOAT start_x = pCoords->GetNumberAt(0); + FX_FLOAT start_y = pCoords->GetNumberAt(1); + FX_FLOAT start_r = pCoords->GetNumberAt(2); + FX_FLOAT end_x = pCoords->GetNumberAt(3); + FX_FLOAT end_y = pCoords->GetNumberAt(4); + FX_FLOAT end_r = pCoords->GetNumberAt(5); CFX_Matrix matrix; matrix.SetReverse(*pObject2Bitmap); FX_FLOAT t_min = 0, t_max = 1.0f; - CPDF_Array* pArray = pDict->GetArray("Domain"); + CPDF_Array* pArray = pDict->GetArrayBy("Domain"); if (pArray) { - t_min = pArray->GetNumber(0); - t_max = pArray->GetNumber(1); + t_min = pArray->GetNumberAt(0); + t_max = pArray->GetNumberAt(1); } FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE; - pArray = pDict->GetArray("Extend"); + pArray = pDict->GetArrayBy("Extend"); if (pArray) { - bStartExtend = pArray->GetInteger(0); - bEndExtend = pArray->GetInteger(1); + bStartExtend = pArray->GetIntegerAt(0); + bEndExtend = pArray->GetIntegerAt(1); } int total_results = 0; for (int j = 0; j < nFuncs; j++) { @@ -249,15 +249,15 @@ static void DrawFuncShading(CFX_DIBitmap* pBitmap, CPDF_ColorSpace* pCS, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Array* pDomain = pDict->GetArray("Domain"); + CPDF_Array* pDomain = pDict->GetArrayBy("Domain"); FX_FLOAT xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f; if (pDomain) { - xmin = pDomain->GetNumber(0); - xmax = pDomain->GetNumber(1); - ymin = pDomain->GetNumber(2); - ymax = pDomain->GetNumber(3); + xmin = pDomain->GetNumberAt(0); + xmax = pDomain->GetNumberAt(1); + ymin = pDomain->GetNumberAt(2); + ymax = pDomain->GetNumberAt(3); } - CFX_Matrix mtDomain2Target = pDict->GetMatrix("Matrix"); + CFX_Matrix mtDomain2Target = pDict->GetMatrixBy("Matrix"); CFX_Matrix matrix, reverse_matrix; matrix.SetReverse(*pObject2Bitmap); reverse_matrix.SetReverse(mtDomain2Target); @@ -453,7 +453,7 @@ static void DrawLatticeGouraudShading(CFX_DIBitmap* pBitmap, int alpha) { ASSERT(pBitmap->GetFormat() == FXDIB_Argb); - int row_verts = pShadingStream->GetDict()->GetInteger("VerticesPerRow"); + int row_verts = pShadingStream->GetDict()->GetIntegerBy("VerticesPerRow"); if (row_verts < 2) return; @@ -841,12 +841,12 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, if (!pPattern->m_bShadingObj && pPattern->m_pShadingObj->GetDict()->KeyExist("Background")) { CPDF_Array* pBackColor = - pPattern->m_pShadingObj->GetDict()->GetArray("Background"); + pPattern->m_pShadingObj->GetDict()->GetArrayBy("Background"); if (pBackColor && pBackColor->GetCount() >= (FX_DWORD)pColorSpace->CountComponents()) { CFX_FixedBufGrow<FX_FLOAT, 16> comps(pColorSpace->CountComponents()); for (int i = 0; i < pColorSpace->CountComponents(); i++) { - comps[i] = pBackColor->GetNumber(i); + comps[i] = pBackColor->GetNumberAt(i); } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pColorSpace->GetRGB(comps, R, G, B); @@ -855,7 +855,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, } } if (pDict->KeyExist("BBox")) { - CFX_FloatRect rect = pDict->GetRect("BBox"); + CFX_FloatRect rect = pDict->GetRectBy("BBox"); rect.Transform(pMatrix); clip_rect.Intersect(rect.GetOutterRect()); } @@ -1063,7 +1063,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, } CPDF_Dictionary* pFormResource = NULL; if (pPattern->m_pForm->m_pFormDict) { - pFormResource = pPattern->m_pForm->m_pFormDict->GetDict("Resources"); + pFormResource = pPattern->m_pForm->m_pFormDict->GetDictBy("Resources"); } for (int col = min_col; col <= max_col; col++) for (int row = min_row; row <= max_row; row++) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index a40284a1f8..d0427f68fa 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -411,7 +411,8 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE; CPDF_Dictionary* pFormResource = NULL; if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) { - pFormResource = pType3Char->m_pForm->m_pFormDict->GetDict("Resources"); + pFormResource = + pType3Char->m_pForm->m_pFormDict->GetDictBy("Resources"); } if (fill_alpha == 255) { CPDF_RenderStatus status; |