OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix&
viewMatrix, | 380 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix&
viewMatrix, |
381 bool isHairline, const SkRect& devBounds) | 381 bool isHairline, const SkRect& devBounds) |
382 : INHERITED(ClassID()) { | 382 : INHERITED(ClassID()) { |
383 fBatch.fCoverage = coverage; | 383 fBatch.fCoverage = coverage; |
384 fBatch.fIsHairline = isHairline; | 384 fBatch.fIsHairline = isHairline; |
385 fBatch.fViewMatrix = viewMatrix; | 385 fBatch.fViewMatrix = viewMatrix; |
386 fGeoData.push_back(geometry); | 386 fGeoData.push_back(geometry); |
387 | 387 |
388 this->setBounds(devBounds); | 388 this->setBounds(devBounds); |
| 389 |
| 390 // This is b.c. hairlines are notionally infinitely thin so without expa
nsion |
| 391 // two overlapping lines could be reordered even though they hit the sam
e pixels. |
| 392 if (isHairline) { |
| 393 fBounds.outset(0.5f, 0.5f); |
| 394 } |
389 } | 395 } |
390 | 396 |
391 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 397 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
392 DefaultPathBatch* that = t->cast<DefaultPathBatch>(); | 398 DefaultPathBatch* that = t->cast<DefaultPathBatch>(); |
393 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi
peline(), | 399 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pi
peline(), |
394 that->bounds(), caps)) { | 400 that->bounds(), caps)) { |
395 return false; | 401 return false; |
396 } | 402 } |
397 | 403 |
398 if (this->color() != that->color()) { | 404 if (this->color() != that->color()) { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 geometry.fColor = color; | 762 geometry.fColor = color; |
757 geometry.fPath = path; | 763 geometry.fPath = path; |
758 geometry.fTolerance = srcSpaceTol; | 764 geometry.fTolerance = srcSpaceTol; |
759 | 765 |
760 viewMatrix.mapRect(&bounds); | 766 viewMatrix.mapRect(&bounds); |
761 uint8_t coverage = GrRandomCoverage(random); | 767 uint8_t coverage = GrRandomCoverage(random); |
762 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 768 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
763 } | 769 } |
764 | 770 |
765 #endif | 771 #endif |
OLD | NEW |