diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-20 19:14:53 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-20 19:14:53 +0000 |
commit | dd2a629f9ede484e0e570ce09d1e9d8906aa11be (patch) | |
tree | d8ef3690e1f888a62141fa3e12224c8be554aff6 /core/fpdfapi/page/cpdf_colorspace.h | |
parent | e61e2f3d34efee51b69838646dd4e7462989ca08 (diff) | |
download | pdfium-dd2a629f9ede484e0e570ce09d1e9d8906aa11be.tar.xz |
Add CPDF_PatternCS::GetPatternRGB(const PatternValue& value).chromium/3404chromium/3403chromium/3402
Currently, one gets data from CPDF_PatternCS via its parent class's
GetRGB(const float* pBuf) method. To squeeze through this interface, the
caller has to pass in a float*, and CPDF_PatternCS::GetRGB() has to cast
it to PatternValue*.
Instead of doing casting, add a specialized GetPatternRGB() method to
CPDF_PatternCS. In its parent class, CPDF_ColorSpace, add AsPatternCS()
so callers can get a CPDF_PatternCS* from a CPDF_ColorSpace*. Change
existing callers to use these new methods.
Change-Id: Id476c9ece7ce8d3499a718acc682bc25036a5407
Reviewed-on: https://pdfium-review.googlesource.com/31030
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.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h index b9879d135c..71722224aa 100644 --- a/core/fpdfapi/page/cpdf_colorspace.h +++ b/core/fpdfapi/page/cpdf_colorspace.h @@ -30,6 +30,7 @@ class CPDF_Array; class CPDF_Document; class CPDF_Object; +class CPDF_PatternCS; constexpr size_t kMaxPatternColorComps = 16; @@ -84,6 +85,18 @@ class CPDF_ColorSpace { bool bTransMask) const; virtual void EnableStdConversion(bool bEnabled); + // Only call these 3 methods below if GetFamily() returns |PDFCS_PATTERN|. + + // Returns |this| as a CPDF_PatternCS* if |this| is a pattern. + virtual CPDF_PatternCS* AsPatternCS(); + virtual const CPDF_PatternCS* AsPatternCS() const; + + // Use instead of GetRGB() for patterns. + virtual bool GetPatternRGB(const PatternValue& value, + float* R, + float* G, + float* B) const; + CPDF_Array* GetArray() const { return m_pArray.Get(); } CPDF_Document* GetDocument() const { return m_pDocument.Get(); } |