blob: 581bd5052f6e1bddc8f2e2bb4b8b02a596fe1717 [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,
20 const SkMatrix& viewMatrix = SkMatrix::I(),
21 const SkMatrix& localMatrix = SkMatrix::I()) {
Brian Salomonecea86a2017-01-04 13:25:17 -050022 return new GrPathProcessor(color, viewMatrix, localMatrix);
joshualitt8072caa2015-02-12 14:20:52 -080023 }
24
mtklein36352bf2015-03-25 18:17:31 -070025 const char* name() const override { return "PathProcessor"; }
joshualitt8072caa2015-02-12 14:20:52 -080026
27 GrColor color() const { return fColor; }
joshualitte3ababe2015-05-15 07:56:07 -070028 const SkMatrix& viewMatrix() const { return fViewMatrix; }
29 const SkMatrix& localMatrix() const { return fLocalMatrix; }
30
mtklein36352bf2015-03-25 18:17:31 -070031 bool willUseGeoShader() const override { return false; }
joshualitt8072caa2015-02-12 14:20:52 -080032
Brian Salomon94efbf52016-11-29 13:43:05 -050033 virtual void getGLSLProcessorKey(const GrShaderCaps& caps,
egdaniel57d3b032015-11-13 11:57:27 -080034 GrProcessorKeyBuilder* b) const override;
joshualitt8072caa2015-02-12 14:20:52 -080035
Brian Salomon94efbf52016-11-29 13:43:05 -050036 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
joshualitt8072caa2015-02-12 14:20:52 -080037
ethannicholas22793252016-01-30 09:59:10 -080038 virtual bool isPathRendering() const override { return true; }
39
joshualitt8072caa2015-02-12 14:20:52 -080040private:
Brian Salomonecea86a2017-01-04 13:25:17 -050041 GrPathProcessor(GrColor, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
joshualitte3ababe2015-05-15 07:56:07 -070042
mtklein36352bf2015-03-25 18:17:31 -070043 bool hasExplicitLocalCoords() const override { return false; }
joshualitt8072caa2015-02-12 14:20:52 -080044
joshualitt8072caa2015-02-12 14:20:52 -080045 GrColor fColor;
joshualitte3ababe2015-05-15 07:56:07 -070046 const SkMatrix fViewMatrix;
47 const SkMatrix fLocalMatrix;
joshualitt8072caa2015-02-12 14:20:52 -080048
49 typedef GrPrimitiveProcessor INHERITED;
50};
51
52#endif