summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp36
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.h2
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.h2
4 files changed, 23 insertions, 21 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index 3732edaed4..b2ebc74279 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -297,7 +297,7 @@ CPDF_DIBSource::LoadState CPDF_DIBSource::ContinueLoadDIBSource(
if (!m_pJbig2Context) {
m_pJbig2Context = pdfium::MakeUnique<CCodec_Jbig2Context>();
if (m_pStreamAcc->GetImageParam()) {
- CPDF_Stream* pGlobals =
+ const CPDF_Stream* pGlobals =
m_pStreamAcc->GetImageParam()->GetStreamFor("JBIG2Globals");
if (pGlobals) {
m_pGlobalStream = pdfium::MakeRetain<CPDF_StreamAcc>(pGlobals);
@@ -653,24 +653,26 @@ RetainPtr<CFX_DIBitmap> CPDF_DIBSource::LoadJpxBitmap() {
CPDF_DIBSource::LoadState CPDF_DIBSource::StartLoadMask() {
m_MatteColor = 0XFFFFFFFF;
m_pMaskStream = m_pDict->GetStreamFor("SMask");
- if (m_pMaskStream) {
- CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArrayFor("Matte");
- if (pMatte && m_pColorSpace && m_Family != PDFCS_PATTERN &&
- m_pColorSpace->CountComponents() <= m_nComponents) {
- float R, G, B;
- std::vector<float> colors(m_nComponents);
- for (uint32_t i = 0; i < m_nComponents; i++)
- colors[i] = pMatte->GetFloatAt(i);
-
- m_pColorSpace->GetRGB(colors.data(), &R, &G, &B);
- m_MatteColor = FXARGB_MAKE(0, FXSYS_round(R * 255), FXSYS_round(G * 255),
- FXSYS_round(B * 255));
- }
- return StartLoadMaskDIB();
+ if (!m_pMaskStream) {
+ m_pMaskStream = ToStream(m_pDict->GetDirectObjectFor("Mask"));
+ return m_pMaskStream ? StartLoadMaskDIB() : LoadState::kSuccess;
}
- m_pMaskStream = ToStream(m_pDict->GetDirectObjectFor("Mask"));
- return m_pMaskStream ? StartLoadMaskDIB() : LoadState::kSuccess;
+ CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArrayFor("Matte");
+ if (pMatte && m_pColorSpace && m_Family != PDFCS_PATTERN &&
+ m_pColorSpace->CountComponents() <= m_nComponents) {
+ std::vector<float> colors(m_nComponents);
+ for (uint32_t i = 0; i < m_nComponents; i++)
+ colors[i] = pMatte->GetFloatAt(i);
+
+ float R;
+ float G;
+ float B;
+ m_pColorSpace->GetRGB(colors.data(), &R, &G, &B);
+ m_MatteColor = FXARGB_MAKE(0, FXSYS_round(R * 255), FXSYS_round(G * 255),
+ FXSYS_round(B * 255));
+ }
+ return StartLoadMaskDIB();
}
CPDF_DIBSource::LoadState CPDF_DIBSource::ContinueLoadMaskDIB(
diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h
index 50d9c6ef9c..fc390c2f6f 100644
--- a/core/fpdfapi/render/cpdf_dibsource.h
+++ b/core/fpdfapi/render/cpdf_dibsource.h
@@ -156,7 +156,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
// Must come after |m_pCachedBitmap|.
std::unique_ptr<CCodec_Jbig2Context> m_pJbig2Context;
- UnownedPtr<CPDF_Stream> m_pMaskStream;
+ UnownedPtr<const CPDF_Stream> m_pMaskStream;
LoadState m_Status = LoadState::kFail;
};
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 89cddbaa25..8c3c8796e4 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -1467,7 +1467,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
if (blend_type == FXDIB_BLEND_UNSUPPORTED)
return true;
- const CPDF_Dictionary* pSMaskDict =
+ CPDF_Dictionary* pSMaskDict =
ToDictionary(pPageObj->m_GeneralState.GetSoftMask());
if (pSMaskDict) {
if (pPageObj->IsImage() &&
@@ -2525,7 +2525,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(
}
RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
- const CPDF_Dictionary* pSMaskDict,
+ CPDF_Dictionary* pSMaskDict,
FX_RECT* pClipRect,
const CFX_Matrix* pMatrix) {
if (!pSMaskDict)
diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h
index 19d613c02e..7dee8142c4 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.h
+++ b/core/fpdfapi/render/cpdf_renderstatus.h
@@ -149,7 +149,7 @@ class CPDF_RenderStatus {
bool bBackAlphaRequired,
int* left,
int* top);
- RetainPtr<CFX_DIBitmap> LoadSMask(const CPDF_Dictionary* pSMaskDict,
+ RetainPtr<CFX_DIBitmap> LoadSMask(CPDF_Dictionary* pSMaskDict,
FX_RECT* pClipRect,
const CFX_Matrix* pMatrix);
// Optionally write the colorspace family value into |pCSFamily|.