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 "GrDefaultGeoProcFactory.h" | 10 #include "GrDefaultGeoProcFactory.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 if (getGpu()->canCopySurface(dst, src, srcRect, dstPoint)) { | 474 if (getGpu()->canCopySurface(dst, src, srcRect, dstPoint)) { |
475 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst
, src)); | 475 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst
, src)); |
476 cs->fSrcRect = srcRect; | 476 cs->fSrcRect = srcRect; |
477 cs->fDstPoint = dstPoint; | 477 cs->fDstPoint = dstPoint; |
478 this->recordTraceMarkersIfNecessary(); | 478 this->recordTraceMarkersIfNecessary(); |
479 return true; | 479 return true; |
480 } | 480 } |
481 return false; | 481 return false; |
482 } | 482 } |
483 | 483 |
484 bool GrInOrderDrawBuffer::onCanCopySurface(const GrSurface* dst, | |
485 const GrSurface* src, | |
486 const SkIRect& srcRect, | |
487 const SkIPoint& dstPoint) { | |
488 return getGpu()->canCopySurface(dst, src, srcRect, dstPoint); | |
489 } | |
490 | |
491 bool GrInOrderDrawBuffer::onInitCopySurfaceDstDesc(const GrSurface* src, GrSurfa
ceDesc* desc) { | |
492 return getGpu()->initCopySurfaceDstDesc(src, desc); | |
493 } | |
494 | |
495 bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds, | 484 bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds, |
496 GrGpu::DrawType drawType, | 485 GrGpu::DrawType drawType, |
497 const GrClipMaskManager::Scis
sorState& scissor, | 486 const GrClipMaskManager::Scis
sorState& scissor, |
498 const GrDeviceCoordTexture* d
stCopy) { | 487 const GrDeviceCoordTexture* d
stCopy) { |
499 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, | 488 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, |
500 (ds, this->getGpu(), scissor, dstCop
y, drawType)); | 489 (ds, this->getGpu(), scissor, dstCop
y, drawType)); |
501 if (ss->fState.mustSkip()) { | 490 if (ss->fState.mustSkip()) { |
502 fCmdBuffer.pop_back(); | 491 fCmdBuffer.pop_back(); |
503 return false; | 492 return false; |
504 } | 493 } |
505 if (fPrevState && *fPrevState == ss->fState) { | 494 if (fPrevState && *fPrevState == ss->fState) { |
506 fCmdBuffer.pop_back(); | 495 fCmdBuffer.pop_back(); |
507 } else { | 496 } else { |
508 fPrevState = &ss->fState; | 497 fPrevState = &ss->fState; |
509 this->recordTraceMarkersIfNecessary(); | 498 this->recordTraceMarkersIfNecessary(); |
510 } | 499 } |
511 return true; | 500 return true; |
512 } | 501 } |
513 | 502 |
514 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { | 503 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { |
515 SkASSERT(!fCmdBuffer.empty()); | 504 SkASSERT(!fCmdBuffer.empty()); |
516 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); | 505 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); |
517 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); | 506 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); |
518 if (activeTraceMarkers.count() > 0) { | 507 if (activeTraceMarkers.count() > 0) { |
519 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); | 508 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); |
520 fGpuCmdMarkers.push_back(activeTraceMarkers); | 509 fGpuCmdMarkers.push_back(activeTraceMarkers); |
521 } | 510 } |
522 } | 511 } |
OLD | NEW |