OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrNonAAFillRectBatch.h" | 8 #include "GrNonAAFillRectBatch.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 bool fHasLocalMatrix; | 150 bool fHasLocalMatrix; |
151 bool fHasLocalRect; | 151 bool fHasLocalRect; |
152 }; | 152 }; |
153 | 153 |
154 static const char* Name() { return "NonAAFillRectBatchPerspective"; } | 154 static const char* Name() { return "NonAAFillRectBatchPerspective"; } |
155 | 155 |
156 static bool CanCombine(const Geometry& mine, const Geometry& theirs, | 156 static bool CanCombine(const Geometry& mine, const Geometry& theirs, |
157 const GrPipelineOptimizations& opts) { | 157 const GrPipelineOptimizations& opts) { |
158 // We could batch across perspective vm changes if we really wanted to | 158 // We could batch across perspective vm changes if we really wanted to |
159 return mine.fViewMatrix.cheapEqualTo(theirs.fViewMatrix) && | 159 return mine.fViewMatrix.cheapEqualTo(theirs.fViewMatrix) && |
| 160 mine.fHasLocalRect == theirs.fHasLocalRect && |
160 (!mine.fHasLocalMatrix || mine.fLocalMatrix.cheapEqualTo(theirs.f
LocalMatrix)); | 161 (!mine.fHasLocalMatrix || mine.fLocalMatrix.cheapEqualTo(theirs.f
LocalMatrix)); |
161 } | 162 } |
162 | 163 |
163 static const GrGeometryProcessor* CreateGP(const Geometry& geo, | 164 static const GrGeometryProcessor* CreateGP(const Geometry& geo, |
164 const GrPipelineOptimizations& op
ts) { | 165 const GrPipelineOptimizations& op
ts) { |
165 const GrGeometryProcessor* gp = create_gp(geo.fViewMatrix, opts.readsCov
erage(), | 166 const GrGeometryProcessor* gp = create_gp(geo.fViewMatrix, opts.readsCov
erage(), |
166 geo.fHasLocalRect, | 167 geo.fHasLocalRect, |
167 geo.fHasLocalMatrix ? &geo.fLo
calMatrix : | 168 geo.fHasLocalMatrix ? &geo.fLo
calMatrix : |
168 nullptr)
; | 169 nullptr)
; |
169 | 170 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 SkMatrix localMatrix = GrTest::TestMatrix(random); | 258 SkMatrix localMatrix = GrTest::TestMatrix(random); |
258 | 259 |
259 bool hasLocalRect = random->nextBool(); | 260 bool hasLocalRect = random->nextBool(); |
260 bool hasLocalMatrix = random->nextBool(); | 261 bool hasLocalMatrix = random->nextBool(); |
261 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, | 262 return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, |
262 hasLocalRect ? &localRect : nullptr, | 263 hasLocalRect ? &localRect : nullptr, |
263 hasLocalMatrix ? &localMatrix : nullptr)
; | 264 hasLocalMatrix ? &localMatrix : nullptr)
; |
264 } | 265 } |
265 | 266 |
266 #endif | 267 #endif |
OLD | NEW |