Chromium Code Reviews| 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 724 typedef SkTArray<int, true> IntArray; | 724 typedef SkTArray<int, true> IntArray; |
| 725 typedef SkTArray<float, true> FloatArray; | 725 typedef SkTArray<float, true> FloatArray; |
| 726 | 726 |
| 727 AAHairlineBatch(const Geometry& geometry) { | 727 AAHairlineBatch(const Geometry& geometry) { |
| 728 this->initClassID<AAHairlineBatch>(); | 728 this->initClassID<AAHairlineBatch>(); |
| 729 fGeoData.push_back(geometry); | 729 fGeoData.push_back(geometry); |
| 730 | 730 |
| 731 // compute bounds | 731 // compute bounds |
| 732 fBounds = geometry.fPath.getBounds(); | 732 fBounds = geometry.fPath.getBounds(); |
| 733 geometry.fViewMatrix.mapRect(&fBounds); | 733 geometry.fViewMatrix.mapRect(&fBounds); |
| 734 | |
| 735 // AAHairlines need to be outset a half pixel in each direction to accou nt for AA | |
|
robertphillips
2015/05/07 13:17:17
// This is b.c. hairlines are notionally infinitel
| |
| 736 fBounds.outset(0.5f, 0.5f); | |
| 734 } | 737 } |
| 735 | 738 |
| 736 bool onCombineIfPossible(GrBatch* t) override { | 739 bool onCombineIfPossible(GrBatch* t) override { |
| 737 AAHairlineBatch* that = t->cast<AAHairlineBatch>(); | 740 AAHairlineBatch* that = t->cast<AAHairlineBatch>(); |
| 738 | 741 |
| 739 if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspec tive()) { | 742 if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspec tive()) { |
| 740 return false; | 743 return false; |
| 741 } | 744 } |
| 742 | 745 |
| 743 // We go to identity if we don't have perspective | 746 // We go to identity if we don't have perspective |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1028 GrColor color = GrRandomColor(random); | 1031 GrColor color = GrRandomColor(random); |
| 1029 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 1032 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 1030 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 1033 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
| 1031 SkPath path = GrTest::TestPath(random); | 1034 SkPath path = GrTest::TestPath(random); |
| 1032 SkIRect devClipBounds; | 1035 SkIRect devClipBounds; |
| 1033 devClipBounds.setEmpty(); | 1036 devClipBounds.setEmpty(); |
| 1034 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ; | 1037 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ; |
| 1035 } | 1038 } |
| 1036 | 1039 |
| 1037 #endif | 1040 #endif |
| OLD | NEW |