diff options
author | tsepez <tsepez@chromium.org> | 2016-04-11 18:14:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-11 18:14:56 -0700 |
commit | 822484b5f88d92dbcd567b1c2da38af1e720b56f (patch) | |
tree | de1902c744cbe38023432cc3f860d99df90beb70 /core/fpdfapi/fpdf_render | |
parent | e09c1e4db92e28a332f55aa3c80ceb44f4b74287 (diff) | |
download | pdfium-822484b5f88d92dbcd567b1c2da38af1e720b56f.tar.xz |
Remove CPDF_Object::GetConstString and overrides
GetConstString() has sharp edges in that when applied to
a CPDF_Number, it must return null whereas GetString() returns
a the stringified number, because of the inability to
control the lifetime of the underlying allocated string.
Deleting this method showed several places where we
actually wanted a *String, not a *StringC, so we were
re-allocating a string we already had.
Review URL: https://codereview.chromium.org/1879683002
Diffstat (limited to 'core/fpdfapi/fpdf_render')
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index 6aee8e75b6..55e97a9d81 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -412,13 +412,13 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { "Filter"); if (pFilters) { if (pFilters->IsName()) { - CFX_ByteStringC bsDecodeType = pFilters->GetConstString(); + CFX_ByteString bsDecodeType = pFilters->GetString(); if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { m_Flags |= FXRENDER_IMAGE_LOSSY; } } else if (CPDF_Array* pArray = pFilters->AsArray()) { for (size_t i = 0; i < pArray->GetCount(); i++) { - CFX_ByteStringC bsDecodeType = pArray->GetConstStringAt(i); + CFX_ByteString bsDecodeType = pArray->GetStringAt(i); if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { m_Flags |= FXRENDER_IMAGE_LOSSY; break; @@ -880,10 +880,6 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (!pSMaskDict) { return NULL; } - int width = pClipRect->right - pClipRect->left; - int height = pClipRect->bottom - pClipRect->top; - FX_BOOL bLuminosity = FALSE; - bLuminosity = pSMaskDict->GetConstStringBy("S") != "Alpha"; CPDF_Stream* pGroup = pSMaskDict->GetStreamBy("G"); if (!pGroup) { return NULL; @@ -895,10 +891,15 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, CFX_Matrix matrix = *pMatrix; matrix.TranslateI(-pClipRect->left, -pClipRect->top); + CPDF_Form form(m_pContext->GetDocument(), m_pContext->GetPageResources(), pGroup); form.ParseContent(NULL, NULL, NULL, NULL); + CFX_FxgeDevice bitmap_device; + FX_BOOL bLuminosity = pSMaskDict->GetStringBy("S") != "Alpha"; + int width = pClipRect->right - pClipRect->left; + int height = pClipRect->bottom - pClipRect->top; #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!bitmap_device.Create(width, height, bLuminosity ? FXDIB_Rgb32 : FXDIB_8bppMask)) { |