• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "src/gpu/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(const SkPMColor4f& color,
20                                    const SkMatrix& viewMatrix = SkMatrix::I(),
21                                    const SkMatrix& localMatrix = SkMatrix::I()) {
22         return new GrPathProcessor(color, viewMatrix, localMatrix);
23     }
24 
name()25     const char* name() const override { return "PathProcessor"; }
26 
color()27     const SkPMColor4f& color() const { return fColor; }
viewMatrix()28     const SkMatrix& viewMatrix() const { return fViewMatrix; }
localMatrix()29     const SkMatrix& localMatrix() const { return fLocalMatrix; }
30 
willUseGeoShader()31     bool willUseGeoShader() const override { return false; }
32 
33     virtual void getGLSLProcessorKey(const GrShaderCaps& caps,
34                                      GrProcessorKeyBuilder* b) const override;
35 
36     virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
37 
isPathRendering()38     virtual bool isPathRendering() const override { return true; }
39 
40 private:
41     GrPathProcessor(const SkPMColor4f&, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
42 
43     SkPMColor4f fColor;
44     const SkMatrix fViewMatrix;
45     const SkMatrix fLocalMatrix;
46 
47     typedef GrPrimitiveProcessor INHERITED;
48 };
49 
50 #endif
51