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 | |
25 | const char* name() const override { return "PathProcessor"; } |
26 | |
27 | const SkPMColor4f& color() const { return fColor; } |
28 | const SkMatrix& viewMatrix() const { return fViewMatrix; } |
29 | const SkMatrix& localMatrix() const { return fLocalMatrix; } |
30 | |
31 | void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; |
32 | |
33 | GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override; |
34 | |
35 | bool isPathRendering() const override { return true; } |
36 | |
37 | private: |
38 | GrPathProcessor(const SkPMColor4f&, const SkMatrix& viewMatrix, const SkMatrix& localMatrix); |
39 | |
40 | SkPMColor4f fColor; |
41 | const SkMatrix fViewMatrix; |
42 | const SkMatrix fLocalMatrix; |
43 | |
44 | typedef GrPrimitiveProcessor INHERITED; |
45 | }; |
46 | |
47 | #endif |
48 |