summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-26 18:42:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-26 18:42:28 +0000
commit0a6dbeffbc61f2140b1b845f6791c1b15b34cbd7 (patch)
tree7f17e935721f2e9752d2b80fe4cdcbb4f8eb79ba /core/fpdfapi/page
parent785da23f6cce8004b8e7759345abd877dab953ea (diff)
downloadpdfium-0a6dbeffbc61f2140b1b845f6791c1b15b34cbd7.tar.xz
Add some more consts to unowned pointers.
Ideally, unowned ptrs might well be const, as updating something through an unowned reference is best avoided. Change-Id: Ida8111ffe0ee1e30bbf6b7718b0929dfb5cafdff Reviewed-on: https://pdfium-review.googlesource.com/36050 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.cpp3
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.h10
-rw-r--r--core/fpdfapi/page/cpdf_image.h6
-rw-r--r--core/fpdfapi/page/cpdf_shadingobject.h2
-rw-r--r--core/fpdfapi/page/cpdf_shadingpattern.h6
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp2
6 files changed, 14 insertions, 15 deletions
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index a5b718bfff..2657578ab7 100644
--- a/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -154,7 +154,7 @@ void CPDF_GeneralState::SetSoftMask(CPDF_Object* pObject) {
m_Ref.GetPrivateCopy()->m_pSoftMask = pObject;
}
-CPDF_Object* CPDF_GeneralState::GetTR() const {
+const CPDF_Object* CPDF_GeneralState::GetTR() const {
const StateData* pData = m_Ref.GetObject();
return pData ? pData->m_pTR.Get() : nullptr;
}
@@ -262,7 +262,6 @@ CFX_Matrix* CPDF_GeneralState::GetMutableMatrix() {
CPDF_GeneralState::StateData::StateData()
: m_BlendMode(pdfium::transparency::kNormal),
m_BlendType(0),
- m_pSoftMask(nullptr),
m_StrokeAlpha(1.0),
m_FillAlpha(1.0f),
m_pTR(nullptr),
diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h
index 5d6d5dc552..4a101b99de 100644
--- a/core/fpdfapi/page/cpdf_generalstate.h
+++ b/core/fpdfapi/page/cpdf_generalstate.h
@@ -40,7 +40,7 @@ class CPDF_GeneralState {
CPDF_Object* GetSoftMask() const;
void SetSoftMask(CPDF_Object* pObject);
- CPDF_Object* GetTR() const;
+ const CPDF_Object* GetTR() const;
void SetTR(CPDF_Object* pObject);
RetainPtr<CPDF_TransferFunc> GetTransferFunc() const;
@@ -89,7 +89,7 @@ class CPDF_GeneralState {
CFX_Matrix m_SMaskMatrix;
float m_StrokeAlpha;
float m_FillAlpha;
- UnownedPtr<CPDF_Object> m_pTR;
+ UnownedPtr<const CPDF_Object> m_pTR;
RetainPtr<CPDF_TransferFunc> m_pTransferFunc;
CFX_Matrix m_Matrix;
int m_RenderIntent;
@@ -99,9 +99,9 @@ class CPDF_GeneralState {
bool m_StrokeOP;
bool m_FillOP;
int m_OPMode;
- UnownedPtr<CPDF_Object> m_pBG;
- UnownedPtr<CPDF_Object> m_pUCR;
- UnownedPtr<CPDF_Object> m_pHT;
+ UnownedPtr<const CPDF_Object> m_pBG;
+ UnownedPtr<const CPDF_Object> m_pUCR;
+ UnownedPtr<const CPDF_Object> m_pHT;
float m_Flatness;
float m_Smoothness;
};
diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h
index 9281a2c77d..be5883b946 100644
--- a/core/fpdfapi/page/cpdf_image.h
+++ b/core/fpdfapi/page/cpdf_image.h
@@ -29,9 +29,9 @@ class CPDF_Image : public Retainable {
void ConvertStreamToIndirectObject();
- CPDF_Stream* GetStream() const { return m_pStream.Get(); }
CPDF_Dictionary* GetDict() const;
- CPDF_Dictionary* GetOC() const { return m_pOC.Get(); }
+ CPDF_Stream* GetStream() const { return m_pStream.Get(); }
+ const CPDF_Dictionary* GetOC() const { return m_pOC.Get(); }
CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
int32_t GetPixelHeight() const { return m_Height; }
@@ -82,7 +82,7 @@ class CPDF_Image : public Retainable {
bool m_bInterpolate = false;
UnownedPtr<CPDF_Document> const m_pDocument;
MaybeOwned<CPDF_Stream> m_pStream;
- UnownedPtr<CPDF_Dictionary> m_pOC;
+ UnownedPtr<const CPDF_Dictionary> m_pOC;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_
diff --git a/core/fpdfapi/page/cpdf_shadingobject.h b/core/fpdfapi/page/cpdf_shadingobject.h
index 69b606749d..af88128443 100644
--- a/core/fpdfapi/page/cpdf_shadingobject.h
+++ b/core/fpdfapi/page/cpdf_shadingobject.h
@@ -33,7 +33,7 @@ class CPDF_ShadingObject : public CPDF_PageObject {
const CFX_Matrix& matrix() const { return m_Matrix; }
private:
- UnownedPtr<CPDF_ShadingPattern> m_pShading;
+ UnownedPtr<const CPDF_ShadingPattern> m_pShading;
CFX_Matrix m_Matrix;
};
diff --git a/core/fpdfapi/page/cpdf_shadingpattern.h b/core/fpdfapi/page/cpdf_shadingpattern.h
index 3c68c818ea..d7aa1cb272 100644
--- a/core/fpdfapi/page/cpdf_shadingpattern.h
+++ b/core/fpdfapi/page/cpdf_shadingpattern.h
@@ -55,7 +55,7 @@ class CPDF_ShadingPattern : public CPDF_Pattern {
ShadingType GetShadingType() const { return m_ShadingType; }
bool IsShadingObject() const { return m_bShadingObj; }
const CPDF_Object* GetShadingObject() const { return m_pShadingObj.Get(); }
- CPDF_ColorSpace* GetCS() const { return m_pCS.Get(); }
+ const CPDF_ColorSpace* GetCS() const { return m_pCS.Get(); }
const std::vector<std::unique_ptr<CPDF_Function>>& GetFuncs() const {
return m_pFunctions;
}
@@ -73,9 +73,9 @@ class CPDF_ShadingPattern : public CPDF_Pattern {
// Still keep |m_pCS| as some CPDF_ColorSpace (name object) are not managed
// as counted objects. Refer to CPDF_DocPageData::GetColorSpace.
- UnownedPtr<CPDF_ColorSpace> m_pCS;
+ UnownedPtr<const CPDF_ColorSpace> m_pCS;
- UnownedPtr<CPDF_CountedColorSpace> m_pCountedCS;
+ UnownedPtr<const CPDF_CountedColorSpace> m_pCountedCS;
std::vector<std::unique_ptr<CPDF_Function>> m_pFunctions;
};
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 9d6e86def0..8f3e70a278 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -76,7 +76,7 @@ CFX_FloatRect GetShadingBBox(CPDF_ShadingPattern* pShading,
const CFX_Matrix& matrix) {
ShadingType type = pShading->GetShadingType();
const CPDF_Stream* pStream = ToStream(pShading->GetShadingObject());
- CPDF_ColorSpace* pCS = pShading->GetCS();
+ const CPDF_ColorSpace* pCS = pShading->GetCS();
if (!pStream || !pCS)
return CFX_FloatRect();