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

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

Issue 2175573004: Revert of Retract PipelineBuilder some more (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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 "GrAuditTrail.h" 10 #include "GrAuditTrail.h"
11 #include "GrGpu.h" 11 #include "GrGpu.h"
12 #include "GrPipelineBuilder.h"
12 #include "effects/GrDashingEffect.h" 13 #include "effects/GrDashingEffect.h"
13 14
14 bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { 15 bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
15 SkPoint pts[2]; 16 SkPoint pts[2];
16 bool inverted; 17 bool inverted;
17 if (args.fShape->style().isDashed() && args.fShape->asLine(pts, &inverted)) { 18 if (args.fShape->style().isDashed() && args.fShape->asLine(pts, &inverted)) {
18 // We should never have an inverse dashed case. 19 // We should never have an inverse dashed case.
19 SkASSERT(!inverted); 20 SkASSERT(!inverted);
20 return GrDashingEffect::CanDrawDashLine(pts, args.fShape->style(), *args .fViewMatrix); 21 return GrDashingEffect::CanDrawDashLine(pts, args.fShape->style(), *args .fViewMatrix);
21 } 22 }
22 return false; 23 return false;
23 } 24 }
24 25
25 bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) { 26 bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
26 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), 27 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
27 "GrDashLinePathRenderer::onDrawPath"); 28 "GrDashLinePathRenderer::onDrawPath");
28
29 SkTCopyOnFirstWrite<GrPaint> paint(*args.fPaint);
30
31 bool useHWAA = args.fDrawContext->isUnifiedMultisampled(); 29 bool useHWAA = args.fDrawContext->isUnifiedMultisampled();
32 GrDashingEffect::AAMode aaMode; 30 GrDashingEffect::AAMode aaMode;
33 if (useHWAA) { 31 if (useHWAA) {
34 if (!paint->isAntiAlias()) {
35 paint.writable()->setAntiAlias(true);
36 }
37 // We ignore args.fAntiAlias here and force anti aliasing when using MSA A. Otherwise, 32 // We ignore args.fAntiAlias here and force anti aliasing when using MSA A. Otherwise,
38 // we can wind up with external edges antialiased and internal edges una ntialiased. 33 // we can wind up with external edges antialiased and internal edges una ntialiased.
39 aaMode = GrDashingEffect::AAMode::kCoverageWithMSAA; 34 aaMode = GrDashingEffect::AAMode::kCoverageWithMSAA;
40 } else if (args.fAntiAlias) { 35 } else if (args.fAntiAlias) {
41 aaMode = GrDashingEffect::AAMode::kCoverage; 36 aaMode = GrDashingEffect::AAMode::kCoverage;
42 } else { 37 } else {
43 aaMode = GrDashingEffect::AAMode::kNone; 38 aaMode = GrDashingEffect::AAMode::kNone;
44 } 39 }
45 SkPoint pts[2]; 40 SkPoint pts[2];
46 SkAssertResult(args.fShape->asLine(pts, nullptr)); 41 SkAssertResult(args.fShape->asLine(pts, nullptr));
47 SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fP aint->getColor(), 42 SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fP aint->getColor(),
48 *args.f ViewMatrix, 43 *args.f ViewMatrix,
49 pts, 44 pts,
50 aaMode, 45 aaMode,
51 args.fS hape->style())); 46 args.fS hape->style()));
52 if (!batch) { 47 if (!batch) {
53 return false; 48 return false;
54 } 49 }
55 50
56 SkASSERT(args.fDrawContext->mustUseHWAA(*paint) == useHWAA); 51 GrPipelineBuilder pipelineBuilder(*args.fPaint, useHWAA);
57 args.fDrawContext->drawBatch(*paint, *args.fClip, *args.fUserStencilSettings , batch); 52 pipelineBuilder.setUserStencil(args.fUserStencilSettings);
53
54 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
58 return true; 55 return true;
59 } 56 }
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp ('k') | src/gpu/batches/GrDefaultPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698