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 */
17class GrPathProcessor : public GrPrimitiveProcessor {
18public:
19    static GrPathProcessor* Create(GrColor 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    GrColor color() const { return fColor; }
28    const SkMatrix& viewMatrix() const { return fViewMatrix; }
29    const SkMatrix& localMatrix() const { return fLocalMatrix; }
30
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
38    virtual bool isPathRendering() const override { return true; }
39
40private:
41    GrPathProcessor(GrColor, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
42
43    bool hasExplicitLocalCoords() const override { return false; }
44
45    GrColor fColor;
46    const SkMatrix fViewMatrix;
47    const SkMatrix fLocalMatrix;
48
49    typedef GrPrimitiveProcessor INHERITED;
50};
51
52#endif
53