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

Side by Side Diff: src/gpu/GrDrawContext.cpp

Issue 2123693002: Revert of Begin instanced rendering for simple shapes (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
« no previous file with comments | « include/private/GrInstancedPipelineInfo.h ('k') | src/gpu/GrDrawContextPriv.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "GrBatchTest.h" 8 #include "GrBatchTest.h"
9 #include "GrColor.h" 9 #include "GrColor.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
11 #include "GrDrawContextPriv.h" 11 #include "GrDrawContextPriv.h"
12 #include "GrDrawingManager.h" 12 #include "GrDrawingManager.h"
13 #include "GrOvalRenderer.h" 13 #include "GrOvalRenderer.h"
14 #include "GrPathRenderer.h" 14 #include "GrPathRenderer.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 #include "GrRenderTargetPriv.h" 16 #include "GrRenderTargetPriv.h"
17 #include "GrResourceProvider.h" 17 #include "GrResourceProvider.h"
18 #include "SkSurfacePriv.h" 18 #include "SkSurfacePriv.h"
19 19
20 #include "batches/GrBatch.h" 20 #include "batches/GrBatch.h"
21 #include "batches/GrDrawAtlasBatch.h" 21 #include "batches/GrDrawAtlasBatch.h"
22 #include "batches/GrDrawVerticesBatch.h" 22 #include "batches/GrDrawVerticesBatch.h"
23 #include "batches/GrRectBatchFactory.h" 23 #include "batches/GrRectBatchFactory.h"
24 #include "batches/GrNinePatch.h" // TODO Factory 24 #include "batches/GrNinePatch.h" // TODO Factory
25 25
26 #include "effects/GrRRectEffect.h" 26 #include "effects/GrRRectEffect.h"
27 27
28 #include "instanced/InstancedRendering.h"
29
30 #include "text/GrAtlasTextContext.h" 28 #include "text/GrAtlasTextContext.h"
31 #include "text/GrStencilAndCoverTextContext.h" 29 #include "text/GrStencilAndCoverTextContext.h"
32 30
33 #include "../private/GrAuditTrail.h" 31 #include "../private/GrAuditTrail.h"
34 32
35 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM anager->getContext()) 33 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM anager->getContext())
36 #define ASSERT_SINGLE_OWNER \ 34 #define ASSERT_SINGLE_OWNER \
37 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) 35 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
38 #define ASSERT_SINGLE_OWNER_PRIV \ 36 #define ASSERT_SINGLE_OWNER_PRIV \
39 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing leOwner);) 37 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing leOwner);)
40 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return ; } 38 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return ; }
41 #define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandon ed()) { return; } 39 #define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandon ed()) { return; }
42 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; } 40 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; }
43 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb andoned()) { return false; } 41 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb andoned()) { return false; }
44 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; } 42 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; }
45 43
46 using gr_instanced::InstancedRendering;
47
48 class AutoCheckFlush { 44 class AutoCheckFlush {
49 public: 45 public:
50 AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingMa nager) { 46 AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingMa nager) {
51 SkASSERT(fDrawingManager); 47 SkASSERT(fDrawingManager);
52 } 48 }
53 ~AutoCheckFlush() { fDrawingManager->getContext()->flushIfNecessary(); } 49 ~AutoCheckFlush() { fDrawingManager->getContext()->flushIfNecessary(); }
54 50
55 private: 51 private:
56 GrDrawingManager* fDrawingManager; 52 GrDrawingManager* fDrawingManager;
57 }; 53 };
58 54
59 bool GrDrawContext::wasAbandoned() const { 55 bool GrDrawContext::wasAbandoned() const {
60 return fDrawingManager->wasAbandoned(); 56 return fDrawingManager->wasAbandoned();
61 } 57 }
62 58
63 // In MDB mode the reffing of the 'getLastDrawTarget' call's result allows in-pr ogress 59 // In MDB mode the reffing of the 'getLastDrawTarget' call's result allows in-pr ogress
64 // drawTargets to be picked up and added to by drawContexts lower in the call 60 // drawTargets to be picked up and added to by drawContexts lower in the call
65 // stack. When this occurs with a closed drawTarget, a new one will be allocated 61 // stack. When this occurs with a closed drawTarget, a new one will be allocated
66 // when the drawContext attempts to use it (via getDrawTarget). 62 // when the drawContext attempts to use it (via getDrawTarget).
67 GrDrawContext::GrDrawContext(GrContext* context, 63 GrDrawContext::GrDrawContext(GrContext* context,
68 GrDrawingManager* drawingMgr, 64 GrDrawingManager* drawingMgr,
69 sk_sp<GrRenderTarget> rt, 65 sk_sp<GrRenderTarget> rt,
70 const SkSurfaceProps* surfaceProps, 66 const SkSurfaceProps* surfaceProps,
71 GrAuditTrail* auditTrail, 67 GrAuditTrail* auditTrail,
72 GrSingleOwner* singleOwner) 68 GrSingleOwner* singleOwner)
73 : fDrawingManager(drawingMgr) 69 : fDrawingManager(drawingMgr)
74 , fRenderTarget(std::move(rt)) 70 , fRenderTarget(std::move(rt))
75 , fDrawTarget(SkSafeRef(fRenderTarget->getLastDrawTarget())) 71 , fDrawTarget(SkSafeRef(fRenderTarget->getLastDrawTarget()))
76 , fContext(context) 72 , fContext(context)
77 , fInstancedPipelineInfo(fRenderTarget.get())
78 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) 73 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
79 , fAuditTrail(auditTrail) 74 , fAuditTrail(auditTrail)
80 #ifdef SK_DEBUG 75 #ifdef SK_DEBUG
81 , fSingleOwner(singleOwner) 76 , fSingleOwner(singleOwner)
82 #endif 77 #endif
83 { 78 {
84 SkDEBUGCODE(this->validate();) 79 SkDEBUGCODE(this->validate();)
85 } 80 }
86 81
87 #ifdef SK_DEBUG 82 #ifdef SK_DEBUG
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 *useHWAA = rt->isUnifiedMultisampled(); 266 *useHWAA = rt->isUnifiedMultisampled();
272 } 267 }
273 return !rt->isUnifiedMultisampled(); 268 return !rt->isUnifiedMultisampled();
274 } 269 }
275 } 270 }
276 271
277 GrDrawBatch* GrDrawContext::getFillRectBatch(const GrPaint& paint, 272 GrDrawBatch* GrDrawContext::getFillRectBatch(const GrPaint& paint,
278 const SkMatrix& viewMatrix, 273 const SkMatrix& viewMatrix,
279 const SkRect& rect, 274 const SkRect& rect,
280 bool* useHWAA) { 275 bool* useHWAA) {
281 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
282 if (GrDrawBatch* batch = ir->recordRect(rect, viewMatrix, paint.getColor (),
283 paint.isAntiAlias(), fInstancedP ipelineInfo,
284 useHWAA)) {
285 return batch;
286 }
287 }
288 276
277 GrDrawBatch* batch = nullptr;
289 if (should_apply_coverage_aa(paint, fRenderTarget.get(), useHWAA)) { 278 if (should_apply_coverage_aa(paint, fRenderTarget.get(), useHWAA)) {
290 // The fill path can handle rotation but not skew. 279 // The fill path can handle rotation but not skew.
291 if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) { 280 if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
292 SkRect devBoundRect; 281 SkRect devBoundRect;
293 viewMatrix.mapRect(&devBoundRect, rect); 282 viewMatrix.mapRect(&devBoundRect, rect);
294 return GrRectBatchFactory::CreateAAFill(paint.getColor(), viewMatrix , 283 batch = GrRectBatchFactory::CreateAAFill(paint.getColor(), viewMatri x,
295 rect, devBoundRect); 284 rect, devBoundRect);
296 } 285 }
297 } else { 286 } else {
298 // filled BW rect 287 // filled BW rect
299 return GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rect, 288 batch = GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix , rect,
300 nullptr, nullptr); 289 nullptr, nullptr);
301 } 290 }
302 291
303 return nullptr; 292 return batch;
304 } 293 }
305 294
306 void GrDrawContext::drawRect(const GrClip& clip, 295 void GrDrawContext::drawRect(const GrClip& clip,
307 const GrPaint& paint, 296 const GrPaint& paint,
308 const SkMatrix& viewMatrix, 297 const SkMatrix& viewMatrix,
309 const SkRect& rect, 298 const SkRect& rect,
310 const GrStyle* style) { 299 const GrStyle* style) {
311 if (!style) { 300 if (!style) {
312 style = &GrStyle::SimpleFill(); 301 style = &GrStyle::SimpleFill();
313 } 302 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 const GrPaint& paint, 472 const GrPaint& paint,
484 const SkMatrix& viewMatrix, 473 const SkMatrix& viewMatrix,
485 const SkRect& rectToDraw, 474 const SkRect& rectToDraw,
486 const SkRect& localRect) { 475 const SkRect& localRect) {
487 ASSERT_SINGLE_OWNER 476 ASSERT_SINGLE_OWNER
488 RETURN_IF_ABANDONED 477 RETURN_IF_ABANDONED
489 SkDEBUGCODE(this->validate();) 478 SkDEBUGCODE(this->validate();)
490 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectToRect"); 479 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectToRect");
491 480
492 AutoCheckFlush acf(fDrawingManager); 481 AutoCheckFlush acf(fDrawingManager);
482
483 bool useHWAA;
493 SkAutoTUnref<GrDrawBatch> batch; 484 SkAutoTUnref<GrDrawBatch> batch;
494 bool useHWAA;
495
496 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
497 batch.reset(ir->recordRect(rectToDraw, viewMatrix, paint.getColor(), loc alRect,
498 paint.isAntiAlias(), fInstancedPipelineInfo, &useHWAA));
499 if (batch) {
500 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
501 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
502 return;
503 }
504 }
505
506 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) && 485 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) &&
507 view_matrix_ok_for_aa_fill_rect(viewMatrix)) { 486 view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
508 batch.reset(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), vie wMatrix, rectToDraw, 487 batch.reset(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), vie wMatrix, rectToDraw,
509 localRect)); 488 localRect));
510 } else { 489 } else {
511 batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMa trix, rectToDraw, 490 batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMa trix, rectToDraw,
512 &localRect, nullptr)); 491 &localRect, nullptr));
513 } 492 }
514 493
515 if (batch) { 494 if (batch) {
516 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 495 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
517 this->drawBatch(pipelineBuilder, clip, batch); 496 this->drawBatch(pipelineBuilder, clip, batch);
518 } 497 }
519 } 498 }
520 499
521 void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip, 500 void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
522 const GrPaint& paint, 501 const GrPaint& paint,
523 const SkMatrix& viewMatrix, 502 const SkMatrix& viewMatrix,
524 const SkRect& rectToDraw, 503 const SkRect& rectToDraw,
525 const SkMatrix& localMatrix) { 504 const SkMatrix& localMatrix) {
526 ASSERT_SINGLE_OWNER 505 ASSERT_SINGLE_OWNER
527 RETURN_IF_ABANDONED 506 RETURN_IF_ABANDONED
528 SkDEBUGCODE(this->validate();) 507 SkDEBUGCODE(this->validate();)
529 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatr ix"); 508 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatr ix");
530 509
531 AutoCheckFlush acf(fDrawingManager); 510 AutoCheckFlush acf(fDrawingManager);
511
512 bool useHWAA;
532 SkAutoTUnref<GrDrawBatch> batch; 513 SkAutoTUnref<GrDrawBatch> batch;
533 bool useHWAA;
534
535 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
536 batch.reset(ir->recordRect(rectToDraw, viewMatrix, paint.getColor(), loc alMatrix,
537 paint.isAntiAlias(), fInstancedPipelineInfo, &useHWAA));
538 if (batch) {
539 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
540 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
541 return;
542 }
543 }
544
545 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) && 514 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) &&
546 view_matrix_ok_for_aa_fill_rect(viewMatrix)) { 515 view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
547 batch.reset(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, loca lMatrix, 516 batch.reset(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, loca lMatrix,
548 rectToDraw)); 517 rectToDraw));
549 } else { 518 } else {
550 batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMa trix, rectToDraw, 519 batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMa trix, rectToDraw,
551 nullptr, &localMatrix)); 520 nullptr, &localMatrix));
552 } 521 }
553 522
554 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 523 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 ASSERT_SINGLE_OWNER 600 ASSERT_SINGLE_OWNER
632 RETURN_IF_ABANDONED 601 RETURN_IF_ABANDONED
633 SkDEBUGCODE(this->validate();) 602 SkDEBUGCODE(this->validate();)
634 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRRect"); 603 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRRect");
635 604
636 if (rrect.isEmpty()) { 605 if (rrect.isEmpty()) {
637 return; 606 return;
638 } 607 }
639 608
640 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice 609 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice
610 const SkStrokeRec stroke = style.strokeRec();
611 AutoCheckFlush acf(fDrawingManager);
641 612
642 AutoCheckFlush acf(fDrawingManager);
643 const SkStrokeRec stroke = style.strokeRec();
644 bool useHWAA; 613 bool useHWAA;
645
646 if (this->getDrawTarget()->instancedRendering() && stroke.isFillStyle()) {
647 InstancedRendering* ir = this->getDrawTarget()->instancedRendering();
648 SkAutoTUnref<GrDrawBatch> batch(ir->recordRRect(rrect, viewMatrix, paint .getColor(),
649 paint.isAntiAlias(), fIn stancedPipelineInfo,
650 &useHWAA));
651 if (batch) {
652 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
653 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
654 return;
655 }
656 }
657
658 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { 614 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) {
659 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); 615 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
616
660 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateRRectBatch(paint.g etColor(), 617 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateRRectBatch(paint.g etColor(),
661 viewMat rix, 618 viewMat rix,
662 rrect, 619 rrect,
663 stroke, 620 stroke,
664 shaderC aps)); 621 shaderC aps));
665 if (batch) { 622 if (batch) {
666 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 623 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
667 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ; 624 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
668 return; 625 return;
669 } 626 }
670 } 627 }
671 628
672 SkPath path; 629 SkPath path;
673 path.setIsVolatile(true); 630 path.setIsVolatile(true);
674 path.addRRect(rrect); 631 path.addRRect(rrect);
675 this->internalDrawPath(clip, paint, viewMatrix, path, style); 632 this->internalDrawPath(clip, paint, viewMatrix, path, style);
676 } 633 }
677 634
678 bool GrDrawContext::drawFilledDRRect(const GrClip& clip, 635 bool GrDrawContext::drawFilledDRRect(const GrClip& clip,
679 const GrPaint& paintIn, 636 const GrPaint& paintIn,
680 const SkMatrix& viewMatrix, 637 const SkMatrix& viewMatrix,
681 const SkRRect& origOuter, 638 const SkRRect& origOuter,
682 const SkRRect& origInner) { 639 const SkRRect& origInner) {
683 SkASSERT(!origInner.isEmpty()); 640 SkASSERT(!origInner.isEmpty());
684 SkASSERT(!origOuter.isEmpty()); 641 SkASSERT(!origOuter.isEmpty());
685 642
686 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
687 bool useHWAA;
688 SkAutoTUnref<GrDrawBatch> batch(ir->recordDRRect(origOuter, origInner, v iewMatrix,
689 paintIn.getColor(), pai ntIn.isAntiAlias(),
690 fInstancedPipelineInfo, &useHWAA));
691 if (batch) {
692 GrPipelineBuilder pipelineBuilder(paintIn, useHWAA);
693 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
694 return true;
695 }
696 }
697
698 bool applyAA = paintIn.isAntiAlias() && !fRenderTarget->isUnifiedMultisample d(); 643 bool applyAA = paintIn.isAntiAlias() && !fRenderTarget->isUnifiedMultisample d();
699 644
700 GrPrimitiveEdgeType innerEdgeType = applyAA ? kInverseFillAA_GrProcessorEdge Type : 645 GrPrimitiveEdgeType innerEdgeType = applyAA ? kInverseFillAA_GrProcessorEdge Type :
701 kInverseFillBW_GrProcessorEdge Type; 646 kInverseFillBW_GrProcessorEdge Type;
702 GrPrimitiveEdgeType outerEdgeType = applyAA ? kFillAA_GrProcessorEdgeType : 647 GrPrimitiveEdgeType outerEdgeType = applyAA ? kFillAA_GrProcessorEdgeType :
703 kFillBW_GrProcessorEdgeType; 648 kFillBW_GrProcessorEdgeType;
704 649
705 SkTCopyOnFirstWrite<SkRRect> inner(origInner), outer(origOuter); 650 SkTCopyOnFirstWrite<SkRRect> inner(origInner), outer(origOuter);
706 SkMatrix inverseVM; 651 SkMatrix inverseVM;
707 if (!viewMatrix.isIdentity()) { 652 if (!viewMatrix.isIdentity()) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 731
787 if (oval.isEmpty()) { 732 if (oval.isEmpty()) {
788 return; 733 return;
789 } 734 }
790 735
791 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice 736 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice
792 737
793 AutoCheckFlush acf(fDrawingManager); 738 AutoCheckFlush acf(fDrawingManager);
794 const SkStrokeRec& stroke = style.strokeRec(); 739 const SkStrokeRec& stroke = style.strokeRec();
795 bool useHWAA; 740 bool useHWAA;
796
797 if (this->getDrawTarget()->instancedRendering() && stroke.isFillStyle()) {
798 InstancedRendering* ir = this->getDrawTarget()->instancedRendering();
799 SkAutoTUnref<GrDrawBatch> batch(ir->recordOval(oval, viewMatrix, paint.g etColor(),
800 paint.isAntiAlias(), fIns tancedPipelineInfo,
801 &useHWAA));
802 if (batch) {
803 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
804 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
805 return;
806 }
807 }
808
809 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) { 741 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) {
810 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); 742 GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
811 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.ge tColor(), 743 SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.ge tColor(),
812 viewMatr ix, 744 viewMatr ix,
813 oval, 745 oval,
814 stroke, 746 stroke,
815 shaderCa ps)); 747 shaderCa ps));
816 if (batch) { 748 if (batch) {
817 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 749 GrPipelineBuilder pipelineBuilder(paint, useHWAA);
818 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ; 750 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 1029
1098 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, 1030 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip,
1099 GrDrawBatch* batch) { 1031 GrDrawBatch* batch) {
1100 ASSERT_SINGLE_OWNER 1032 ASSERT_SINGLE_OWNER
1101 RETURN_IF_ABANDONED 1033 RETURN_IF_ABANDONED
1102 SkDEBUGCODE(this->validate();) 1034 SkDEBUGCODE(this->validate();)
1103 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 1035 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
1104 1036
1105 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); 1037 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
1106 } 1038 }
OLDNEW
« no previous file with comments | « include/private/GrInstancedPipelineInfo.h ('k') | src/gpu/GrDrawContextPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698