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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 50 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
51 const GrGLSLCaps& caps, | 51 const GrGLSLCaps& caps, |
52 GrProcessorKeyBuilder* b) const override; | 52 GrProcessorKeyBuilder* b) const override; |
53 | 53 |
54 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, | 54 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, |
55 const GrGLSLCaps& caps) con
st override; | 55 const GrGLSLCaps& caps) con
st override; |
56 | 56 |
57 private: | 57 private: |
58 GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& l
ocalMatrix); | 58 GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& l
ocalMatrix); |
59 | 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 |
60 bool hasExplicitLocalCoords() const override { return false; } | 92 bool hasExplicitLocalCoords() const override { return false; } |
61 | 93 |
62 GrColor fColor; | 94 GrColor fColor; |
63 const SkMatrix fViewMatrix; | 95 const SkMatrix fViewMatrix; |
64 const SkMatrix fLocalMatrix; | 96 const SkMatrix fLocalMatrix; |
65 | 97 |
66 typedef GrPrimitiveProcessor INHERITED; | 98 typedef GrPrimitiveProcessor INHERITED; |
67 }; | 99 }; |
68 | 100 |
69 #endif | 101 #endif |
OLD | NEW |