OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrPathProcessor_DEFINED | 8 #ifndef GrPathProcessor_DEFINED |
9 #define GrPathProcessor_DEFINED | 9 #define GrPathProcessor_DEFINED |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override
; | 32 void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override
; |
33 | 33 |
34 bool canMakeEqual(const GrBatchTracker& mine, | 34 bool canMakeEqual(const GrBatchTracker& mine, |
35 const GrPrimitiveProcessor& that, | 35 const GrPrimitiveProcessor& that, |
36 const GrBatchTracker& theirs) const override; | 36 const GrBatchTracker& theirs) const override; |
37 | 37 |
38 const char* name() const override { return "PathProcessor"; } | 38 const char* name() const override { return "PathProcessor"; } |
39 | 39 |
| 40 GrColor color() const { return fColor; } |
40 const SkMatrix& viewMatrix() const { return fViewMatrix; } | 41 const SkMatrix& viewMatrix() const { return fViewMatrix; } |
41 GrColor color() const { return fColor; } | 42 const SkMatrix& localMatrix() const { return fLocalMatrix; } |
| 43 |
42 | 44 |
43 void getInvariantOutputColor(GrInitInvariantOutput* out) const override; | 45 void getInvariantOutputColor(GrInitInvariantOutput* out) const override; |
44 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; | 46 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; |
45 | 47 |
46 bool willUseGeoShader() const override { return false; } | 48 bool willUseGeoShader() const override { return false; } |
47 | 49 |
48 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 50 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
49 const GrGLSLCaps& caps, | 51 const GrGLSLCaps& caps, |
50 GrProcessorKeyBuilder* b) const override; | 52 GrProcessorKeyBuilder* b) const override; |
51 | 53 |
52 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 54 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, |
53 const GrGLSLCaps& caps) con
st override; | 55 const GrGLSLCaps& caps) con
st override; |
54 | 56 |
55 private: | 57 private: |
56 GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& l
ocalMatrix); | 58 GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& l
ocalMatrix); |
| 59 |
| 60 /* |
| 61 * CanCombineOutput will return true if two draws are 'batchable' from a col
or perspective. |
| 62 * TODO is this really necessary? |
| 63 */ |
| 64 static bool CanCombineOutput(GrGPInput left, GrColor lColor, GrGPInput right
, GrColor rColor) { |
| 65 if (left != right) { |
| 66 return false; |
| 67 } |
| 68 |
| 69 if (kUniform_GrGPInput == left && lColor != rColor) { |
| 70 return false; |
| 71 } |
| 72 |
| 73 return true; |
| 74 } |
| 75 |
| 76 static bool CanCombineLocalMatrices(const GrPrimitiveProcessor& l, |
| 77 bool leftUsesLocalCoords, |
| 78 const GrPrimitiveProcessor& r, |
| 79 bool rightUsesLocalCoords) { |
| 80 if (leftUsesLocalCoords != rightUsesLocalCoords) { |
| 81 return false; |
| 82 } |
| 83 |
| 84 const GrPathProcessor& left = l.cast<GrPathProcessor>(); |
| 85 const GrPathProcessor& right = r.cast<GrPathProcessor>(); |
| 86 if (leftUsesLocalCoords && !left.localMatrix().cheapEqualTo(right.localM
atrix())) { |
| 87 return false; |
| 88 } |
| 89 return true; |
| 90 } |
| 91 |
57 bool hasExplicitLocalCoords() const override { return false; } | 92 bool hasExplicitLocalCoords() const override { return false; } |
58 | 93 |
| 94 GrColor fColor; |
59 const SkMatrix fViewMatrix; | 95 const SkMatrix fViewMatrix; |
60 GrColor fColor; | 96 const SkMatrix fLocalMatrix; |
61 | 97 |
62 typedef GrPrimitiveProcessor INHERITED; | 98 typedef GrPrimitiveProcessor INHERITED; |
63 }; | 99 }; |
64 | 100 |
65 #endif | 101 #endif |
OLD | NEW |