blob: b57f502a86964f2c38a1cf1dd8cfa0e58f57d2c1 [file] [log] [blame]
joshualitt8072caa2015-02-12 14:20:52 -08001/*
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
joshualitt8072caa2015-02-12 14:20:52 -080013/*
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,
joshualittf2384692015-09-10 11:00:51 -070020 const GrPipelineOptimizations& opts,
joshualitt8072caa2015-02-12 14:20:52 -080021 const SkMatrix& viewMatrix = SkMatrix::I(),
22 const SkMatrix& localMatrix = SkMatrix::I()) {
joshualittf2384692015-09-10 11:00:51 -070023 return new GrPathProcessor(color, opts, viewMatrix, localMatrix);
joshualitt8072caa2015-02-12 14:20:52 -080024 }
25
mtklein36352bf2015-03-25 18:17:31 -070026 const char* name() const override { return "PathProcessor"; }
joshualitt8072caa2015-02-12 14:20:52 -080027
28 GrColor color() const { return fColor; }
joshualitte3ababe2015-05-15 07:56:07 -070029 const SkMatrix& viewMatrix() const { return fViewMatrix; }
30 const SkMatrix& localMatrix() const { return fLocalMatrix; }
31
mtklein36352bf2015-03-25 18:17:31 -070032 bool willUseGeoShader() const override { return false; }
joshualitt8072caa2015-02-12 14:20:52 -080033
joshualitt465283c2015-09-11 08:19:35 -070034 virtual void getGLProcessorKey(const GrGLSLCaps& caps,
mtklein36352bf2015-03-25 18:17:31 -070035 GrProcessorKeyBuilder* b) const override;
joshualitt8072caa2015-02-12 14:20:52 -080036
joshualitt465283c2015-09-11 08:19:35 -070037 virtual GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) const override;
joshualitt8072caa2015-02-12 14:20:52 -080038
joshualittb2aa7cb2015-08-05 11:05:22 -070039 bool hasTransformedLocalCoords() const override { return false; }
40
joshualittf2384692015-09-10 11:00:51 -070041 const GrPipelineOptimizations& opts() const { return fOpts; }
42
joshualitt8072caa2015-02-12 14:20:52 -080043private:
joshualittf2384692015-09-10 11:00:51 -070044 GrPathProcessor(GrColor color, const GrPipelineOptimizations& opts,
45 const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
joshualitte3ababe2015-05-15 07:56:07 -070046
mtklein36352bf2015-03-25 18:17:31 -070047 bool hasExplicitLocalCoords() const override { return false; }
joshualitt8072caa2015-02-12 14:20:52 -080048
joshualitt8072caa2015-02-12 14:20:52 -080049 GrColor fColor;
joshualitte3ababe2015-05-15 07:56:07 -070050 const SkMatrix fViewMatrix;
51 const SkMatrix fLocalMatrix;
joshualittf2384692015-09-10 11:00:51 -070052 GrPipelineOptimizations fOpts;
joshualitt8072caa2015-02-12 14:20:52 -080053
54 typedef GrPrimitiveProcessor INHERITED;
55};
56
57#endif