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

Side by Side Diff: src/gpu/batches/GrDashLinePathRenderer.cpp

Issue 2046483003: Fix dashing bug where hwaa was unintentionally disabled (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrDashLinePathRenderer.h" 8 #include "GrDashLinePathRenderer.h"
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
11 #include "GrAuditTrail.h" 11 #include "GrAuditTrail.h"
12 #include "effects/GrDashingEffect.h" 12 #include "effects/GrDashingEffect.h"
13 13
14 bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { 14 bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
15 SkPoint pts[2]; 15 SkPoint pts[2];
16 if (args.fStyle->isDashed() && args.fPath->isLine(pts)) { 16 if (args.fStyle->isDashed() && args.fPath->isLine(pts)) {
17 return GrDashingEffect::CanDrawDashLine(pts, *args.fStyle, *args.fViewMa trix); 17 return GrDashingEffect::CanDrawDashLine(pts, *args.fStyle, *args.fViewMa trix);
18 } 18 }
19 return false; 19 return false;
20 } 20 }
21 21
22 bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) { 22 bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
23 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), 23 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
24 "GrDashLinePathRenderer::onDrawPath"); 24 "GrDashLinePathRenderer::onDrawPath");
25 bool msaaIsEnabled = args.fDrawContext->isUnifiedMultisampled(); 25 // We always take the msaa codepath, regardless of paint aa, if the platform won't be able to
26 // disable multisampling. Dashes use a mix of msaa and coverage aa, so if we took the bw path in
27 // this case we would wind up with external edges antialiased and internal e dges unantialiased.
28 bool useHWAA = args.fDrawContext->isUnifiedMultisampled() &&
29 (!args.fDrawContext->caps()->multisampleDisableSupport() ||
30 args.fPaint->isAntiAlias());
31
26 GrDashingEffect::AAMode aaMode; 32 GrDashingEffect::AAMode aaMode;
27 if (msaaIsEnabled) { 33 if (useHWAA) {
28 // We ignore args.fAntiAlias here and force anti aliasing when using MSA A. Otherwise,
29 // we can wind up with external edges antialiased and internal edges una ntialiased.
30 aaMode = GrDashingEffect::AAMode::kCoverageWithMSAA; 34 aaMode = GrDashingEffect::AAMode::kCoverageWithMSAA;
31 } else if (args.fAntiAlias) { 35 } else if (args.fAntiAlias) {
32 aaMode = GrDashingEffect::AAMode::kCoverage; 36 aaMode = GrDashingEffect::AAMode::kCoverage;
33 } else { 37 } else {
34 aaMode = GrDashingEffect::AAMode::kNone; 38 aaMode = GrDashingEffect::AAMode::kNone;
35 } 39 }
36 SkPoint pts[2]; 40 SkPoint pts[2];
37 SkAssertResult(args.fPath->isLine(pts)); 41 SkAssertResult(args.fPath->isLine(pts));
38 SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fC olor, 42 SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fC olor,
39 *args.f ViewMatrix, 43 *args.f ViewMatrix,
40 pts, 44 pts,
41 aaMode, 45 aaMode,
42 *args.f Style)); 46 *args.f Style));
43 if (!batch) { 47 if (!batch) {
44 return false; 48 return false;
45 } 49 }
46 50
47 GrPipelineBuilder pipelineBuilder(*args.fPaint, msaaIsEnabled); 51 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnified Multisampled());
52 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, useHWAA);
48 pipelineBuilder.setUserStencil(args.fUserStencilSettings); 53 pipelineBuilder.setUserStencil(args.fUserStencilSettings);
49 54
50 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); 55 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
51 return true; 56 return true;
52 } 57 }
OLDNEW
« include/gpu/GrDrawContext.h ('K') | « src/gpu/GrCaps.cpp ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698