| OLD | NEW |
| 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 "effects/GrDashingEffect.h" | 12 #include "effects/GrDashingEffect.h" |
| 12 | 13 |
| 13 bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { | 14 bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
| 14 SkPoint pts[2]; | 15 SkPoint pts[2]; |
| 15 if (args.fStyle->isDashed() && args.fPath->isLine(pts)) { | 16 if (args.fStyle->isDashed() && args.fPath->isLine(pts)) { |
| 16 return GrDashingEffect::CanDrawDashLine(pts, *args.fStyle, *args.fViewMa
trix); | 17 return GrDashingEffect::CanDrawDashLine(pts, *args.fStyle, *args.fViewMa
trix); |
| 17 } | 18 } |
| 18 return false; | 19 return false; |
| 19 } | 20 } |
| 20 | 21 |
| 21 bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) { | 22 bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) { |
| 22 GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(), "GrDashLinePathRend
erer::onDrawPath"); | 23 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
| 23 bool msaaIsEnabled = args.fPipelineBuilder->getRenderTarget()->isUnifiedMult
isampled(); | 24 "GrDashLinePathRenderer::onDrawPath"); |
| 25 bool msaaIsEnabled = args.fDrawContext->isUnifiedMultisampled(); |
| 24 SkPoint pts[2]; | 26 SkPoint pts[2]; |
| 25 SkAssertResult(args.fPath->isLine(pts)); | 27 SkAssertResult(args.fPath->isLine(pts)); |
| 26 SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fC
olor, | 28 SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fC
olor, |
| 27 *args.f
ViewMatrix, | 29 *args.f
ViewMatrix, |
| 28 pts, | 30 pts, |
| 29 args.fA
ntiAlias, | 31 args.fA
ntiAlias, |
| 30 msaaIsE
nabled, | 32 msaaIsE
nabled, |
| 31 *args.f
Style)); | 33 *args.f
Style)); |
| 32 if (!batch) { | 34 if (!batch) { |
| 33 return false; | 35 return false; |
| 34 } | 36 } |
| 35 | 37 |
| 36 args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch); | 38 GrPipelineBuilder pipelineBuilder(*args.fPaint, msaaIsEnabled); |
| 39 pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); |
| 40 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 41 |
| 42 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
| 37 return true; | 43 return true; |
| 38 } | 44 } |
| OLD | NEW |