1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef GrGLPathProcessor_DEFINED
9 #define GrGLPathProcessor_DEFINED
10 
11 #include "GrGLPrimitiveProcessor.h"
12 
13 class GrPathProcessor;
14 class GrGLPathRendering;
15 class GrGLGpu;
16 
17 class GrGLPathProcessor : public GrGLPrimitiveProcessor {
18 public:
19     GrGLPathProcessor(const GrPathProcessor&, const GrBatchTracker&);
20 
21     static void GenKey(const GrPathProcessor&,
22                        const GrBatchTracker& bt,
23                        const GrGLSLCaps&,
24                        GrProcessorKeyBuilder* b);
25 
26     void emitCode(EmitArgs&) override;
27 
28     void emitTransforms(GrGLGPBuilder*, const TransformsIn&, TransformsOut*);
29 
30     void resolveSeparableVaryings(GrGLGpu* gpu, GrGLuint programId);
31 
32     void setData(const GrGLProgramDataManager&,
33                  const GrPrimitiveProcessor&,
34                  const GrBatchTracker&) override;
35 
36     void setTransformData(const GrPrimitiveProcessor&,
37                           int index,
38                           const SkTArray<const GrCoordTransform*, true>& transforms,
39                           GrGLPathRendering*,
40                           GrGLuint programID);
41 
didSetData(GrGLPathRendering *)42     virtual void didSetData(GrGLPathRendering*) {}
43 
44 private:
45     UniformHandle fColorUniform;
46     GrColor fColor;
47     struct SeparableVaryingInfo {
48         GrSLType      fType;
49         GrGLShaderVar fVariable;
50         GrGLint       fLocation;
51     };
52 
53     typedef SkSTArray<8, SeparableVaryingInfo, true> SeparableVaryingInfoArray;
54 
55     SeparableVaryingInfoArray fSeparableVaryingInfos;
56 
57     typedef GrGLPrimitiveProcessor INHERITED;
58 };
59 
60 #endif
61