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

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: more 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') | no next file with comments »
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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 typedef SkTArray<int, true> IntArray; 723 typedef SkTArray<int, true> IntArray;
724 typedef SkTArray<float, true> FloatArray; 724 typedef SkTArray<float, true> FloatArray;
725 725
726 AAHairlineBatch(const Geometry& geometry) { 726 AAHairlineBatch(const Geometry& geometry) {
727 this->initClassID<AAHairlineBatch>(); 727 this->initClassID<AAHairlineBatch>();
728 fGeoData.push_back(geometry); 728 fGeoData.push_back(geometry);
729 729
730 // compute bounds 730 // compute bounds
731 fBounds = geometry.fPath.getBounds(); 731 fBounds = geometry.fPath.getBounds();
732 geometry.fViewMatrix.mapRect(&fBounds); 732 geometry.fViewMatrix.mapRect(&fBounds);
733
734 // This is b.c. hairlines are notionally infinitely thin so without expa nsion
735 // two overlapping lines could be reordered even though they hit the sam e pixels.
736 fBounds.outset(0.5f, 0.5f);
733 } 737 }
734 738
735 bool onCombineIfPossible(GrBatch* t) override { 739 bool onCombineIfPossible(GrBatch* t) override {
736 AAHairlineBatch* that = t->cast<AAHairlineBatch>(); 740 AAHairlineBatch* that = t->cast<AAHairlineBatch>();
737 741
738 if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspec tive()) { 742 if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspec tive()) {
739 return false; 743 return false;
740 } 744 }
741 745
742 // We go to identity if we don't have perspective 746 // We go to identity if we don't have perspective
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 GrColor color = GrRandomColor(random); 1017 GrColor color = GrRandomColor(random);
1014 SkMatrix viewMatrix = GrTest::TestMatrix(random); 1018 SkMatrix viewMatrix = GrTest::TestMatrix(random);
1015 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); 1019 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle);
1016 SkPath path = GrTest::TestPath(random); 1020 SkPath path = GrTest::TestPath(random);
1017 SkIRect devClipBounds; 1021 SkIRect devClipBounds;
1018 devClipBounds.setEmpty(); 1022 devClipBounds.setEmpty();
1019 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ; 1023 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ;
1020 } 1024 }
1021 1025
1022 #endif 1026 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698