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 "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
11 #include "gl/GrGLProcessor.h" | 11 #include "gl/GrGLProcessor.h" |
12 #include "gl/GrGLSL.h" | 12 #include "gl/GrGLSL.h" |
13 #include "gl/GrGLGeometryProcessor.h" | 13 #include "gl/GrGLGeometryProcessor.h" |
14 #include "GrProcessor.h" | 14 #include "GrProcessor.h" |
15 #include "GrTBackendProcessorFactory.h" | 15 #include "GrTBackendProcessorFactory.h" |
16 | 16 |
17 #include "GrDrawState.h" | 17 #include "GrDrawState.h" |
18 #include "GrDrawTarget.h" | 18 #include "GrDrawTarget.h" |
19 #include "GrGpu.h" | 19 #include "GrGpu.h" |
| 20 #include "GrInvariantOutput.h" |
20 | 21 |
21 #include "SkRRect.h" | 22 #include "SkRRect.h" |
22 #include "SkStrokeRec.h" | 23 #include "SkStrokeRec.h" |
23 #include "SkTLazy.h" | 24 #include "SkTLazy.h" |
24 | 25 |
25 #include "GrGeometryProcessor.h" | 26 #include "GrGeometryProcessor.h" |
26 #include "effects/GrRRectEffect.h" | 27 #include "effects/GrRRectEffect.h" |
27 | 28 |
28 namespace { | 29 namespace { |
29 // TODO(joshualitt) add per vertex colors | 30 // TODO(joshualitt) add per vertex colors |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 kVec4f_GrSLType, | 138 kVec4f_GrSLType, |
138 GrShaderVar::kAttribute_TypeModifier))) { | 139 GrShaderVar::kAttribute_TypeModifier))) { |
139 fStroke = stroke; | 140 fStroke = stroke; |
140 } | 141 } |
141 | 142 |
142 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { | 143 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
143 const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>(); | 144 const CircleEdgeEffect& cee = other.cast<CircleEdgeEffect>(); |
144 return cee.fStroke == fStroke; | 145 return cee.fStroke == fStroke; |
145 } | 146 } |
146 | 147 |
147 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 148 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { |
148 inout->mulByUnknownAlpha(); | 149 inout->mulByUnknownAlpha(); |
149 } | 150 } |
150 | 151 |
151 const GrShaderVar& fInCircleEdge; | 152 const GrShaderVar& fInCircleEdge; |
152 bool fStroke; | 153 bool fStroke; |
153 | 154 |
154 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 155 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
155 | 156 |
156 typedef GrGeometryProcessor INHERITED; | 157 typedef GrGeometryProcessor INHERITED; |
157 }; | 158 }; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 kVec4f_GrSLType, | 280 kVec4f_GrSLType, |
280 GrShaderVar::kAttribute_TypeModifier))) { | 281 GrShaderVar::kAttribute_TypeModifier))) { |
281 fStroke = stroke; | 282 fStroke = stroke; |
282 } | 283 } |
283 | 284 |
284 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { | 285 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
285 const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>(); | 286 const EllipseEdgeEffect& eee = other.cast<EllipseEdgeEffect>(); |
286 return eee.fStroke == fStroke; | 287 return eee.fStroke == fStroke; |
287 } | 288 } |
288 | 289 |
289 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 290 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { |
290 inout->mulByUnknownAlpha(); | 291 inout->mulByUnknownAlpha(); |
291 } | 292 } |
292 | 293 |
293 const GrShaderVar& fInEllipseOffset; | 294 const GrShaderVar& fInEllipseOffset; |
294 const GrShaderVar& fInEllipseRadii; | 295 const GrShaderVar& fInEllipseRadii; |
295 bool fStroke; | 296 bool fStroke; |
296 | 297 |
297 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 298 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
298 | 299 |
299 typedef GrGeometryProcessor INHERITED; | 300 typedef GrGeometryProcessor INHERITED; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 kVec2f_GrSLType, | 445 kVec2f_GrSLType, |
445 GrShaderVar::kAttribute_TypeModifier))) { | 446 GrShaderVar::kAttribute_TypeModifier))) { |
446 fMode = mode; | 447 fMode = mode; |
447 } | 448 } |
448 | 449 |
449 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { | 450 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
450 const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>(); | 451 const DIEllipseEdgeEffect& eee = other.cast<DIEllipseEdgeEffect>(); |
451 return eee.fMode == fMode; | 452 return eee.fMode == fMode; |
452 } | 453 } |
453 | 454 |
454 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 455 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { |
455 inout->mulByUnknownAlpha(); | 456 inout->mulByUnknownAlpha(); |
456 } | 457 } |
457 | 458 |
458 const GrShaderVar& fInEllipseOffsets0; | 459 const GrShaderVar& fInEllipseOffsets0; |
459 const GrShaderVar& fInEllipseOffsets1; | 460 const GrShaderVar& fInEllipseOffsets1; |
460 Mode fMode; | 461 Mode fMode; |
461 | 462 |
462 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 463 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
463 | 464 |
464 typedef GrGeometryProcessor INHERITED; | 465 typedef GrGeometryProcessor INHERITED; |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 // drop out the middle quad if we're stroked | 1252 // drop out the middle quad if we're stroked |
1252 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : | 1253 int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 : |
1253 SK_ARRAY_COUNT(gRRectIndices); | 1254 SK_ARRAY_COUNT(gRRectIndices); |
1254 target->setIndexSourceToBuffer(indexBuffer); | 1255 target->setIndexSourceToBuffer(indexBuffer); |
1255 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 16, indexCnt
, &bounds); | 1256 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 16, indexCnt
, &bounds); |
1256 } | 1257 } |
1257 | 1258 |
1258 target->resetIndexSource(); | 1259 target->resetIndexSource(); |
1259 return true; | 1260 return true; |
1260 } | 1261 } |
OLD | NEW |