| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 412 } |
| 413 DrawPath* cp = this->recordDrawPath(); | 413 DrawPath* cp = this->recordDrawPath(); |
| 414 cp->fPath.reset(path); | 414 cp->fPath.reset(path); |
| 415 path->ref(); | 415 path->ref(); |
| 416 cp->fFill = fill; | 416 cp->fFill = fill; |
| 417 if (NULL != dstCopy) { | 417 if (NULL != dstCopy) { |
| 418 cp->fDstCopy = *dstCopy; | 418 cp->fDstCopy = *dstCopy; |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 | 421 |
| 422 void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, GrRenderTarg
et* renderTarget) { | 422 void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, |
| 423 bool canIgnoreRect, GrRenderTarget* renderTarget
) { |
| 423 SkIRect r; | 424 SkIRect r; |
| 424 if (NULL == renderTarget) { | 425 if (NULL == renderTarget) { |
| 425 renderTarget = this->drawState()->getRenderTarget(); | 426 renderTarget = this->drawState()->getRenderTarget(); |
| 426 SkASSERT(NULL != renderTarget); | 427 SkASSERT(NULL != renderTarget); |
| 427 } | 428 } |
| 428 if (NULL == rect) { | 429 if (NULL == rect) { |
| 429 // We could do something smart and remove previous draws and clears to | 430 // We could do something smart and remove previous draws and clears to |
| 430 // the current render target. If we get that smart we have to make sure | 431 // the current render target. If we get that smart we have to make sure |
| 431 // those draws aren't read before this clear (render-to-texture). | 432 // those draws aren't read before this clear (render-to-texture). |
| 432 r.setLTRB(0, 0, renderTarget->width(), renderTarget->height()); | 433 r.setLTRB(0, 0, renderTarget->width(), renderTarget->height()); |
| 433 rect = &r; | 434 rect = &r; |
| 434 } | 435 } |
| 435 Clear* clr = this->recordClear(); | 436 Clear* clr = this->recordClear(); |
| 436 clr->fColor = color; | 437 clr->fColor = color; |
| 437 clr->fRect = *rect; | 438 clr->fRect = *rect; |
| 439 clr->fCanIgnoreRect = canIgnoreRect; |
| 438 clr->fRenderTarget = renderTarget; | 440 clr->fRenderTarget = renderTarget; |
| 439 renderTarget->ref(); | 441 renderTarget->ref(); |
| 440 } | 442 } |
| 441 | 443 |
| 442 void GrInOrderDrawBuffer::reset() { | 444 void GrInOrderDrawBuffer::reset() { |
| 443 SkASSERT(1 == fGeoPoolStateStack.count()); | 445 SkASSERT(1 == fGeoPoolStateStack.count()); |
| 444 this->resetVertexSource(); | 446 this->resetVertexSource(); |
| 445 this->resetIndexSource(); | 447 this->resetIndexSource(); |
| 446 int numDraws = fDraws.count(); | 448 int numDraws = fDraws.count(); |
| 447 for (int d = 0; d < numDraws; ++d) { | 449 for (int d = 0; d < numDraws; ++d) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 break; | 535 break; |
| 534 case kSetClip_Cmd: | 536 case kSetClip_Cmd: |
| 535 clipData.fClipStack = &fClips[currClip]; | 537 clipData.fClipStack = &fClips[currClip]; |
| 536 clipData.fOrigin = fClipOrigins[currClip]; | 538 clipData.fOrigin = fClipOrigins[currClip]; |
| 537 fDstGpu->setClip(&clipData); | 539 fDstGpu->setClip(&clipData); |
| 538 ++currClip; | 540 ++currClip; |
| 539 break; | 541 break; |
| 540 case kClear_Cmd: | 542 case kClear_Cmd: |
| 541 fDstGpu->clear(&fClears[currClear].fRect, | 543 fDstGpu->clear(&fClears[currClear].fRect, |
| 542 fClears[currClear].fColor, | 544 fClears[currClear].fColor, |
| 545 fClears[currClear].fCanIgnoreRect, |
| 543 fClears[currClear].fRenderTarget); | 546 fClears[currClear].fRenderTarget); |
| 544 ++currClear; | 547 ++currClear; |
| 545 break; | 548 break; |
| 546 case kCopySurface_Cmd: | 549 case kCopySurface_Cmd: |
| 547 fDstGpu->copySurface(fCopySurfaces[currCopySurface].fDst.get(), | 550 fDstGpu->copySurface(fCopySurfaces[currCopySurface].fDst.get(), |
| 548 fCopySurfaces[currCopySurface].fSrc.get(), | 551 fCopySurfaces[currCopySurface].fSrc.get(), |
| 549 fCopySurfaces[currCopySurface].fSrcRect, | 552 fCopySurfaces[currCopySurface].fSrcRect, |
| 550 fCopySurfaces[currCopySurface].fDstPoint); | 553 fCopySurfaces[currCopySurface].fDstPoint); |
| 551 ++currCopySurface; | 554 ++currCopySurface; |
| 552 break; | 555 break; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 fCmds.push_back(kCopySurface_Cmd); | 853 fCmds.push_back(kCopySurface_Cmd); |
| 851 return &fCopySurfaces.push_back(); | 854 return &fCopySurfaces.push_back(); |
| 852 } | 855 } |
| 853 | 856 |
| 854 | 857 |
| 855 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { | 858 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { |
| 856 INHERITED::clipWillBeSet(newClipData); | 859 INHERITED::clipWillBeSet(newClipData); |
| 857 fClipSet = true; | 860 fClipSet = true; |
| 858 fClipProxyState = kUnknown_ClipProxyState; | 861 fClipProxyState = kUnknown_ClipProxyState; |
| 859 } | 862 } |
| OLD | NEW |