blob: fdd849875f6daed4e77a70e779bc5f287b396d58 [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,
ethannicholasff210322015-11-24 12:10:10 -080020 const GrXPOverridesForBatch& overrides,
joshualitt8072caa2015-02-12 14:20:52 -080021 const SkMatrix& viewMatrix = SkMatrix::I(),
22 const SkMatrix& localMatrix = SkMatrix::I()) {
ethannicholasff210322015-11-24 12:10:10 -080023 return new GrPathProcessor(color, overrides, 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
egdaniel57d3b032015-11-13 11:57:27 -080034 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps,
35 GrProcessorKeyBuilder* b) const override;
joshualitt8072caa2015-02-12 14:20:52 -080036
egdaniel57d3b032015-11-13 11:57:27 -080037 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(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
ethannicholasff210322015-11-24 12:10:10 -080041 const GrXPOverridesForBatch& overrides() const { return fOverrides; }
joshualittf2384692015-09-10 11:00:51 -070042
ethannicholas22793252016-01-30 09:59:10 -080043 virtual bool isPathRendering() const override { return true; }
44
joshualitt8072caa2015-02-12 14:20:52 -080045private:
ethannicholasff210322015-11-24 12:10:10 -080046 GrPathProcessor(GrColor color, const GrXPOverridesForBatch& overrides,
joshualittf2384692015-09-10 11:00:51 -070047 const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
joshualitte3ababe2015-05-15 07:56:07 -070048
mtklein36352bf2015-03-25 18:17:31 -070049 bool hasExplicitLocalCoords() const override { return false; }
joshualitt8072caa2015-02-12 14:20:52 -080050
joshualitt8072caa2015-02-12 14:20:52 -080051 GrColor fColor;
joshualitte3ababe2015-05-15 07:56:07 -070052 const SkMatrix fViewMatrix;
53 const SkMatrix fLocalMatrix;
ethannicholasff210322015-11-24 12:10:10 -080054 GrXPOverridesForBatch fOverrides;
joshualitt8072caa2015-02-12 14:20:52 -080055
56 typedef GrPrimitiveProcessor INHERITED;
57};
58
59#endif