summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-10 18:07:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-10 18:07:35 +0000
commit3d1ab2d09ab96a6393c0612d9c4153d10d5028ce (patch)
tree9a7be966344aeeaddf44b99f2a86a7f177ac17a9 /core/fpdfapi/page
parentf4f19b51b2d588abe80df8493c23d708ec63f1b7 (diff)
downloadpdfium-3d1ab2d09ab96a6393c0612d9c4153d10d5028ce.tar.xz
Add CPDF_Transparency.
Encapsulates transparency status instead of having it be a raw int. Change-Id: I8b10dafa97da112795cf84c46cf416a0294551d5 Reviewed-on: https://pdfium-review.googlesource.com/32194 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_contentparser.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_form.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp3
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.h8
5 files changed, 9 insertions, 10 deletions
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp
index f558ac823a..26fd0189f8 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->GetTransparency() & PDFTRANS_GROUP) {
+ if (pForm->GetTransparency().IsGroup()) {
CPDF_GeneralState* pState = &m_pParser->GetCurStates()->m_GeneralState;
pState->SetBlendType(FXDIB_BLEND_NORMAL);
pState->SetStrokeAlpha(1.0f);
diff --git a/core/fpdfapi/page/cpdf_form.cpp b/core/fpdfapi/page/cpdf_form.cpp
index bb06cbfe6f..3abeff4829 100644
--- a/core/fpdfapi/page/cpdf_form.cpp
+++ b/core/fpdfapi/page/cpdf_form.cpp
@@ -25,7 +25,7 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc,
m_pResources = pParentResources;
if (!m_pResources)
m_pResources = pPageResources;
- m_iTransparency = 0;
+ m_Transparency = CPDF_Transparency();
LoadTransInfo();
}
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index eee6673650..7c0a3234c9 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -67,7 +67,8 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
break;
}
- m_iTransparency = PDFTRANS_ISOLATED;
+ m_Transparency = CPDF_Transparency();
+ m_Transparency.SetIsolated();
LoadTransInfo();
}
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
index d8858279ca..1d39802658 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp
@@ -81,9 +81,9 @@ void CPDF_PageObjectHolder::LoadTransInfo() {
pdfium::transparency::kTransparency) {
return;
}
- m_iTransparency |= PDFTRANS_GROUP;
+ m_Transparency.SetGroup();
if (pGroup->GetIntegerFor(pdfium::transparency::kI))
- m_iTransparency |= PDFTRANS_ISOLATED;
+ m_Transparency.SetIsolated();
}
size_t CPDF_PageObjectHolder::GetPageObjectCount() const {
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index dc1a607cf0..61004444c0 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -12,6 +12,7 @@
#include <vector>
#include "core/fpdfapi/page/cpdf_pageobjectlist.h"
+#include "core/fpdfapi/render/cpdf_transparency.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -23,9 +24,6 @@ class CPDF_Document;
class CPDF_Stream;
class PauseIndicatorIface;
-#define PDFTRANS_GROUP 0x0100
-#define PDFTRANS_ISOLATED 0x0200
-
// These structs are used to keep track of resources that have already been
// generated in the page object holder.
struct GraphicsData {
@@ -72,7 +70,7 @@ class CPDF_PageObjectHolder {
const CFX_Matrix& GetLastCTM() const { return m_LastCTM; }
const CFX_FloatRect& GetBBox() const { return m_BBox; }
- int GetTransparency() const { return m_iTransparency; }
+ const CPDF_Transparency& GetTransparency() const { return m_Transparency; }
bool BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; }
void SetBackgroundAlphaNeeded(bool needed) {
m_bBackgroundAlphaNeeded = needed;
@@ -101,7 +99,7 @@ class CPDF_PageObjectHolder {
const UnownedPtr<CPDF_Dictionary> m_pFormDict;
UnownedPtr<CPDF_Document> m_pDocument;
CFX_FloatRect m_BBox;
- int m_iTransparency = 0;
+ CPDF_Transparency m_Transparency;
bool m_bBackgroundAlphaNeeded = false;
std::vector<CFX_FloatRect> m_MaskBoundingBoxes;
ParseState m_ParseState = CONTENT_NOT_PARSED;