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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 const SkRect& rect, | 361 const SkRect& rect, |
362 const GrUserStencilSettings* ss) { | 362 const GrUserStencilSettings* ss) { |
363 SkRect croppedRect = rect; | 363 SkRect croppedRect = rect; |
364 if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect))
{ | 364 if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect))
{ |
365 return true; | 365 return true; |
366 } | 366 } |
367 | 367 |
368 SkAutoTUnref<GrDrawBatch> batch; | 368 SkAutoTUnref<GrDrawBatch> batch; |
369 bool useHWAA; | 369 bool useHWAA; |
370 | 370 |
371 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) { | 371 if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport())
{ |
| 372 InstancedRendering* ir = this->getDrawTarget()->instancedRendering(); |
372 batch.reset(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), | 373 batch.reset(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), |
373 paint.isAntiAlias(), fInstancedPipelineInfo, | 374 paint.isAntiAlias(), fInstancedPipelineInfo, |
374 &useHWAA)); | 375 &useHWAA)); |
375 if (batch) { | 376 if (batch) { |
376 GrPipelineBuilder pipelineBuilder(paint, useHWAA); | 377 GrPipelineBuilder pipelineBuilder(paint, useHWAA); |
377 if (ss) { | 378 if (ss) { |
378 pipelineBuilder.setUserStencil(ss); | 379 pipelineBuilder.setUserStencil(ss); |
379 } | 380 } |
380 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; | 381 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; |
381 return true; | 382 return true; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 | 612 |
612 SkRect croppedRect = rectToDraw; | 613 SkRect croppedRect = rectToDraw; |
613 SkRect croppedLocalRect = localRect; | 614 SkRect croppedLocalRect = localRect; |
614 if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect, &
croppedLocalRect)) { | 615 if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect, &
croppedLocalRect)) { |
615 return; | 616 return; |
616 } | 617 } |
617 | 618 |
618 AutoCheckFlush acf(fDrawingManager); | 619 AutoCheckFlush acf(fDrawingManager); |
619 bool useHWAA; | 620 bool useHWAA; |
620 | 621 |
621 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) { | 622 if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport())
{ |
| 623 InstancedRendering* ir = this->getDrawTarget()->instancedRendering(); |
622 SkAutoTUnref<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix,
paint.getColor(), | 624 SkAutoTUnref<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix,
paint.getColor(), |
623 croppedLocalRect, paint.i
sAntiAlias(), | 625 croppedLocalRect, paint.i
sAntiAlias(), |
624 fInstancedPipelineInfo, &
useHWAA)); | 626 fInstancedPipelineInfo, &
useHWAA)); |
625 if (batch) { | 627 if (batch) { |
626 GrPipelineBuilder pipelineBuilder(paint, useHWAA); | 628 GrPipelineBuilder pipelineBuilder(paint, useHWAA); |
627 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; | 629 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; |
628 return; | 630 return; |
629 } | 631 } |
630 } | 632 } |
631 | 633 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatr
ix"); | 671 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatr
ix"); |
670 | 672 |
671 SkRect croppedRect = rectToDraw; | 673 SkRect croppedRect = rectToDraw; |
672 if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect))
{ | 674 if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect))
{ |
673 return; | 675 return; |
674 } | 676 } |
675 | 677 |
676 AutoCheckFlush acf(fDrawingManager); | 678 AutoCheckFlush acf(fDrawingManager); |
677 bool useHWAA; | 679 bool useHWAA; |
678 | 680 |
679 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) { | 681 if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport())
{ |
| 682 InstancedRendering* ir = this->getDrawTarget()->instancedRendering(); |
680 SkAutoTUnref<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix,
paint.getColor(), | 683 SkAutoTUnref<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix,
paint.getColor(), |
681 localMatrix, paint.isAnti
Alias(), | 684 localMatrix, paint.isAnti
Alias(), |
682 fInstancedPipelineInfo, &
useHWAA)); | 685 fInstancedPipelineInfo, &
useHWAA)); |
683 if (batch) { | 686 if (batch) { |
684 GrPipelineBuilder pipelineBuilder(paint, useHWAA); | 687 GrPipelineBuilder pipelineBuilder(paint, useHWAA); |
685 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; | 688 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; |
686 return; | 689 return; |
687 } | 690 } |
688 } | 691 } |
689 | 692 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 if (rrect.isEmpty()) { | 799 if (rrect.isEmpty()) { |
797 return; | 800 return; |
798 } | 801 } |
799 | 802 |
800 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in
SkGpuDevice | 803 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in
SkGpuDevice |
801 | 804 |
802 AutoCheckFlush acf(fDrawingManager); | 805 AutoCheckFlush acf(fDrawingManager); |
803 const SkStrokeRec stroke = style.strokeRec(); | 806 const SkStrokeRec stroke = style.strokeRec(); |
804 bool useHWAA; | 807 bool useHWAA; |
805 | 808 |
806 if (this->getDrawTarget()->instancedRendering() && stroke.isFillStyle()) { | 809 if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()
&& |
| 810 stroke.isFillStyle()) { |
807 InstancedRendering* ir = this->getDrawTarget()->instancedRendering(); | 811 InstancedRendering* ir = this->getDrawTarget()->instancedRendering(); |
808 SkAutoTUnref<GrDrawBatch> batch(ir->recordRRect(rrect, viewMatrix, paint
.getColor(), | 812 SkAutoTUnref<GrDrawBatch> batch(ir->recordRRect(rrect, viewMatrix, paint
.getColor(), |
809 paint.isAntiAlias(), fIn
stancedPipelineInfo, | 813 paint.isAntiAlias(), fIn
stancedPipelineInfo, |
810 &useHWAA)); | 814 &useHWAA)); |
811 if (batch) { | 815 if (batch) { |
812 GrPipelineBuilder pipelineBuilder(paint, useHWAA); | 816 GrPipelineBuilder pipelineBuilder(paint, useHWAA); |
813 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; | 817 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; |
814 return; | 818 return; |
815 } | 819 } |
816 } | 820 } |
(...skipping 19 matching lines...) Expand all Loading... |
836 } | 840 } |
837 | 841 |
838 bool GrDrawContext::drawFilledDRRect(const GrClip& clip, | 842 bool GrDrawContext::drawFilledDRRect(const GrClip& clip, |
839 const GrPaint& paintIn, | 843 const GrPaint& paintIn, |
840 const SkMatrix& viewMatrix, | 844 const SkMatrix& viewMatrix, |
841 const SkRRect& origOuter, | 845 const SkRRect& origOuter, |
842 const SkRRect& origInner) { | 846 const SkRRect& origInner) { |
843 SkASSERT(!origInner.isEmpty()); | 847 SkASSERT(!origInner.isEmpty()); |
844 SkASSERT(!origOuter.isEmpty()); | 848 SkASSERT(!origOuter.isEmpty()); |
845 | 849 |
846 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) { | 850 if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport())
{ |
847 bool useHWAA; | 851 bool useHWAA; |
| 852 InstancedRendering* ir = this->getDrawTarget()->instancedRendering(); |
848 SkAutoTUnref<GrDrawBatch> batch(ir->recordDRRect(origOuter, origInner, v
iewMatrix, | 853 SkAutoTUnref<GrDrawBatch> batch(ir->recordDRRect(origOuter, origInner, v
iewMatrix, |
849 paintIn.getColor(), pai
ntIn.isAntiAlias(), | 854 paintIn.getColor(), pai
ntIn.isAntiAlias(), |
850 fInstancedPipelineInfo,
&useHWAA)); | 855 fInstancedPipelineInfo,
&useHWAA)); |
851 if (batch) { | 856 if (batch) { |
852 GrPipelineBuilder pipelineBuilder(paintIn, useHWAA); | 857 GrPipelineBuilder pipelineBuilder(paintIn, useHWAA); |
853 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; | 858 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; |
854 return true; | 859 return true; |
855 } | 860 } |
856 } | 861 } |
857 | 862 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 if (oval.isEmpty()) { | 952 if (oval.isEmpty()) { |
948 return; | 953 return; |
949 } | 954 } |
950 | 955 |
951 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in
SkGpuDevice | 956 SkASSERT(!style.pathEffect()); // this should've been devolved to a path in
SkGpuDevice |
952 | 957 |
953 AutoCheckFlush acf(fDrawingManager); | 958 AutoCheckFlush acf(fDrawingManager); |
954 const SkStrokeRec& stroke = style.strokeRec(); | 959 const SkStrokeRec& stroke = style.strokeRec(); |
955 bool useHWAA; | 960 bool useHWAA; |
956 | 961 |
957 if (this->getDrawTarget()->instancedRendering() && stroke.isFillStyle()) { | 962 if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()
&& |
| 963 stroke.isFillStyle()) { |
958 InstancedRendering* ir = this->getDrawTarget()->instancedRendering(); | 964 InstancedRendering* ir = this->getDrawTarget()->instancedRendering(); |
959 SkAutoTUnref<GrDrawBatch> batch(ir->recordOval(oval, viewMatrix, paint.g
etColor(), | 965 SkAutoTUnref<GrDrawBatch> batch(ir->recordOval(oval, viewMatrix, paint.g
etColor(), |
960 paint.isAntiAlias(), fIns
tancedPipelineInfo, | 966 paint.isAntiAlias(), fIns
tancedPipelineInfo, |
961 &useHWAA)); | 967 &useHWAA)); |
962 if (batch) { | 968 if (batch) { |
963 GrPipelineBuilder pipelineBuilder(paint, useHWAA); | 969 GrPipelineBuilder pipelineBuilder(paint, useHWAA); |
964 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; | 970 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch)
; |
965 return; | 971 return; |
966 } | 972 } |
967 } | 973 } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 | 1290 |
1285 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1291 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
1286 GrDrawBatch* batch) { | 1292 GrDrawBatch* batch) { |
1287 ASSERT_SINGLE_OWNER | 1293 ASSERT_SINGLE_OWNER |
1288 RETURN_IF_ABANDONED | 1294 RETURN_IF_ABANDONED |
1289 SkDEBUGCODE(this->validate();) | 1295 SkDEBUGCODE(this->validate();) |
1290 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1296 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
1291 | 1297 |
1292 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1298 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
1293 } | 1299 } |
OLD | NEW |