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

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

Issue 2147443004: Retract PipelineBuilder from GrClip::apply (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Appease some compilers 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 | « src/gpu/GrDrawTarget.h ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.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 2010 Google Inc. 2 * Copyright 2010 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 "GrDrawTarget.h" 8 #include "GrDrawTarget.h"
9 9
10 #include "GrAuditTrail.h" 10 #include "GrAuditTrail.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 323
324 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, 324 void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
325 GrDrawContext* drawContext, 325 GrDrawContext* drawContext,
326 const GrClip& clip, 326 const GrClip& clip,
327 GrDrawBatch* batch) { 327 GrDrawBatch* batch) {
328 // Setup clip 328 // Setup clip
329 GrAppliedClip appliedClip; 329 GrAppliedClip appliedClip;
330 SkRect bounds; 330 SkRect bounds;
331 batch_bounds(&bounds, batch); 331 batch_bounds(&bounds, batch);
332 if (!clip.apply(fContext, pipelineBuilder, drawContext, &bounds, &appliedCli p)) { 332 if (!clip.apply(fContext, drawContext, &bounds,
333 pipelineBuilder.isHWAntialias(), pipelineBuilder.hasUserSten cilSettings(),
334 &appliedClip)) {
333 return; 335 return;
334 } 336 }
335 337
336 // TODO: this is the only remaining usage of the AutoRestoreFragmentProcesso rState - remove it 338 // TODO: this is the only remaining usage of the AutoRestoreFragmentProcesso rState - remove it
337 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; 339 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
338 if (appliedClip.getClipCoverageFragmentProcessor()) { 340 if (appliedClip.getClipCoverageFragmentProcessor()) {
339 arfps.set(&pipelineBuilder); 341 arfps.set(&pipelineBuilder);
340 arfps.addCoverageFragmentProcessor(sk_ref_sp(appliedClip.getClipCoverage FragmentProcessor())); 342 arfps.addCoverageFragmentProcessor(sk_ref_sp(appliedClip.getClipCoverage FragmentProcessor()));
341 } 343 }
342 344
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 398
397 #ifdef ENABLE_MDB 399 #ifdef ENABLE_MDB
398 SkASSERT(fRenderTarget); 400 SkASSERT(fRenderTarget);
399 batch->pipeline()->addDependenciesTo(fRenderTarget); 401 batch->pipeline()->addDependenciesTo(fRenderTarget);
400 #endif 402 #endif
401 SkRect clippedBounds; 403 SkRect clippedBounds;
402 SkAssertResult(intersect(&clippedBounds, bounds, appliedClip.deviceBounds()) ); 404 SkAssertResult(intersect(&clippedBounds, bounds, appliedClip.deviceBounds()) );
403 this->recordBatch(batch, clippedBounds); 405 this->recordBatch(batch, clippedBounds);
404 } 406 }
405 407
406 void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, 408 void GrDrawTarget::stencilPath(GrDrawContext* drawContext,
407 GrDrawContext* drawContext,
408 const GrClip& clip, 409 const GrClip& clip,
410 const GrUserStencilSettings* ss,
411 bool useHWAA,
409 const SkMatrix& viewMatrix, 412 const SkMatrix& viewMatrix,
410 const GrPath* path, 413 const GrPath* path) {
411 GrPathRendering::FillType fill) {
412 // TODO: extract portions of checkDraw that are relevant to path stenciling. 414 // TODO: extract portions of checkDraw that are relevant to path stenciling.
413 SkASSERT(path); 415 SkASSERT(path);
414 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport()); 416 SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
415 417
416 // Setup clip 418 // Setup clip
417 GrAppliedClip appliedClip; 419 GrAppliedClip appliedClip;
418 if (!clip.apply(fContext, pipelineBuilder, drawContext, nullptr, &appliedCli p)) { 420 if (!clip.apply(fContext, drawContext, nullptr, useHWAA, SkToBool(ss), &appl iedClip)) {
419 return; 421 return;
420 } 422 }
421 // TODO: respect fClipBatchToBounds if we ever start computing bounds here. 423 // TODO: respect fClipBatchToBounds if we ever start computing bounds here.
422 424
423 // Coverage AA does not make sense when rendering to the stencil buffer. The caller should never 425 // Coverage AA does not make sense when rendering to the stencil buffer. The caller should never
424 // attempt this in a situation that would require coverage AA. 426 // attempt this in a situation that would require coverage AA.
425 SkASSERT(!appliedClip.getClipCoverageFragmentProcessor()); 427 SkASSERT(!appliedClip.getClipCoverageFragmentProcessor());
426 428
427 GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAtt achment( 429 GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAtt achment(
428 drawContext->accessRenderTarget( )); 430 drawContext->accessRenderTarget( ));
429 if (!stencilAttachment) { 431 if (!stencilAttachment) {
430 SkDebugf("ERROR creating stencil attachment. Draw skipped.\n"); 432 SkDebugf("ERROR creating stencil attachment. Draw skipped.\n");
431 return; 433 return;
432 } 434 }
433 435
434 GrBatch* batch = GrStencilPathBatch::Create(viewMatrix, 436 GrBatch* batch = GrStencilPathBatch::Create(viewMatrix,
435 pipelineBuilder.isHWAntialias(), 437 useHWAA,
436 fill, 438 path->getFillType(),
437 appliedClip.hasStencilClip(), 439 appliedClip.hasStencilClip(),
438 stencilAttachment->bits(), 440 stencilAttachment->bits(),
439 appliedClip.scissorState(), 441 appliedClip.scissorState(),
440 drawContext->accessRenderTarget( ), 442 drawContext->accessRenderTarget( ),
441 path); 443 path);
442 this->recordBatch(batch, appliedClip.deviceBounds()); 444 this->recordBatch(batch, appliedClip.deviceBounds());
443 batch->unref(); 445 batch->unref();
444 } 446 }
445 447
446 void GrDrawTarget::addBatch(sk_sp<GrBatch> batch) { 448 void GrDrawTarget::addBatch(sk_sp<GrBatch> batch) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 592 }
591 } 593 }
592 594
593 /////////////////////////////////////////////////////////////////////////////// 595 ///////////////////////////////////////////////////////////////////////////////
594 596
595 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 597 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
596 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 598 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
597 this->recordBatch(batch, batch->bounds()); 599 this->recordBatch(batch, batch->bounds());
598 batch->unref(); 600 batch->unref();
599 } 601 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698