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 | |
12 #include "glsl/GrGLSLCaps.h" | 11 #include "glsl/GrGLSLCaps.h" |
| 12 #include "glsl/GrGLSLProcessorTypes.h" |
13 | 13 |
14 class GrGLPathProcessor : public GrGLPrimitiveProcessor { | 14 class GrGLPathProcessor : public GrGLPrimitiveProcessor { |
15 public: | 15 public: |
16 GrGLPathProcessor() : fColor(GrColor_ILLEGAL) {} | 16 GrGLPathProcessor() : fColor(GrColor_ILLEGAL) {} |
17 | 17 |
18 static void GenKey(const GrPathProcessor& pathProc, | 18 static void GenKey(const GrPathProcessor& pathProc, |
19 const GrGLSLCaps&, | 19 const GrGLSLCaps&, |
20 GrProcessorKeyBuilder* b) { | 20 GrProcessorKeyBuilder* b) { |
21 b->add32(SkToInt(pathProc.opts().readsColor()) | | 21 b->add32(SkToInt(pathProc.opts().readsColor()) | |
22 SkToInt(pathProc.opts().readsCoverage()) << 16); | 22 SkToInt(pathProc.opts().readsCoverage()) << 16); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 coordTransforms[t]->getMatrix().hasPerspective() ? kVec3
f_GrSLType : | 58 coordTransforms[t]->getMatrix().hasPerspective() ? kVec3
f_GrSLType : |
59 kVec2
f_GrSLType; | 59 kVec2
f_GrSLType; |
60 | 60 |
61 SkString strVaryingName("MatrixCoord"); | 61 SkString strVaryingName("MatrixCoord"); |
62 strVaryingName.appendf("_%i_%i", i, t); | 62 strVaryingName.appendf("_%i_%i", i, t); |
63 GrGLVertToFrag v(varyingType); | 63 GrGLVertToFrag v(varyingType); |
64 fInstalledTransforms[i][t].fHandle = | 64 fInstalledTransforms[i][t].fHandle = |
65 pb->addSeparableVarying(strVaryingName.c_str(), &v).toIn
dex(); | 65 pb->addSeparableVarying(strVaryingName.c_str(), &v).toIn
dex(); |
66 fInstalledTransforms[i][t].fType = varyingType; | 66 fInstalledTransforms[i][t].fType = varyingType; |
67 | 67 |
68 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLProcessor::TransformedCo
ords, | 68 SkNEW_APPEND_TO_TARRAY(&(*tout)[i], GrGLSLTransformedCoords, |
69 (SkString(v.fsIn()), varyingType)); | 69 (SkString(v.fsIn()), varyingType)); |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 void setData(const GrGLSLProgramDataManager& pd, | 74 void setData(const GrGLSLProgramDataManager& pd, |
75 const GrPrimitiveProcessor& primProc) override { | 75 const GrPrimitiveProcessor& primProc) override { |
76 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); | 76 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); |
77 if (pathProc.opts().readsColor() && pathProc.color() != fColor) { | 77 if (pathProc.opts().readsColor() && pathProc.color() != fColor) { |
78 float c[4]; | 78 float c[4]; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 void GrPathProcessor::getGLProcessorKey(const GrGLSLCaps& caps, | 127 void GrPathProcessor::getGLProcessorKey(const GrGLSLCaps& caps, |
128 GrProcessorKeyBuilder* b) const { | 128 GrProcessorKeyBuilder* b) const { |
129 GrGLPathProcessor::GenKey(*this, caps, b); | 129 GrGLPathProcessor::GenKey(*this, caps, b); |
130 } | 130 } |
131 | 131 |
132 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrGLSLCaps& caps
) const { | 132 GrGLPrimitiveProcessor* GrPathProcessor::createGLInstance(const GrGLSLCaps& caps
) const { |
133 SkASSERT(caps.pathRenderingSupport()); | 133 SkASSERT(caps.pathRenderingSupport()); |
134 return new GrGLPathProcessor(); | 134 return new GrGLPathProcessor(); |
135 } | 135 } |
OLD | NEW |