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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
9 | 9 |
10 #include "GrEffect.h" | 10 #include "GrEffect.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 static const char* Name() { return "CircleEdge"; } | 85 static const char* Name() { return "CircleEdge"; } |
86 | 86 |
87 inline bool isStroked() const { return fStroke; } | 87 inline bool isStroked() const { return fStroke; } |
88 | 88 |
89 class GLEffect : public GrGLEffect { | 89 class GLEffect : public GrGLEffect { |
90 public: | 90 public: |
91 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 91 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
92 : INHERITED (factory) {} | 92 : INHERITED (factory) {} |
93 | 93 |
94 virtual bool requiresVertexShader(const GrDrawEffect&) const SK_OVERRIDE
{ return true; } | |
95 | |
96 virtual void emitCode(GrGLShaderBuilder* builder, | 94 virtual void emitCode(GrGLShaderBuilder* builder, |
97 const GrDrawEffect& drawEffect, | 95 const GrDrawEffect& drawEffect, |
98 EffectKey key, | 96 EffectKey key, |
99 const char* outputColor, | 97 const char* outputColor, |
100 const char* inputColor, | 98 const char* inputColor, |
101 const TextureSamplerArray& samplers) SK_OVERRIDE { | 99 const TextureSamplerArray& samplers) SK_OVERRIDE { |
102 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); | 100 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); |
103 SkASSERT(NULL != vertexBuilder); | 101 SkASSERT(NULL != vertexBuilder); |
104 | 102 |
105 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); | 103 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 198 |
201 static const char* Name() { return "EllipseEdge"; } | 199 static const char* Name() { return "EllipseEdge"; } |
202 | 200 |
203 inline bool isStroked() const { return fStroke; } | 201 inline bool isStroked() const { return fStroke; } |
204 | 202 |
205 class GLEffect : public GrGLEffect { | 203 class GLEffect : public GrGLEffect { |
206 public: | 204 public: |
207 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 205 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
208 : INHERITED (factory) {} | 206 : INHERITED (factory) {} |
209 | 207 |
210 virtual bool requiresVertexShader(const GrDrawEffect&) const SK_OVERRIDE
{ return true; } | |
211 | |
212 virtual void emitCode(GrGLShaderBuilder* builder, | 208 virtual void emitCode(GrGLShaderBuilder* builder, |
213 const GrDrawEffect& drawEffect, | 209 const GrDrawEffect& drawEffect, |
214 EffectKey key, | 210 EffectKey key, |
215 const char* outputColor, | 211 const char* outputColor, |
216 const char* inputColor, | 212 const char* inputColor, |
217 const TextureSamplerArray& samplers) SK_OVERRIDE { | 213 const TextureSamplerArray& samplers) SK_OVERRIDE { |
218 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); | 214 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); |
219 SkASSERT(NULL != vertexBuilder); | 215 SkASSERT(NULL != vertexBuilder); |
220 | 216 |
221 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); | 217 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 } | 1138 } |
1143 | 1139 |
1144 // drop out the middle quad if we're stroked | 1140 // drop out the middle quad if we're stroked |
1145 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO
UNT(gRRectIndices); | 1141 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO
UNT(gRRectIndices); |
1146 target->setIndexSourceToBuffer(indexBuffer); | 1142 target->setIndexSourceToBuffer(indexBuffer); |
1147 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); | 1143 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); |
1148 } | 1144 } |
1149 | 1145 |
1150 return true; | 1146 return true; |
1151 } | 1147 } |
OLD | NEW |