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 "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 // compute bounds | 729 // compute bounds |
730 fBounds = geometry.fPath.getBounds(); | 730 fBounds = geometry.fPath.getBounds(); |
731 geometry.fViewMatrix.mapRect(&fBounds); | 731 geometry.fViewMatrix.mapRect(&fBounds); |
732 | 732 |
733 // This is b.c. hairlines are notionally infinitely thin so without expa
nsion | 733 // This is b.c. hairlines are notionally infinitely thin so without expa
nsion |
734 // two overlapping lines could be reordered even though they hit the sam
e pixels. | 734 // two overlapping lines could be reordered even though they hit the sam
e pixels. |
735 fBounds.outset(0.5f, 0.5f); | 735 fBounds.outset(0.5f, 0.5f); |
736 } | 736 } |
737 | 737 |
738 bool onCombineIfPossible(GrBatch* t) override { | 738 bool onCombineIfPossible(GrBatch* t) override { |
| 739 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 740 return false; |
| 741 } |
| 742 |
739 AAHairlineBatch* that = t->cast<AAHairlineBatch>(); | 743 AAHairlineBatch* that = t->cast<AAHairlineBatch>(); |
740 | 744 |
741 if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspec
tive()) { | 745 if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspec
tive()) { |
742 return false; | 746 return false; |
743 } | 747 } |
744 | 748 |
745 // We go to identity if we don't have perspective | 749 // We go to identity if we don't have perspective |
746 if (this->viewMatrix().hasPerspective() && | 750 if (this->viewMatrix().hasPerspective() && |
747 !this->viewMatrix().cheapEqualTo(that->viewMatrix())) { | 751 !this->viewMatrix().cheapEqualTo(that->viewMatrix())) { |
748 return false; | 752 return false; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 GrColor color = GrRandomColor(random); | 1000 GrColor color = GrRandomColor(random); |
997 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 1001 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
998 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 1002 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
999 SkPath path = GrTest::TestPath(random); | 1003 SkPath path = GrTest::TestPath(random); |
1000 SkIRect devClipBounds; | 1004 SkIRect devClipBounds; |
1001 devClipBounds.setEmpty(); | 1005 devClipBounds.setEmpty(); |
1002 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 1006 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
1003 } | 1007 } |
1004 | 1008 |
1005 #endif | 1009 #endif |
OLD | NEW |