| 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 void GrInOrderDrawBuffer::ClearStencilClip::execute(GrInOrderDrawBuffer* buf, | 551 void GrInOrderDrawBuffer::ClearStencilClip::execute(GrInOrderDrawBuffer* buf, |
| 552 const GrOptDrawState*) { | 552 const GrOptDrawState*) { |
| 553 buf->fDstGpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); | 553 buf->fDstGpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void GrInOrderDrawBuffer::CopySurface::execute(GrInOrderDrawBuffer* buf, const G
rOptDrawState*) { | 556 void GrInOrderDrawBuffer::CopySurface::execute(GrInOrderDrawBuffer* buf, const G
rOptDrawState*) { |
| 557 buf->fDstGpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); | 557 buf->fDstGpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); |
| 558 } | 558 } |
| 559 | 559 |
| 560 bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst, | 560 bool GrInOrderDrawBuffer::copySurface(GrSurface* dst, |
| 561 GrSurface* src, | 561 GrSurface* src, |
| 562 const SkIRect& srcRect, | 562 const SkIRect& srcRect, |
| 563 const SkIPoint& dstPoint) { | 563 const SkIPoint& dstPoint) { |
| 564 if (fDstGpu->canCopySurface(dst, src, srcRect, dstPoint)) { | 564 if (fDstGpu->canCopySurface(dst, src, srcRect, dstPoint)) { |
| 565 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst
, src)); | 565 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst
, src)); |
| 566 cs->fSrcRect = srcRect; | 566 cs->fSrcRect = srcRect; |
| 567 cs->fDstPoint = dstPoint; | 567 cs->fDstPoint = dstPoint; |
| 568 this->recordTraceMarkersIfNecessary(); | 568 this->recordTraceMarkersIfNecessary(); |
| 569 return true; | 569 return true; |
| 570 } else if (GrDrawTarget::canCopySurface(dst, src, srcRect, dstPoint)) { |
| 571 GrDrawTarget::copySurface(dst, src, srcRect, dstPoint); |
| 572 return true; |
| 573 } else { |
| 574 return false; |
| 570 } | 575 } |
| 571 return false; | |
| 572 } | 576 } |
| 573 | 577 |
| 574 bool GrInOrderDrawBuffer::onCanCopySurface(const GrSurface* dst, | 578 bool GrInOrderDrawBuffer::canCopySurface(const GrSurface* dst, |
| 575 const GrSurface* src, | 579 const GrSurface* src, |
| 576 const SkIRect& srcRect, | 580 const SkIRect& srcRect, |
| 577 const SkIPoint& dstPoint) { | 581 const SkIPoint& dstPoint) { |
| 578 return fDstGpu->canCopySurface(dst, src, srcRect, dstPoint); | 582 return fDstGpu->canCopySurface(dst, src, srcRect, dstPoint) || |
| 583 GrDrawTarget::canCopySurface(dst, src, srcRect, dstPoint); |
| 579 } | 584 } |
| 580 | 585 |
| 581 bool GrInOrderDrawBuffer::onInitCopySurfaceDstDesc(const GrSurface* src, GrSurfa
ceDesc* desc) { | 586 void GrInOrderDrawBuffer::initCopySurfaceDstDesc(const GrSurface* src, GrSurface
Desc* desc) { |
| 582 return fDstGpu->initCopySurfaceDstDesc(src, desc); | 587 fDstGpu->initCopySurfaceDstDesc(src, desc); |
| 583 } | 588 } |
| 584 | 589 |
| 585 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, | 590 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, |
| 586 size_t vertexStride, | 591 size_t vertexStride, |
| 587 int indexCount) { | 592 int indexCount) { |
| 588 // We use geometryHints() to know whether to flush the draw buffer. We | 593 // We use geometryHints() to know whether to flush the draw buffer. We |
| 589 // can't flush if we are inside an unbalanced pushGeometrySource. | 594 // can't flush if we are inside an unbalanced pushGeometrySource. |
| 590 // Moreover, flushing blows away vertex and index data that was | 595 // Moreover, flushing blows away vertex and index data that was |
| 591 // previously reserved. So if the vertex or index data is pulled from | 596 // previously reserved. So if the vertex or index data is pulled from |
| 592 // reserved space and won't be released by this request then we can't | 597 // reserved space and won't be released by this request then we can't |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 | 758 |
| 754 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { | 759 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { |
| 755 SkASSERT(!fCmdBuffer.empty()); | 760 SkASSERT(!fCmdBuffer.empty()); |
| 756 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); | 761 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); |
| 757 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); | 762 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); |
| 758 if (activeTraceMarkers.count() > 0) { | 763 if (activeTraceMarkers.count() > 0) { |
| 759 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); | 764 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); |
| 760 fGpuCmdMarkers.push_back(activeTraceMarkers); | 765 fGpuCmdMarkers.push_back(activeTraceMarkers); |
| 761 } | 766 } |
| 762 } | 767 } |
| OLD | NEW |