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

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

Issue 2092893003: Retract PipelineBuilder some more (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update 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/gpu/GrDrawContext.h ('k') | src/gpu/GrSWMaskHelper.cpp » ('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"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 290
291 static bool should_apply_coverage_aa(const GrPaint& paint, GrRenderTarget* rt, 291 static bool should_apply_coverage_aa(const GrPaint& paint, GrRenderTarget* rt,
292 bool* useHWAA = nullptr) { 292 bool* useHWAA = nullptr) {
293 if (!paint.isAntiAlias()) { 293 if (!paint.isAntiAlias()) {
294 if (useHWAA) { 294 if (useHWAA) {
295 *useHWAA = false; 295 *useHWAA = false;
296 } 296 }
297 return false; 297 return false;
298 } else { 298 } else {
299 if (useHWAA) { 299 if (useHWAA) {
300 *useHWAA = rt->isUnifiedMultisampled(); 300 *useHWAA = rt->isUnifiedMultisampled() || rt->hasMixedSamples();
301 } 301 }
302 return !rt->isUnifiedMultisampled(); 302 return !rt->isUnifiedMultisampled() && !rt->hasMixedSamples();
303 } 303 }
304 } 304 }
305 305
306 // Attempts to crop a rect and optional local rect to the clip boundaries. 306 // Attempts to crop a rect and optional local rect to the clip boundaries.
307 // Returns false if the draw can be skipped entirely. 307 // Returns false if the draw can be skipped entirely.
308 static bool crop_filled_rect(const GrRenderTarget* rt, const GrClip& clip, 308 static bool crop_filled_rect(const GrRenderTarget* rt, const GrClip& clip,
309 const SkMatrix& viewMatrix, SkRect* rect, 309 const SkMatrix& viewMatrix, SkRect* rect,
310 SkRect* localRect = nullptr) { 310 SkRect* localRect = nullptr) {
311 if (!viewMatrix.rectStaysRect()) { 311 if (!viewMatrix.rectStaysRect()) {
312 return true; 312 return true;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 } 614 }
615 615
616 AutoCheckFlush acf(fDrawingManager); 616 AutoCheckFlush acf(fDrawingManager);
617 SkAutoTUnref<GrDrawBatch> batch; 617 SkAutoTUnref<GrDrawBatch> batch;
618 bool useHWAA; 618 bool useHWAA;
619 619
620 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) { 620 if (InstancedRendering* ir = this->getDrawTarget()->instancedRendering()) {
621 batch.reset(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), cr oppedLocalRect, 621 batch.reset(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), cr oppedLocalRect,
622 paint.isAntiAlias(), fInstancedPipelineInfo, &useHWAA)); 622 paint.isAntiAlias(), fInstancedPipelineInfo, &useHWAA));
623 if (batch) { 623 if (batch) {
624 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 624 SkASSERT(useHWAA == this->mustUseHWAA(paint));
625 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch) ; 625 this->drawBatch(paint, clip, GrUserStencilSettings::kUnused, batch);
626 return; 626 return;
627 } 627 }
628 } 628 }
629 629
630 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) && 630 if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA) &&
631 view_matrix_ok_for_aa_fill_rect(viewMatrix)) { 631 view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
632 batch.reset(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), vie wMatrix, 632 batch.reset(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), vie wMatrix,
633 croppedRect, croppedL ocalRect)); 633 croppedRect, croppedL ocalRect));
634 if (batch) { 634 if (batch) {
635 GrPipelineBuilder pipelineBuilder(paint, useHWAA); 635 SkASSERT(useHWAA == this->mustUseHWAA(paint));
636 this->drawBatch(pipelineBuilder, clip, batch); 636 this->drawBatch(paint, clip, GrUserStencilSettings::kUnused, batch);
637 return;
638 } 637 }
639 } else { 638 } else {
640 this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, &cropped LocalRect, 639 this->drawNonAAFilledRect(clip, paint, viewMatrix, croppedRect, &cropped LocalRect,
641 nullptr, nullptr); 640 nullptr, nullptr);
642 } 641 }
643
644 } 642 }
645 643
646 void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip, 644 void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
647 const GrPaint& paint, 645 const GrPaint& paint,
648 const SkMatrix& viewMatrix, 646 const SkMatrix& viewMatrix,
649 const SkRect& rectToDraw, 647 const SkRect& rectToDraw,
650 const SkMatrix& localMatrix) { 648 const SkMatrix& localMatrix) {
651 ASSERT_SINGLE_OWNER 649 ASSERT_SINGLE_OWNER
652 RETURN_IF_ABANDONED 650 RETURN_IF_ABANDONED
653 SkDEBUGCODE(this->validate();) 651 SkDEBUGCODE(this->validate();)
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 args.fUserStencilSettings = &GrUserStencilSettings::kUnused; 1231 args.fUserStencilSettings = &GrUserStencilSettings::kUnused;
1234 args.fDrawContext = this; 1232 args.fDrawContext = this;
1235 args.fClip = &clip; 1233 args.fClip = &clip;
1236 args.fViewMatrix = &viewMatrix; 1234 args.fViewMatrix = &viewMatrix;
1237 args.fShape = canDrawArgs.fShape; 1235 args.fShape = canDrawArgs.fShape;
1238 args.fAntiAlias = useCoverageAA; 1236 args.fAntiAlias = useCoverageAA;
1239 args.fGammaCorrect = this->isGammaCorrect(); 1237 args.fGammaCorrect = this->isGammaCorrect();
1240 pr->drawPath(args); 1238 pr->drawPath(args);
1241 } 1239 }
1242 1240
1243 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, 1241 void GrDrawContext::drawBatch(const GrPaint& paint,
1244 GrDrawBatch* batch) { 1242 const GrClip& clip,
1243 const GrUserStencilSettings& userStencilSettings,
1244 GrDrawBatch* batch,
1245 GrDrawFace drawFace) {
1245 ASSERT_SINGLE_OWNER 1246 ASSERT_SINGLE_OWNER
1246 RETURN_IF_ABANDONED 1247 RETURN_IF_ABANDONED
1247 SkDEBUGCODE(this->validate();) 1248 SkDEBUGCODE(this->validate();)
1248 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 1249 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
1249 1250
1251 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
1252 pipelineBuilder.setUserStencil(&userStencilSettings);
1253 pipelineBuilder.setDrawFace(drawFace);
1254
1250 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); 1255 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
1251 } 1256 }
OLDNEW
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/gpu/GrSWMaskHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698