OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAALinearizingConvexPathRenderer.h" | 9 #include "GrAALinearizingConvexPathRenderer.h" |
10 | 10 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 private: | 257 private: |
258 AAFlatteningConvexPathBatch(const Geometry& geometry) { | 258 AAFlatteningConvexPathBatch(const Geometry& geometry) { |
259 this->initClassID<AAFlatteningConvexPathBatch>(); | 259 this->initClassID<AAFlatteningConvexPathBatch>(); |
260 fGeoData.push_back(geometry); | 260 fGeoData.push_back(geometry); |
261 | 261 |
262 // compute bounds | 262 // compute bounds |
263 fBounds = geometry.fPath.getBounds(); | 263 fBounds = geometry.fPath.getBounds(); |
264 geometry.fViewMatrix.mapRect(&fBounds); | 264 geometry.fViewMatrix.mapRect(&fBounds); |
265 } | 265 } |
266 | 266 |
267 bool onCombineIfPossible(GrBatch* t) override { | 267 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
268 if (!this->pipeline()->isEqual(*t->pipeline())) { | 268 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 269 caps)) { |
269 return false; | 270 return false; |
270 } | 271 } |
271 | 272 |
272 AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch>
(); | 273 AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch>
(); |
273 | 274 |
274 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 275 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
275 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { | 276 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { |
276 return false; | 277 return false; |
277 } | 278 } |
278 | 279 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 334 BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
334 AAFlatteningConvexPathBatch::Geometry geometry; | 335 AAFlatteningConvexPathBatch::Geometry geometry; |
335 geometry.fColor = GrRandomColor(random); | 336 geometry.fColor = GrRandomColor(random); |
336 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 337 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
337 geometry.fPath = GrTest::TestPathConvex(random); | 338 geometry.fPath = GrTest::TestPathConvex(random); |
338 | 339 |
339 return AAFlatteningConvexPathBatch::Create(geometry); | 340 return AAFlatteningConvexPathBatch::Create(geometry); |
340 } | 341 } |
341 | 342 |
342 #endif | 343 #endif |
OLD | NEW |