summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page/pageint.h
diff options
context:
space:
mode:
authorcaryclark <caryclark@google.com>2016-04-12 05:08:17 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-12 05:08:17 -0700
commitf9924422a4cd1d1b6d2d4240c83b5c1082da3629 (patch)
tree94b978e3ee586645eccb6ad6c0d35d3ba7c808b1 /core/fpdfapi/fpdf_page/pageint.h
parent822484b5f88d92dbcd567b1c2da38af1e720b56f (diff)
downloadpdfium-f9924422a4cd1d1b6d2d4240c83b5c1082da3629.tar.xz
flesh out gradient shaders
Using these webpages as guides http://www.globelegislators.org/pdfjs/test/pdfs/alphatrans.pdf http://www.antennahouse.com/antenna1/wp-content/uploads/2015/07/background-image-gradient-1.pdf flesh out the gradient shaders to include the PostScript Type 0 sampling function and to include radial gradients. This CL makes rendering these pages agree with Adobe Reader output. Some of these examples use an Extend array to clip the gradient. Skia does not currently support this natively, so construct the clip manually for now. Other PDF pages may construct gradients using alternate mechanisms -- this code will continue to be refactored as those come to light. In particular, this CL sets up the clip and matrix differently for axial gradients and radial gradients -- while it makes sense to do it one way only, I prefer to defer until I have more examples to work with. R=dsinclair@chromium.org,tsepez@chromium.org Review URL: https://codereview.chromium.org/1870463002
Diffstat (limited to 'core/fpdfapi/fpdf_page/pageint.h')
-rw-r--r--core/fpdfapi/fpdf_page/pageint.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h
index e6496cfd20..98a05d5495 100644
--- a/core/fpdfapi/fpdf_page/pageint.h
+++ b/core/fpdfapi/fpdf_page/pageint.h
@@ -393,6 +393,7 @@ class CPDF_Function {
uint32_t CountInputs() const { return m_nInputs; }
uint32_t CountOutputs() const { return m_nOutputs; }
FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; }
+ FX_FLOAT GetRange(int i) const { return m_pRanges[i]; }
Type GetType() const { return m_Type; }
protected:
@@ -423,6 +424,33 @@ class CPDF_ExpIntFunc : public CPDF_Function {
FX_FLOAT* m_pEndValues;
};
+class CPDF_SampledFunc : public CPDF_Function {
+ public:
+ struct SampleEncodeInfo {
+ FX_FLOAT encode_max;
+ FX_FLOAT encode_min;
+ uint32_t sizes;
+ };
+
+ struct SampleDecodeInfo {
+ FX_FLOAT decode_max;
+ FX_FLOAT decode_min;
+ };
+
+ CPDF_SampledFunc();
+ ~CPDF_SampledFunc() override;
+
+ // CPDF_Function
+ FX_BOOL v_Init(CPDF_Object* pObj) override;
+ FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override;
+
+ SampleEncodeInfo* m_pEncodeInfo;
+ SampleDecodeInfo* m_pDecodeInfo;
+ uint32_t m_nBitsPerSample;
+ uint32_t m_SampleMax;
+ CPDF_StreamAcc* m_pSampleStream;
+};
+
class CPDF_StitchFunc : public CPDF_Function {
public:
CPDF_StitchFunc();