| 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 "GrBatchTest.h" | 8 #include "GrBatchTest.h" |
| 9 #include "GrColor.h" | 9 #include "GrColor.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 const SkRect& rect) { | 400 const SkRect& rect) { |
| 401 ASSERT_SINGLE_OWNER_PRIV | 401 ASSERT_SINGLE_OWNER_PRIV |
| 402 RETURN_IF_ABANDONED_PRIV | 402 RETURN_IF_ABANDONED_PRIV |
| 403 SkDEBUGCODE(fDrawContext->validate();) | 403 SkDEBUGCODE(fDrawContext->validate();) |
| 404 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::stencil
Rect"); | 404 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::stencil
Rect"); |
| 405 | 405 |
| 406 AutoCheckFlush acf(fDrawContext->fDrawingManager); | 406 AutoCheckFlush acf(fDrawContext->fDrawingManager); |
| 407 | 407 |
| 408 GrPaint paint; | 408 GrPaint paint; |
| 409 paint.setAntiAlias(doAA); | 409 paint.setAntiAlias(doAA); |
| 410 SkSafeUnref(paint.setXPFactory(GrDisableColorXPFactory::Create())); | 410 paint.setXPFactory(GrDisableColorXPFactory::Create()); |
| 411 | 411 |
| 412 SkAutoTUnref<GrDrawBatch> batch(fDrawContext->getFillRectBatch(paint, viewMa
trix, rect)); | 412 SkAutoTUnref<GrDrawBatch> batch(fDrawContext->getFillRectBatch(paint, viewMa
trix, rect)); |
| 413 SkASSERT(batch); | 413 SkASSERT(batch); |
| 414 | 414 |
| 415 GrPipelineBuilder pipelineBuilder(paint, fDrawContext->isUnifiedMultisampled
()); | 415 GrPipelineBuilder pipelineBuilder(paint, fDrawContext->isUnifiedMultisampled
()); |
| 416 pipelineBuilder.setUserStencil(ss); | 416 pipelineBuilder.setUserStencil(ss); |
| 417 | 417 |
| 418 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext, clip
, batch); | 418 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext, clip
, batch); |
| 419 } | 419 } |
| 420 | 420 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 return false; | 644 return false; |
| 645 } | 645 } |
| 646 } else { | 646 } else { |
| 647 inverseVM.reset(); | 647 inverseVM.reset(); |
| 648 } | 648 } |
| 649 | 649 |
| 650 GrPaint grPaint(paintIn); | 650 GrPaint grPaint(paintIn); |
| 651 grPaint.setAntiAlias(false); | 651 grPaint.setAntiAlias(false); |
| 652 | 652 |
| 653 // TODO these need to be a geometry processors | 653 // TODO these need to be a geometry processors |
| 654 SkAutoTUnref<GrFragmentProcessor> innerEffect(GrRRectEffect::Create(innerEdg
eType, *inner)); | 654 sk_sp<GrFragmentProcessor> innerEffect(GrRRectEffect::Make(innerEdgeType, *i
nner)); |
| 655 if (!innerEffect) { | 655 if (!innerEffect) { |
| 656 return false; | 656 return false; |
| 657 } | 657 } |
| 658 | 658 |
| 659 SkAutoTUnref<GrFragmentProcessor> outerEffect(GrRRectEffect::Create(outerEdg
eType, *outer)); | 659 sk_sp<GrFragmentProcessor> outerEffect(GrRRectEffect::Make(outerEdgeType, *o
uter)); |
| 660 if (!outerEffect) { | 660 if (!outerEffect) { |
| 661 return false; | 661 return false; |
| 662 } | 662 } |
| 663 | 663 |
| 664 grPaint.addCoverageFragmentProcessor(innerEffect); | 664 grPaint.addCoverageFragmentProcessor(std::move(innerEffect)); |
| 665 grPaint.addCoverageFragmentProcessor(outerEffect); | 665 grPaint.addCoverageFragmentProcessor(std::move(outerEffect)); |
| 666 | 666 |
| 667 SkRect bounds = outer->getBounds(); | 667 SkRect bounds = outer->getBounds(); |
| 668 if (applyAA) { | 668 if (applyAA) { |
| 669 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); | 669 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
| 670 } | 670 } |
| 671 | 671 |
| 672 this->fillRectWithLocalMatrix(clip, grPaint, SkMatrix::I(), bounds, inverseV
M); | 672 this->fillRectWithLocalMatrix(clip, grPaint, SkMatrix::I(), bounds, inverseV
M); |
| 673 return true; | 673 return true; |
| 674 } | 674 } |
| 675 | 675 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 | 1055 |
| 1056 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1056 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
| 1057 GrDrawBatch* batch) { | 1057 GrDrawBatch* batch) { |
| 1058 ASSERT_SINGLE_OWNER | 1058 ASSERT_SINGLE_OWNER |
| 1059 RETURN_IF_ABANDONED | 1059 RETURN_IF_ABANDONED |
| 1060 SkDEBUGCODE(this->validate();) | 1060 SkDEBUGCODE(this->validate();) |
| 1061 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1061 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
| 1062 | 1062 |
| 1063 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1063 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
| 1064 } | 1064 } |
| OLD | NEW |