diff options
author | caryclark <caryclark@google.com> | 2016-03-25 14:08:26 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 14:08:26 -0700 |
commit | 342f6fa66f6d843fe07d9b6a133656f83c8d62f6 (patch) | |
tree | a87e4ca21ea2d4444d98cd0ce28001de9925fa7a /core/fpdfapi/fpdf_page/pageint.h | |
parent | 46c8b1e3202ab5ae3663141dc25bec3b4360322e (diff) | |
download | pdfium-342f6fa66f6d843fe07d9b6a133656f83c8d62f6.tar.xz |
support gradients and stroke+fill
To draw paths that are stroked and filled with a pair of colors,
reduce the fill by the width of the stroke. This is implemented
with path ops subtracting the resolved stroke shape from the
fill shape. This permits rendering the result without requiring
an offscreen bitmap.
The implementation for stroke+fill requires a new entry into
the graphics engine, so a bit was added to device caps for that.
Extract the gradient information out of the axial gradient
function descriptions, and when possible, use Skia to draw
the linear gradient directly. This requires making the function
descriptions non-opaque, and adding a bit to device caps for
another entry into the graphics engine.
BUG=
Review URL: https://codereview.chromium.org/1828283002
Diffstat (limited to 'core/fpdfapi/fpdf_page/pageint.h')
-rw-r--r-- | core/fpdfapi/fpdf_page/pageint.h | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h index d254477dc3..297b1e2e77 100644 --- a/core/fpdfapi/fpdf_page/pageint.h +++ b/core/fpdfapi/fpdf_page/pageint.h @@ -377,24 +377,68 @@ class CPDF_DocPageData { class CPDF_Function { public: + enum class Type { + kType0Sampled, + kType2ExpotentialInterpolation, + kType3Stitching, + kType4PostScript, + }; + static CPDF_Function* Load(CPDF_Object* pFuncObj); virtual ~CPDF_Function(); FX_BOOL Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, int& nresults) const; - int CountInputs() { return m_nInputs; } - int CountOutputs() { return m_nOutputs; } + int CountInputs() const { return m_nInputs; } + int CountOutputs() const { return m_nOutputs; } + FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; } + Type GetType() const { return m_Type; } protected: - CPDF_Function(); - int m_nInputs, m_nOutputs; - FX_FLOAT* m_pDomains; - FX_FLOAT* m_pRanges; + CPDF_Function(Type type); FX_BOOL Init(CPDF_Object* pObj); virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; + + int m_nInputs; + int m_nOutputs; + FX_FLOAT* m_pDomains; + FX_FLOAT* m_pRanges; + Type m_Type; +}; + +class CPDF_ExpIntFunc : public CPDF_Function { + public: + CPDF_ExpIntFunc(); + ~CPDF_ExpIntFunc() override; + + // CPDF_Function + FX_BOOL v_Init(CPDF_Object* pObj) override; + FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; + + int m_nOrigOutputs; + FX_FLOAT m_Exponent; + FX_FLOAT* m_pBeginValues; + FX_FLOAT* m_pEndValues; +}; + +class CPDF_StitchFunc : public CPDF_Function { + public: + CPDF_StitchFunc(); + ~CPDF_StitchFunc() override; + + // CPDF_Function + FX_BOOL v_Init(CPDF_Object* pObj) override; + FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; + + std::vector<CPDF_Function*> m_pSubFunctions; + FX_FLOAT* m_pBounds; + FX_FLOAT* m_pEncode; + + static const int kRequiredNumInputs = 1; }; + class CPDF_IccProfile { public: CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); |