| 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 "GrAAHairLinePathRenderer.h" | 8 #include "GrAAHairLinePathRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 724 |
| 725 // compute bounds | 725 // compute bounds |
| 726 fBounds = geometry.fPath.getBounds(); | 726 fBounds = geometry.fPath.getBounds(); |
| 727 geometry.fViewMatrix.mapRect(&fBounds); | 727 geometry.fViewMatrix.mapRect(&fBounds); |
| 728 | 728 |
| 729 // This is b.c. hairlines are notionally infinitely thin so without expa
nsion | 729 // This is b.c. hairlines are notionally infinitely thin so without expa
nsion |
| 730 // two overlapping lines could be reordered even though they hit the sam
e pixels. | 730 // two overlapping lines could be reordered even though they hit the sam
e pixels. |
| 731 fBounds.outset(0.5f, 0.5f); | 731 fBounds.outset(0.5f, 0.5f); |
| 732 } | 732 } |
| 733 | 733 |
| 734 bool onCombineIfPossible(GrBatch* t) override { | 734 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
| 735 if (!this->pipeline()->isEqual(*t->pipeline())) { | 735 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 736 caps)) { |
| 736 return false; | 737 return false; |
| 737 } | 738 } |
| 738 | 739 |
| 739 AAHairlineBatch* that = t->cast<AAHairlineBatch>(); | 740 AAHairlineBatch* that = t->cast<AAHairlineBatch>(); |
| 740 | 741 |
| 741 if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspec
tive()) { | 742 if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspec
tive()) { |
| 742 return false; | 743 return false; |
| 743 } | 744 } |
| 744 | 745 |
| 745 // We go to identity if we don't have perspective | 746 // We go to identity if we don't have perspective |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 GrColor color = GrRandomColor(random); | 991 GrColor color = GrRandomColor(random); |
| 991 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 992 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 992 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 993 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
| 993 SkPath path = GrTest::TestPath(random); | 994 SkPath path = GrTest::TestPath(random); |
| 994 SkIRect devClipBounds; | 995 SkIRect devClipBounds; |
| 995 devClipBounds.setEmpty(); | 996 devClipBounds.setEmpty(); |
| 996 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 997 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
| 997 } | 998 } |
| 998 | 999 |
| 999 #endif | 1000 #endif |
| OLD | NEW |