summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_colorspace.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-12-22 00:30:04 -0800
committerChromium commit bot <commit-bot@chromium.org>2017-12-22 19:44:07 +0000
commit05dcbc931eacb72f1a11835ae282fc8434b7a434 (patch)
treed05902195813a9760e6d90f5189c2dd421676975 /core/fpdfapi/page/cpdf_colorspace.h
parent891aaf63b3490989a189bcc51b18647073f988d4 (diff)
downloadpdfium-05dcbc931eacb72f1a11835ae282fc8434b7a434.tar.xz
Make sure all CPDF_ColorSpace instances consistently call v_Load(). Change-Id: I15c1608c36781a03131884abceff1ecc4a9a1eb1 Reviewed-on: https://pdfium-review.googlesource.com/21911 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_colorspace.h')
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h
index b71afb2955..7f3a739d8f 100644
--- a/core/fpdfapi/page/cpdf_colorspace.h
+++ b/core/fpdfapi/page/cpdf_colorspace.h
@@ -82,18 +82,25 @@ class CPDF_ColorSpace {
CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
protected:
- CPDF_ColorSpace(CPDF_Document* pDoc, int family, uint32_t nComponents);
+ CPDF_ColorSpace(CPDF_Document* pDoc, int family);
virtual ~CPDF_ColorSpace();
- virtual bool v_Load(CPDF_Document* pDoc,
- CPDF_Array* pArray,
- std::set<CPDF_Object*>* pVisited);
+ // Returns the number of components, or 0 on failure.
+ virtual uint32_t v_Load(CPDF_Document* pDoc,
+ CPDF_Array* pArray,
+ std::set<CPDF_Object*>* pVisited) = 0;
+
+ // Stock colorspaces are not loaded normally. This initializes their
+ // components count.
+ void SetComponentsForStockCS(uint32_t nComponents);
UnownedPtr<CPDF_Document> const m_pDocument;
- int m_Family;
- uint32_t m_nComponents;
UnownedPtr<CPDF_Array> m_pArray;
- uint32_t m_dwStdConversion;
+ const int m_Family;
+ uint32_t m_dwStdConversion = 0;
+
+ private:
+ uint32_t m_nComponents = 0;
};
using CPDF_CountedColorSpace = CPDF_CountedObject<CPDF_ColorSpace>;