OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrInOrderDrawBuffer.h" | 8 #include "GrInOrderDrawBuffer.h" |
9 | 9 |
10 #include "GrBufferAllocPool.h" | 10 #include "GrBufferAllocPool.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 rect = &r; | 427 rect = &r; |
428 } | 428 } |
429 Clear* clr = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Clear, (renderTarget)); | 429 Clear* clr = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Clear, (renderTarget)); |
430 GrColorIsPMAssert(color); | 430 GrColorIsPMAssert(color); |
431 clr->fColor = color; | 431 clr->fColor = color; |
432 clr->fRect = *rect; | 432 clr->fRect = *rect; |
433 clr->fCanIgnoreRect = canIgnoreRect; | 433 clr->fCanIgnoreRect = canIgnoreRect; |
434 this->recordTraceMarkersIfNecessary(); | 434 this->recordTraceMarkersIfNecessary(); |
435 } | 435 } |
436 | 436 |
| 437 void GrInOrderDrawBuffer::clearStencilClip(const SkIRect& rect, |
| 438 bool insideClip, |
| 439 GrRenderTarget* renderTarget) { |
| 440 if (NULL == renderTarget) { |
| 441 renderTarget = this->drawState()->getRenderTarget(); |
| 442 SkASSERT(renderTarget); |
| 443 } |
| 444 ClearStencilClip* clr = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, ClearStencilCli
p, (renderTarget)); |
| 445 clr->fRect = rect; |
| 446 clr->fInsideClip = insideClip; |
| 447 this->recordTraceMarkersIfNecessary(); |
| 448 } |
| 449 |
437 void GrInOrderDrawBuffer::discard(GrRenderTarget* renderTarget) { | 450 void GrInOrderDrawBuffer::discard(GrRenderTarget* renderTarget) { |
438 if (!this->caps()->discardRenderTargetSupport()) { | 451 if (!this->caps()->discardRenderTargetSupport()) { |
439 return; | 452 return; |
440 } | 453 } |
441 if (NULL == renderTarget) { | 454 if (NULL == renderTarget) { |
442 renderTarget = this->drawState()->getRenderTarget(); | 455 renderTarget = this->drawState()->getRenderTarget(); |
443 SkASSERT(renderTarget); | 456 SkASSERT(renderTarget); |
444 } | 457 } |
445 Clear* clr = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Clear, (renderTarget)); | 458 Clear* clr = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Clear, (renderTarget)); |
446 clr->fColor = GrColor_ILLEGAL; | 459 clr->fColor = GrColor_ILLEGAL; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 } | 568 } |
556 | 569 |
557 void GrInOrderDrawBuffer::Clear::execute(GrDrawTarget* gpu) { | 570 void GrInOrderDrawBuffer::Clear::execute(GrDrawTarget* gpu) { |
558 if (GrColor_ILLEGAL == fColor) { | 571 if (GrColor_ILLEGAL == fColor) { |
559 gpu->discard(this->renderTarget()); | 572 gpu->discard(this->renderTarget()); |
560 } else { | 573 } else { |
561 gpu->clear(&fRect, fColor, fCanIgnoreRect, this->renderTarget()); | 574 gpu->clear(&fRect, fColor, fCanIgnoreRect, this->renderTarget()); |
562 } | 575 } |
563 } | 576 } |
564 | 577 |
| 578 void GrInOrderDrawBuffer::ClearStencilClip::execute(GrDrawTarget* gpu) { |
| 579 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); |
| 580 } |
| 581 |
565 void GrInOrderDrawBuffer::CopySurface::execute(GrDrawTarget* gpu) { | 582 void GrInOrderDrawBuffer::CopySurface::execute(GrDrawTarget* gpu) { |
566 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); | 583 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); |
567 } | 584 } |
568 | 585 |
569 bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst, | 586 bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst, |
570 GrSurface* src, | 587 GrSurface* src, |
571 const SkIRect& srcRect, | 588 const SkIRect& srcRect, |
572 const SkIPoint& dstPoint) { | 589 const SkIPoint& dstPoint) { |
573 if (fDstGpu->canCopySurface(dst, src, srcRect, dstPoint)) { | 590 if (fDstGpu->canCopySurface(dst, src, srcRect, dstPoint)) { |
574 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst
, src)); | 591 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst
, src)); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); | 858 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); |
842 fGpuCmdMarkers.push_back(activeTraceMarkers); | 859 fGpuCmdMarkers.push_back(activeTraceMarkers); |
843 } | 860 } |
844 } | 861 } |
845 | 862 |
846 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { | 863 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { |
847 INHERITED::clipWillBeSet(newClipData); | 864 INHERITED::clipWillBeSet(newClipData); |
848 fClipSet = true; | 865 fClipSet = true; |
849 fClipProxyState = kUnknown_ClipProxyState; | 866 fClipProxyState = kUnknown_ClipProxyState; |
850 } | 867 } |
OLD | NEW |