1 /* 2 * Copyright 2013 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrPathProcessor_DEFINED 9 #define GrPathProcessor_DEFINED 10 11 #include "GrPrimitiveProcessor.h" 12 13 /* 14 * The path equivalent of the GP. For now this just manages color. In the long term we plan on 15 * extending this class to handle all nvpr uniform / varying / program work. 16 */ 17 class GrPathProcessor : public GrPrimitiveProcessor { 18 public: 19 static GrPathProcessor* Create(GrColor color, 20 const GrXPOverridesForBatch& overrides, 21 const SkMatrix& viewMatrix = SkMatrix::I(), 22 const SkMatrix& localMatrix = SkMatrix::I()) { 23 return new GrPathProcessor(color, overrides, viewMatrix, localMatrix); 24 } 25 name()26 const char* name() const override { return "PathProcessor"; } 27 color()28 GrColor color() const { return fColor; } viewMatrix()29 const SkMatrix& viewMatrix() const { return fViewMatrix; } localMatrix()30 const SkMatrix& localMatrix() const { return fLocalMatrix; } 31 willUseGeoShader()32 bool willUseGeoShader() const override { return false; } 33 34 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, 35 GrProcessorKeyBuilder* b) const override; 36 37 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps) const override; 38 overrides()39 const GrXPOverridesForBatch& overrides() const { return fOverrides; } 40 isPathRendering()41 virtual bool isPathRendering() const override { return true; } 42 43 private: 44 GrPathProcessor(GrColor color, const GrXPOverridesForBatch& overrides, 45 const SkMatrix& viewMatrix, const SkMatrix& localMatrix); 46 hasExplicitLocalCoords()47 bool hasExplicitLocalCoords() const override { return false; } 48 49 GrColor fColor; 50 const SkMatrix fViewMatrix; 51 const SkMatrix fLocalMatrix; 52 GrXPOverridesForBatch fOverrides; 53 54 typedef GrPrimitiveProcessor INHERITED; 55 }; 56 57 #endif 58