Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 705593002: Refactor DrawTarget and GPU to be independent (Closed) Base URL: https://skia.googlesource.com/skia.git@early_clip
Patch Set: rebase on master Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 fDstGpu->restoreActiveTraceMarkers(); 462 fDstGpu->restoreActiveTraceMarkers();
463 SkASSERT(fGpuCmdMarkers.count() == currCmdMarker); 463 SkASSERT(fGpuCmdMarkers.count() == currCmdMarker);
464 464
465 fDstGpu->setDrawState(prevDrawState); 465 fDstGpu->setDrawState(prevDrawState);
466 prevDrawState->unref(); 466 prevDrawState->unref();
467 this->reset(); 467 this->reset();
468 ++fDrawID; 468 ++fDrawID;
469 } 469 }
470 470
471 void GrInOrderDrawBuffer::Draw::execute(GrClipTarget* gpu) { 471 void GrInOrderDrawBuffer::Draw::execute(GrGpu* gpu) {
472 gpu->setVertexSourceToBuffer(this->vertexBuffer()); 472 gpu->setVertexSourceToBuffer(this->vertexBuffer());
473 if (fInfo.isIndexed()) { 473 if (fInfo.isIndexed()) {
474 gpu->setIndexSourceToBuffer(this->indexBuffer()); 474 gpu->setIndexSourceToBuffer(this->indexBuffer());
475 } 475 }
476 gpu->executeDraw(fInfo, fScissorState); 476 gpu->onDraw(fInfo, fScissorState);
477 } 477 }
478 478
479 void GrInOrderDrawBuffer::StencilPath::execute(GrClipTarget* gpu) { 479 void GrInOrderDrawBuffer::StencilPath::execute(GrGpu* gpu) {
480 gpu->executeStencilPath(this->path(), fScissorState, fStencilSettings); 480 gpu->onStencilPath(this->path(), fScissorState, fStencilSettings);
481 } 481 }
482 482
483 void GrInOrderDrawBuffer::DrawPath::execute(GrClipTarget* gpu) { 483 void GrInOrderDrawBuffer::DrawPath::execute(GrGpu* gpu) {
484 gpu->executeDrawPath(this->path(), fScissorState, fStencilSettings, 484 gpu->onDrawPath(this->path(), fScissorState, fStencilSettings,
485 fDstCopy.texture() ? &fDstCopy : NULL); 485 fDstCopy.texture() ? &fDstCopy : NULL);
486 } 486 }
487 487
488 void GrInOrderDrawBuffer::DrawPaths::execute(GrClipTarget* gpu) { 488 void GrInOrderDrawBuffer::DrawPaths::execute(GrGpu* gpu) {
489 gpu->executeDrawPaths(this->pathRange(), this->indices(), fCount, this->tran sforms(), 489 gpu->onDrawPaths(this->pathRange(), this->indices(), fCount, this->transform s(),
490 fTransformsType, fScissorState, fStencilSettings, 490 fTransformsType, fScissorState, fStencilSettings,
491 fDstCopy.texture() ? &fDstCopy : NULL); 491 fDstCopy.texture() ? &fDstCopy : NULL);
492 } 492 }
493 493
494 void GrInOrderDrawBuffer::SetState::execute(GrClipTarget* gpu) { 494 void GrInOrderDrawBuffer::SetState::execute(GrGpu* gpu) {
495 gpu->setDrawState(&fState); 495 gpu->setDrawState(&fState);
496 } 496 }
497 497
498 void GrInOrderDrawBuffer::Clear::execute(GrClipTarget* gpu) { 498 void GrInOrderDrawBuffer::Clear::execute(GrGpu* gpu) {
499 if (GrColor_ILLEGAL == fColor) { 499 if (GrColor_ILLEGAL == fColor) {
500 gpu->discard(this->renderTarget()); 500 gpu->discard(this->renderTarget());
501 } else { 501 } else {
502 gpu->clear(&fRect, fColor, fCanIgnoreRect, this->renderTarget()); 502 gpu->clear(&fRect, fColor, fCanIgnoreRect, this->renderTarget());
503 } 503 }
504 } 504 }
505 505
506 void GrInOrderDrawBuffer::ClearStencilClip::execute(GrClipTarget* gpu) { 506 void GrInOrderDrawBuffer::ClearStencilClip::execute(GrGpu* gpu) {
507 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); 507 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget());
508 } 508 }
509 509
510 void GrInOrderDrawBuffer::CopySurface::execute(GrClipTarget* gpu) { 510 void GrInOrderDrawBuffer::CopySurface::execute(GrGpu* gpu) {
511 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); 511 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint);
512 } 512 }
513 513
514 bool GrInOrderDrawBuffer::copySurface(GrSurface* dst, 514 bool GrInOrderDrawBuffer::copySurface(GrSurface* dst,
515 GrSurface* src, 515 GrSurface* src,
516 const SkIRect& srcRect, 516 const SkIRect& srcRect,
517 const SkIPoint& dstPoint) { 517 const SkIPoint& dstPoint) {
518 if (fDstGpu->canCopySurface(dst, src, srcRect, dstPoint)) { 518 if (fDstGpu->canCopySurface(dst, src, srcRect, dstPoint)) {
519 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst , src)); 519 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst , src));
520 cs->fSrcRect = srcRect; 520 cs->fSrcRect = srcRect;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 729
730 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { 730 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() {
731 SkASSERT(!fCmdBuffer.empty()); 731 SkASSERT(!fCmdBuffer.empty());
732 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); 732 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType));
733 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); 733 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers();
734 if (activeTraceMarkers.count() > 0) { 734 if (activeTraceMarkers.count() > 0) {
735 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); 735 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType);
736 fGpuCmdMarkers.push_back(activeTraceMarkers); 736 fGpuCmdMarkers.push_back(activeTraceMarkers);
737 } 737 }
738 } 738 }
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698