OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrPathProcessor.h" | 8 #include "GrPathProcessor.h" |
9 | 9 |
10 #include "gl/GrGLGpu.h" | 10 #include "gl/GrGLGpu.h" |
11 #include "glsl/GrGLSLCaps.h" | 11 #include "glsl/GrGLSLCaps.h" |
12 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 12 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
13 #include "glsl/GrGLSLProcessorTypes.h" | 13 #include "glsl/GrGLSLProcessorTypes.h" |
14 #include "glsl/GrGLSLProgramBuilder.h" | 14 #include "glsl/GrGLSLProgramBuilder.h" |
15 | 15 |
16 class GrGLPathProcessor : public GrGLPrimitiveProcessor { | 16 class GrGLPathProcessor : public GrGLSLPrimitiveProcessor { |
17 public: | 17 public: |
18 GrGLPathProcessor() : fColor(GrColor_ILLEGAL) {} | 18 GrGLPathProcessor() : fColor(GrColor_ILLEGAL) {} |
19 | 19 |
20 static void GenKey(const GrPathProcessor& pathProc, | 20 static void GenKey(const GrPathProcessor& pathProc, |
21 const GrGLSLCaps&, | 21 const GrGLSLCaps&, |
22 GrProcessorKeyBuilder* b) { | 22 GrProcessorKeyBuilder* b) { |
23 b->add32(SkToInt(pathProc.opts().readsColor()) | | 23 b->add32(SkToInt(pathProc.opts().readsColor()) | |
24 SkToInt(pathProc.opts().readsCoverage()) << 16); | 24 SkToInt(pathProc.opts().readsCoverage()) << 16); |
25 } | 25 } |
26 | 26 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 transforms[t].fType == kVec3f_GrSLType); | 104 transforms[t].fType == kVec3f_GrSLType); |
105 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3
; | 105 unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3
; |
106 pdman.setPathFragmentInputTransform(transforms[t].fHandle, component
s, transform); | 106 pdman.setPathFragmentInputTransform(transforms[t].fHandle, component
s, transform); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 private: | 110 private: |
111 UniformHandle fColorUniform; | 111 UniformHandle fColorUniform; |
112 GrColor fColor; | 112 GrColor fColor; |
113 | 113 |
114 typedef GrGLPrimitiveProcessor INHERITED; | 114 typedef GrGLSLPrimitiveProcessor INHERITED; |
115 }; | 115 }; |
116 | 116 |
117 GrPathProcessor::GrPathProcessor(GrColor color, | 117 GrPathProcessor::GrPathProcessor(GrColor color, |
118 const GrPipelineOptimizations& opts, | 118 const GrPipelineOptimizations& opts, |
119 const SkMatrix& viewMatrix, | 119 const SkMatrix& viewMatrix, |
120 const SkMatrix& localMatrix) | 120 const SkMatrix& localMatrix) |
121 : INHERITED(true) | 121 : INHERITED(true) |
122 , fColor(color) | 122 , fColor(color) |
123 , fViewMatrix(viewMatrix) | 123 , fViewMatrix(viewMatrix) |
124 , fLocalMatrix(localMatrix) | 124 , fLocalMatrix(localMatrix) |
125 , fOpts(opts) { | 125 , fOpts(opts) { |
126 this->initClassID<GrPathProcessor>(); | 126 this->initClassID<GrPathProcessor>(); |
127 } | 127 } |
128 | 128 |
129 void GrPathProcessor::getGLProcessorKey(const GrGLSLCaps& caps, | 129 void GrPathProcessor::getGLProcessorKey(const GrGLSLCaps& caps, |
130 GrProcessorKeyBuilder* b) const { | 130 GrProcessorKeyBuilder* b) const { |
131 GrGLPathProcessor::GenKey(*this, caps, b); | 131 GrGLPathProcessor::GenKey(*this, caps, b); |
132 } | 132 } |
133 | 133 |
134 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrGLSLCaps& caps
) const { | 134 GrGLSLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrGLSLCaps& ca
ps) const { |
135 SkASSERT(caps.pathRenderingSupport()); | 135 SkASSERT(caps.pathRenderingSupport()); |
136 return new GrGLPathProcessor(); | 136 return new GrGLPathProcessor(); |
137 } | 137 } |
OLD | NEW |