2 * Copyright 2013 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrPathProcessor_DEFINED
9 #define GrPathProcessor_DEFINED
11 #include "GrPrimitiveProcessor.h"
13 struct PathBatchTracker {
14 GrGPInput fInputColorType;
15 GrGPInput fInputCoverageType;
17 bool fUsesLocalCoords;
21 * The path equivalent of the GP. For now this just manages color. In the long term we plan on
22 * extending this class to handle all nvpr uniform / varying / program work.
24 class GrPathProcessor : public GrPrimitiveProcessor {
26 static GrPathProcessor* Create(GrColor color,
27 const SkMatrix& viewMatrix = SkMatrix::I(),
28 const SkMatrix& localMatrix = SkMatrix::I()) {
29 return SkNEW_ARGS(GrPathProcessor, (color, viewMatrix, localMatrix));
32 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const SK_OVERRIDE;
34 bool canMakeEqual(const GrBatchTracker& mine,
35 const GrPrimitiveProcessor& that,
36 const GrBatchTracker& theirs) const SK_OVERRIDE;
38 const char* name() const SK_OVERRIDE { return "PathProcessor"; }
40 GrColor color() const { return fColor; }
42 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE;
43 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE;
45 bool willUseGeoShader() const SK_OVERRIDE { return false; }
47 virtual void getGLProcessorKey(const GrBatchTracker& bt,
49 GrProcessorKeyBuilder* b) const SK_OVERRIDE;
51 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
52 const GrGLCaps& caps) const SK_OVERRIDE;
55 GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
58 bool hasExplicitLocalCoords() const SK_OVERRIDE { return false; }
62 typedef GrPrimitiveProcessor INHERITED;