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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 const SkRect& rect) { | 413 const SkRect& rect) { |
414 ASSERT_SINGLE_OWNER_PRIV | 414 ASSERT_SINGLE_OWNER_PRIV |
415 RETURN_IF_ABANDONED_PRIV | 415 RETURN_IF_ABANDONED_PRIV |
416 SkDEBUGCODE(fDrawContext->validate();) | 416 SkDEBUGCODE(fDrawContext->validate();) |
417 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::stencil
Rect"); | 417 GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::stencil
Rect"); |
418 | 418 |
419 AutoCheckFlush acf(fDrawContext->fDrawingManager); | 419 AutoCheckFlush acf(fDrawContext->fDrawingManager); |
420 | 420 |
421 GrPaint paint; | 421 GrPaint paint; |
422 paint.setAntiAlias(doAA); | 422 paint.setAntiAlias(doAA); |
423 SkSafeUnref(paint.setXPFactory(GrDisableColorXPFactory::Create())); | 423 paint.setXPFactory(GrDisableColorXPFactory::Make()); |
424 | 424 |
425 bool useHWAA; | 425 bool useHWAA; |
426 SkAutoTUnref<GrDrawBatch> batch( | 426 SkAutoTUnref<GrDrawBatch> batch( |
427 fDrawContext->getFillRectBatch(paint, viewMatrix, rect, &useHWAA)); | 427 fDrawContext->getFillRectBatch(paint, viewMatrix, rect, &useHWAA)); |
428 SkASSERT(batch); | 428 SkASSERT(batch); |
429 | 429 |
430 GrPipelineBuilder pipelineBuilder(paint, useHWAA); | 430 GrPipelineBuilder pipelineBuilder(paint, useHWAA); |
431 pipelineBuilder.setUserStencil(ss); | 431 pipelineBuilder.setUserStencil(ss); |
432 | 432 |
433 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext, clip
, batch); | 433 fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, fDrawContext, clip
, batch); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 return false; | 664 return false; |
665 } | 665 } |
666 } else { | 666 } else { |
667 inverseVM.reset(); | 667 inverseVM.reset(); |
668 } | 668 } |
669 | 669 |
670 GrPaint grPaint(paintIn); | 670 GrPaint grPaint(paintIn); |
671 grPaint.setAntiAlias(false); | 671 grPaint.setAntiAlias(false); |
672 | 672 |
673 // TODO these need to be a geometry processors | 673 // TODO these need to be a geometry processors |
674 SkAutoTUnref<GrFragmentProcessor> innerEffect(GrRRectEffect::Create(innerEdg
eType, *inner)); | 674 sk_sp<GrFragmentProcessor> innerEffect(GrRRectEffect::Make(innerEdgeType, *i
nner)); |
675 if (!innerEffect) { | 675 if (!innerEffect) { |
676 return false; | 676 return false; |
677 } | 677 } |
678 | 678 |
679 SkAutoTUnref<GrFragmentProcessor> outerEffect(GrRRectEffect::Create(outerEdg
eType, *outer)); | 679 sk_sp<GrFragmentProcessor> outerEffect(GrRRectEffect::Make(outerEdgeType, *o
uter)); |
680 if (!outerEffect) { | 680 if (!outerEffect) { |
681 return false; | 681 return false; |
682 } | 682 } |
683 | 683 |
684 grPaint.addCoverageFragmentProcessor(innerEffect); | 684 grPaint.addCoverageFragmentProcessor(std::move(innerEffect)); |
685 grPaint.addCoverageFragmentProcessor(outerEffect); | 685 grPaint.addCoverageFragmentProcessor(std::move(outerEffect)); |
686 | 686 |
687 SkRect bounds = outer->getBounds(); | 687 SkRect bounds = outer->getBounds(); |
688 if (applyAA) { | 688 if (applyAA) { |
689 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); | 689 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
690 } | 690 } |
691 | 691 |
692 this->fillRectWithLocalMatrix(clip, grPaint, SkMatrix::I(), bounds, inverseV
M); | 692 this->fillRectWithLocalMatrix(clip, grPaint, SkMatrix::I(), bounds, inverseV
M); |
693 return true; | 693 return true; |
694 } | 694 } |
695 | 695 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 | 1064 |
1065 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1065 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
1066 GrDrawBatch* batch) { | 1066 GrDrawBatch* batch) { |
1067 ASSERT_SINGLE_OWNER | 1067 ASSERT_SINGLE_OWNER |
1068 RETURN_IF_ABANDONED | 1068 RETURN_IF_ABANDONED |
1069 SkDEBUGCODE(this->validate();) | 1069 SkDEBUGCODE(this->validate();) |
1070 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1070 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
1071 | 1071 |
1072 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1072 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
1073 } | 1073 } |
OLD | NEW |