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

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

Issue 742853002: Don't use NULL GrOptDrawState to indicate that draw should be skipped. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: save other file 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 | « no previous file | src/gpu/GrOptDrawState.h » ('j') | src/gpu/GrOptDrawState.cpp » ('J')
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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 726 }
727 if (kReserved_GeometrySrcType == restoredState.fIndexSrc) { 727 if (kReserved_GeometrySrcType == restoredState.fIndexSrc) {
728 poolState.fUsedPoolIndexBytes = sizeof(uint16_t) * restoredState.fIndexC ount; 728 poolState.fUsedPoolIndexBytes = sizeof(uint16_t) * restoredState.fIndexC ount;
729 } 729 }
730 } 730 }
731 731
732 bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds, 732 bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds,
733 GrGpu::DrawType drawType, 733 GrGpu::DrawType drawType,
734 const GrClipMaskManager::Scis sorState& scissor, 734 const GrClipMaskManager::Scis sorState& scissor,
735 const GrDeviceCoordTexture* d stCopy) { 735 const GrDeviceCoordTexture* d stCopy) {
736 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(ds, fDstGpu, sc issor, dstCopy, 736 SkAutoTUnref<GrOptDrawState> optState(
737 drawType)); 737 SkNEW_ARGS(GrOptDrawState, (ds, fDstGpu, scissor, dstCopy, drawType)));
738 if (!optState) { 738 if (optState->mustSkip()) {
739 return false; 739 return false;
740 } 740 }
741 if (!fLastState || *optState != *fLastState) { 741 if (!fLastState || *optState != *fLastState) {
742 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, (optState) ); 742 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, (optState) );
743 fLastState.reset(SkRef(optState.get())); 743 fLastState.reset(SkRef(optState.get()));
744 if (dstCopy) { 744 if (dstCopy) {
745 ss->fDstCopy = *dstCopy; 745 ss->fDstCopy = *dstCopy;
746 } 746 }
747 ss->fDrawType = drawType; 747 ss->fDrawType = drawType;
748 this->recordTraceMarkersIfNecessary(); 748 this->recordTraceMarkersIfNecessary();
749 } 749 }
750 return true; 750 return true;
751 } 751 }
752 752
753 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { 753 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() {
754 SkASSERT(!fCmdBuffer.empty()); 754 SkASSERT(!fCmdBuffer.empty());
755 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); 755 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType));
756 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); 756 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers();
757 if (activeTraceMarkers.count() > 0) { 757 if (activeTraceMarkers.count() > 0) {
758 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); 758 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType);
759 fGpuCmdMarkers.push_back(activeTraceMarkers); 759 fGpuCmdMarkers.push_back(activeTraceMarkers);
760 } 760 }
761 } 761 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrOptDrawState.h » ('j') | src/gpu/GrOptDrawState.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698