From 4c31a13a704850fdf301fb561ba966baa3c7c29c Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 7 May 2018 23:28:36 +0000 Subject: Make CPDF_PageObjectHolder::m_iTransparency protected. Also initialize members in the header. Change-Id: Id814c4c5042c9d4989fa92b78f68c17f4949f09d Reviewed-on: https://pdfium-review.googlesource.com/32111 Commit-Queue: Lei Zhang Reviewed-by: dsinclair --- core/fpdfapi/page/cpdf_contentparser.cpp | 2 +- core/fpdfapi/page/cpdf_pageobjectholder.cpp | 9 +-------- core/fpdfapi/page/cpdf_pageobjectholder.h | 6 +++--- fpdfsdk/fpdf_editpage.cpp | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 08923f38b6..0b11da5554 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -93,7 +93,7 @@ CPDF_ContentParser::CPDF_ContentParser(CPDF_Form* pForm, m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, true); } - if (pForm->m_iTransparency & PDFTRANS_GROUP) { + if (pForm->GetTransparency() & PDFTRANS_GROUP) { CPDF_GeneralState* pState = &m_pParser->GetCurStates()->m_GeneralState; pState->SetBlendType(FXDIB_BLEND_NORMAL); pState->SetStrokeAlpha(1.0f); diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp index 06fb3f26ea..5bf627ace3 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp +++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp @@ -16,14 +16,7 @@ CPDF_PageObjectHolder::CPDF_PageObjectHolder(CPDF_Document* pDoc, CPDF_Dictionary* pFormDict) - : m_pFormDict(pFormDict), - m_pFormStream(nullptr), - m_pDocument(pDoc), - m_pPageResources(nullptr), - m_pResources(nullptr), - m_iTransparency(0), - m_bBackgroundAlphaNeeded(false), - m_ParseState(CONTENT_NOT_PARSED) { + : m_pFormDict(pFormDict), m_pDocument(pDoc) { // TODO(thestig): Check if |m_pFormDict| is never a nullptr and simplify // callers that checks for that. } diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h index febc53e410..98cd97adb2 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.h +++ b/core/fpdfapi/page/cpdf_pageobjectholder.h @@ -95,16 +95,16 @@ class CPDF_PageObjectHolder { std::map m_GraphicsMap; std::map m_FontsMap; CFX_FloatRect m_BBox; - int m_iTransparency; protected: enum ParseState { CONTENT_NOT_PARSED, CONTENT_PARSING, CONTENT_PARSED }; void LoadTransInfo(); - bool m_bBackgroundAlphaNeeded; + int m_iTransparency = 0; + bool m_bBackgroundAlphaNeeded = false; std::vector m_MaskBoundingBoxes; - ParseState m_ParseState; + ParseState m_ParseState = CONTENT_NOT_PARSED; std::unique_ptr m_pParser; CPDF_PageObjectList m_PageObjectList; CFX_Matrix m_LastCTM; diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp index f38c4ff800..3f1098c371 100644 --- a/fpdfsdk/fpdf_editpage.cpp +++ b/fpdfsdk/fpdf_editpage.cpp @@ -384,7 +384,7 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { if (pPageObj->IsForm()) { const CPDF_Form* pForm = pPageObj->AsForm()->form(); if (pForm) { - int trans = pForm->m_iTransparency; + int trans = pForm->GetTransparency(); if ((trans & PDFTRANS_ISOLATED) || (trans & PDFTRANS_GROUP)) return true; } -- cgit v1.2.3