| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrDefaultGeoProcFactory.h" | 8 #include "GrDefaultGeoProcFactory.h" |
| 9 | 9 |
| 10 #include "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
| 11 #include "gl/GrGLGeometryProcessor.h" | 11 #include "gl/GrGLGeometryProcessor.h" |
| 12 #include "GrDrawState.h" | 12 #include "GrDrawState.h" |
| 13 #include "GrInvariantOutput.h" |
| 13 #include "GrTBackendProcessorFactory.h" | 14 #include "GrTBackendProcessorFactory.h" |
| 14 | 15 |
| 15 /* | 16 /* |
| 16 * The default Geometry Processor simply takes position and multiplies it by the
uniform view | 17 * The default Geometry Processor simply takes position and multiplies it by the
uniform view |
| 17 * matrix. It also leaves coverage untouched. Behind the scenes, we may add per
vertex color or | 18 * matrix. It also leaves coverage untouched. Behind the scenes, we may add per
vertex color or |
| 18 * local coords. | 19 * local coords. |
| 19 */ | 20 */ |
| 20 class DefaultGeoProc : public GrGeometryProcessor { | 21 class DefaultGeoProc : public GrGeometryProcessor { |
| 21 public: | 22 public: |
| 22 static GrGeometryProcessor* Create() { | 23 static GrGeometryProcessor* Create() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 typedef GrGLGeometryProcessor INHERITED; | 56 typedef GrGLGeometryProcessor INHERITED; |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 DefaultGeoProc() {} | 60 DefaultGeoProc() {} |
| 60 | 61 |
| 61 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { | 62 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE { |
| 62 return true; | 63 return true; |
| 63 } | 64 } |
| 64 | 65 |
| 65 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 66 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { |
| 66 inout->mulByUnknownAlpha(); | 67 inout->mulByUnknownAlpha(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 70 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 70 | 71 |
| 71 typedef GrFragmentProcessor INHERITED; | 72 typedef GrFragmentProcessor INHERITED; |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DefaultGeoProc); | 75 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DefaultGeoProc); |
| 75 | 76 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } else { | 174 } else { |
| 174 // Just position | 175 // Just position |
| 175 ds->setVertexAttribs<kDefaultPositionGeoProc>(count, size); | 176 ds->setVertexAttribs<kDefaultPositionGeoProc>(count, size); |
| 176 } | 177 } |
| 177 return DefaultGeoProc::Create(); | 178 return DefaultGeoProc::Create(); |
| 178 } | 179 } |
| 179 | 180 |
| 180 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create() { | 181 const GrGeometryProcessor* GrDefaultGeoProcFactory::Create() { |
| 181 return DefaultGeoProc::Create(); | 182 return DefaultGeoProc::Create(); |
| 182 } | 183 } |
| OLD | NEW |