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::copySurface(GrSurface* dst, | 560 bool GrInOrderDrawBuffer::onCopySurface(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; | |
575 } | 570 } |
| 571 return false; |
576 } | 572 } |
577 | 573 |
578 bool GrInOrderDrawBuffer::canCopySurface(const GrSurface* dst, | 574 bool GrInOrderDrawBuffer::onCanCopySurface(const GrSurface* dst, |
579 const GrSurface* src, | 575 const GrSurface* src, |
580 const SkIRect& srcRect, | 576 const SkIRect& srcRect, |
581 const SkIPoint& dstPoint) { | 577 const SkIPoint& dstPoint) { |
582 return fDstGpu->canCopySurface(dst, src, srcRect, dstPoint) || | 578 return fDstGpu->canCopySurface(dst, src, srcRect, dstPoint); |
583 GrDrawTarget::canCopySurface(dst, src, srcRect, dstPoint); | |
584 } | 579 } |
585 | 580 |
586 void GrInOrderDrawBuffer::initCopySurfaceDstDesc(const GrSurface* src, GrSurface
Desc* desc) { | 581 bool GrInOrderDrawBuffer::onInitCopySurfaceDstDesc(const GrSurface* src, GrSurfa
ceDesc* desc) { |
587 fDstGpu->initCopySurfaceDstDesc(src, desc); | 582 return fDstGpu->initCopySurfaceDstDesc(src, desc); |
588 } | 583 } |
589 | 584 |
590 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, | 585 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, |
591 size_t vertexStride, | 586 size_t vertexStride, |
592 int indexCount) { | 587 int indexCount) { |
593 // We use geometryHints() to know whether to flush the draw buffer. We | 588 // We use geometryHints() to know whether to flush the draw buffer. We |
594 // can't flush if we are inside an unbalanced pushGeometrySource. | 589 // can't flush if we are inside an unbalanced pushGeometrySource. |
595 // Moreover, flushing blows away vertex and index data that was | 590 // Moreover, flushing blows away vertex and index data that was |
596 // previously reserved. So if the vertex or index data is pulled from | 591 // previously reserved. So if the vertex or index data is pulled from |
597 // reserved space and won't be released by this request then we can't | 592 // 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... |
758 | 753 |
759 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { | 754 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { |
760 SkASSERT(!fCmdBuffer.empty()); | 755 SkASSERT(!fCmdBuffer.empty()); |
761 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); | 756 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); |
762 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); | 757 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); |
763 if (activeTraceMarkers.count() > 0) { | 758 if (activeTraceMarkers.count() > 0) { |
764 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); | 759 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); |
765 fGpuCmdMarkers.push_back(activeTraceMarkers); | 760 fGpuCmdMarkers.push_back(activeTraceMarkers); |
766 } | 761 } |
767 } | 762 } |
OLD | NEW |