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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 static const char* Name() { return "CircleEdge"; } | 79 static const char* Name() { return "CircleEdge"; } |
80 | 80 |
81 inline bool isStroked() const { return fStroke; } | 81 inline bool isStroked() const { return fStroke; } |
82 | 82 |
83 class GLEffect : public GrGLEffect { | 83 class GLEffect : public GrGLEffect { |
84 public: | 84 public: |
85 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 85 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
86 : INHERITED (factory) {} | 86 : INHERITED (factory) {} |
87 | 87 |
| 88 virtual bool requiresVertexShader(const GrDrawEffect&) const SK_OVERRIDE
{ return true; } |
| 89 |
88 virtual void emitCode(GrGLShaderBuilder* builder, | 90 virtual void emitCode(GrGLShaderBuilder* builder, |
89 const GrDrawEffect& drawEffect, | 91 const GrDrawEffect& drawEffect, |
90 EffectKey key, | 92 EffectKey key, |
91 const char* outputColor, | 93 const char* outputColor, |
92 const char* inputColor, | 94 const char* inputColor, |
93 const TextureSamplerArray& samplers) SK_OVERRIDE { | 95 const TextureSamplerArray& samplers) SK_OVERRIDE { |
94 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); | 96 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); |
95 SkASSERT(NULL != vertexBuilder); | 97 SkASSERT(NULL != vertexBuilder); |
96 | 98 |
97 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); | 99 const CircleEdgeEffect& circleEffect = drawEffect.castEffect<CircleE
dgeEffect>(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 194 |
193 static const char* Name() { return "EllipseEdge"; } | 195 static const char* Name() { return "EllipseEdge"; } |
194 | 196 |
195 inline bool isStroked() const { return fStroke; } | 197 inline bool isStroked() const { return fStroke; } |
196 | 198 |
197 class GLEffect : public GrGLEffect { | 199 class GLEffect : public GrGLEffect { |
198 public: | 200 public: |
199 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) | 201 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
200 : INHERITED (factory) {} | 202 : INHERITED (factory) {} |
201 | 203 |
| 204 virtual bool requiresVertexShader(const GrDrawEffect&) const SK_OVERRIDE
{ return true; } |
| 205 |
202 virtual void emitCode(GrGLShaderBuilder* builder, | 206 virtual void emitCode(GrGLShaderBuilder* builder, |
203 const GrDrawEffect& drawEffect, | 207 const GrDrawEffect& drawEffect, |
204 EffectKey key, | 208 EffectKey key, |
205 const char* outputColor, | 209 const char* outputColor, |
206 const char* inputColor, | 210 const char* inputColor, |
207 const TextureSamplerArray& samplers) SK_OVERRIDE { | 211 const TextureSamplerArray& samplers) SK_OVERRIDE { |
208 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); | 212 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex
Builder(); |
209 SkASSERT(NULL != vertexBuilder); | 213 SkASSERT(NULL != vertexBuilder); |
210 | 214 |
211 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); | 215 const EllipseEdgeEffect& ellipseEffect = drawEffect.castEffect<Ellip
seEdgeEffect>(); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 } | 861 } |
858 | 862 |
859 // drop out the middle quad if we're stroked | 863 // drop out the middle quad if we're stroked |
860 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO
UNT(gRRectIndices); | 864 int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_CO
UNT(gRRectIndices); |
861 target->setIndexSourceToBuffer(indexBuffer); | 865 target->setIndexSourceToBuffer(indexBuffer); |
862 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); | 866 target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bou
nds); |
863 } | 867 } |
864 | 868 |
865 return true; | 869 return true; |
866 } | 870 } |
OLD | NEW |