Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 1123253003: fix bounds for BW lines, AA Hairlines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | src/gpu/GrContext.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | src/gpu/GrContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698