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 */
17class GrPathProcessor : public GrPrimitiveProcessor {
18public:
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 virtual void getGLSLProcessorKey(const GrShaderCaps& caps,
32 GrProcessorKeyBuilder* b) const override;
33
34 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
35
36 virtual bool isPathRendering() const override { return true; }
37
38private:
39 GrPathProcessor(const SkPMColor4f&, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
40
41 SkPMColor4f fColor;
42 const SkMatrix fViewMatrix;
43 const SkMatrix fLocalMatrix;
44
45 typedef GrPrimitiveProcessor INHERITED;
46};
47
48#endif
49