blob: 614adea39e855ece9c785be293bcc2e570a0935e [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/GrPrimitiveProcessor.h"
joshualitt8072caa2015-02-12 14:20:52 -080012
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:
Brian Osmancf860852018-10-31 14:04:39 -040019 static GrPathProcessor* Create(const SkPMColor4f& color,
joshualitt8072caa2015-02-12 14:20:52 -080020 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
Brian Osmancf860852018-10-31 14:04:39 -040027 const SkPMColor4f& 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
John Stiles1cf2c8d2020-08-13 22:58:04 -040031 void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override;
joshualitt8072caa2015-02-12 14:20:52 -080032
John Stiles1cf2c8d2020-08-13 22:58:04 -040033 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
joshualitt8072caa2015-02-12 14:20:52 -080034
John Stiles1cf2c8d2020-08-13 22:58:04 -040035 bool isPathRendering() const override { return true; }
ethannicholas22793252016-01-30 09:59:10 -080036
joshualitt8072caa2015-02-12 14:20:52 -080037private:
Brian Osmancf860852018-10-31 14:04:39 -040038 GrPathProcessor(const SkPMColor4f&, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
joshualitte3ababe2015-05-15 07:56:07 -070039
Brian Osmancf860852018-10-31 14:04:39 -040040 SkPMColor4f fColor;
joshualitte3ababe2015-05-15 07:56:07 -070041 const SkMatrix fViewMatrix;
42 const SkMatrix fLocalMatrix;
joshualitt8072caa2015-02-12 14:20:52 -080043
John Stiles7571f9e2020-09-02 22:42:33 -040044 using INHERITED = GrPrimitiveProcessor;
joshualitt8072caa2015-02-12 14:20:52 -080045};
46
47#endif