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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 months 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/GrGpuResource.cpp ('k') | src/gpu/GrLayerCache.h » ('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 16 matching lines...) Expand all
27 , fClipSet(true) 27 , fClipSet(true)
28 , fClipProxyState(kUnknown_ClipProxyState) 28 , fClipProxyState(kUnknown_ClipProxyState)
29 , fVertexPool(*vertexPool) 29 , fVertexPool(*vertexPool)
30 , fIndexPool(*indexPool) 30 , fIndexPool(*indexPool)
31 , fFlushing(false) 31 , fFlushing(false)
32 , fDrawID(0) { 32 , fDrawID(0) {
33 33
34 fDstGpu->ref(); 34 fDstGpu->ref();
35 fCaps.reset(SkRef(fDstGpu->caps())); 35 fCaps.reset(SkRef(fDstGpu->caps()));
36 36
37 SkASSERT(NULL != vertexPool); 37 SkASSERT(vertexPool);
38 SkASSERT(NULL != indexPool); 38 SkASSERT(indexPool);
39 39
40 GeometryPoolState& poolState = fGeoPoolStateStack.push_back(); 40 GeometryPoolState& poolState = fGeoPoolStateStack.push_back();
41 poolState.fUsedPoolVertexBytes = 0; 41 poolState.fUsedPoolVertexBytes = 0;
42 poolState.fUsedPoolIndexBytes = 0; 42 poolState.fUsedPoolIndexBytes = 0;
43 #ifdef SK_DEBUG 43 #ifdef SK_DEBUG
44 poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0; 44 poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0;
45 poolState.fPoolStartVertex = ~0; 45 poolState.fPoolStartVertex = ~0;
46 poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0; 46 poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0;
47 poolState.fPoolStartIndex = ~0; 47 poolState.fPoolStartIndex = ~0;
48 #endif 48 #endif
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr aceCmdBit); } 118 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr aceCmdBit); }
119 119
120 void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, 120 void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
121 const SkRect* localRect, 121 const SkRect* localRect,
122 const SkMatrix* localMatrix) { 122 const SkMatrix* localMatrix) {
123 GrDrawState* drawState = this->drawState(); 123 GrDrawState* drawState = this->drawState();
124 124
125 GrColor color = drawState->getColor(); 125 GrColor color = drawState->getColor();
126 126
127 set_vertex_attributes(drawState, NULL != localRect, color); 127 set_vertex_attributes(drawState, SkToBool(localRect), color);
128 128
129 AutoReleaseGeometry geo(this, 4, 0); 129 AutoReleaseGeometry geo(this, 4, 0);
130 if (!geo.succeeded()) { 130 if (!geo.succeeded()) {
131 GrPrintf("Failed to get space for vertices!\n"); 131 GrPrintf("Failed to get space for vertices!\n");
132 return; 132 return;
133 } 133 }
134 134
135 // Go to device coords to allow batching across matrix changes 135 // Go to device coords to allow batching across matrix changes
136 SkMatrix matrix = drawState->getViewMatrix(); 136 SkMatrix matrix = drawState->getViewMatrix();
137 137
138 // When the caller has provided an explicit source rect for a stage then we don't want to 138 // When the caller has provided an explicit source rect for a stage then we don't want to
139 // modify that stage's matrix. Otherwise if the effect is generating its sou rce rect from 139 // modify that stage's matrix. Otherwise if the effect is generating its sou rce rect from
140 // the vertex positions then we have to account for the view matrix change. 140 // the vertex positions then we have to account for the view matrix change.
141 GrDrawState::AutoViewMatrixRestore avmr; 141 GrDrawState::AutoViewMatrixRestore avmr;
142 if (!avmr.setIdentity(drawState)) { 142 if (!avmr.setIdentity(drawState)) {
143 return; 143 return;
144 } 144 }
145 145
146 size_t vstride = drawState->getVertexStride(); 146 size_t vstride = drawState->getVertexStride();
147 147
148 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom , vstride); 148 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom , vstride);
149 matrix.mapPointsWithStride(geo.positions(), vstride, 4); 149 matrix.mapPointsWithStride(geo.positions(), vstride, 4);
150 150
151 SkRect devBounds; 151 SkRect devBounds;
152 // since we already computed the dev verts, set the bounds hint. This will h elp us avoid 152 // since we already computed the dev verts, set the bounds hint. This will h elp us avoid
153 // unnecessary clipping in our onDraw(). 153 // unnecessary clipping in our onDraw().
154 get_vertex_bounds(geo.vertices(), vstride, 4, &devBounds); 154 get_vertex_bounds(geo.vertices(), vstride, 4, &devBounds);
155 155
156 if (NULL != localRect) { 156 if (localRect) {
157 static const int kLocalOffset = sizeof(SkPoint) + sizeof(GrColor); 157 static const int kLocalOffset = sizeof(SkPoint) + sizeof(GrColor);
158 SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + kLocalOffset); 158 SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + kLocalOffset);
159 coords->setRectFan(localRect->fLeft, localRect->fTop, 159 coords->setRectFan(localRect->fLeft, localRect->fTop,
160 localRect->fRight, localRect->fBottom, 160 localRect->fRight, localRect->fBottom,
161 vstride); 161 vstride);
162 if (NULL != localMatrix) { 162 if (localMatrix) {
163 localMatrix->mapPointsWithStride(coords, vstride, 4); 163 localMatrix->mapPointsWithStride(coords, vstride, 4);
164 } 164 }
165 } 165 }
166 166
167 static const int kColorOffset = sizeof(SkPoint); 167 static const int kColorOffset = sizeof(SkPoint);
168 GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + k ColorOffset); 168 GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + k ColorOffset);
169 for (int i = 0; i < 4; ++i) { 169 for (int i = 0; i < 4; ++i) {
170 *vertColor = color; 170 *vertColor = color;
171 vertColor = (GrColor*) ((intptr_t) vertColor + vstride); 171 vertColor = (GrColor*) ((intptr_t) vertColor + vstride);
172 } 172 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 281 }
282 } 282 }
283 283
284 return instancesToConcat; 284 return instancesToConcat;
285 } 285 }
286 286
287 class AutoClipReenable { 287 class AutoClipReenable {
288 public: 288 public:
289 AutoClipReenable() : fDrawState(NULL) {} 289 AutoClipReenable() : fDrawState(NULL) {}
290 ~AutoClipReenable() { 290 ~AutoClipReenable() {
291 if (NULL != fDrawState) { 291 if (fDrawState) {
292 fDrawState->enableState(GrDrawState::kClip_StateBit); 292 fDrawState->enableState(GrDrawState::kClip_StateBit);
293 } 293 }
294 } 294 }
295 void set(GrDrawState* drawState) { 295 void set(GrDrawState* drawState) {
296 if (drawState->isClipState()) { 296 if (drawState->isClipState()) {
297 fDrawState = drawState; 297 fDrawState = drawState;
298 drawState->disableState(GrDrawState::kClip_StateBit); 298 drawState->disableState(GrDrawState::kClip_StateBit);
299 } 299 }
300 } 300 }
301 private: 301 private:
302 GrDrawState* fDrawState; 302 GrDrawState* fDrawState;
303 }; 303 };
304 304
305 void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) { 305 void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) {
306 306
307 GeometryPoolState& poolState = fGeoPoolStateStack.back(); 307 GeometryPoolState& poolState = fGeoPoolStateStack.back();
308 const GrDrawState& drawState = this->getDrawState(); 308 const GrDrawState& drawState = this->getDrawState();
309 AutoClipReenable acr; 309 AutoClipReenable acr;
310 310
311 if (drawState.isClipState() && 311 if (drawState.isClipState() &&
312 NULL != info.getDevBounds() && 312 info.getDevBounds() &&
313 this->quickInsideClip(*info.getDevBounds())) { 313 this->quickInsideClip(*info.getDevBounds())) {
314 acr.set(this->drawState()); 314 acr.set(this->drawState());
315 } 315 }
316 316
317 if (this->needsNewClip()) { 317 if (this->needsNewClip()) {
318 this->recordClip(); 318 this->recordClip();
319 } 319 }
320 this->recordStateIfNecessary(); 320 this->recordStateIfNecessary();
321 321
322 DrawRecord* draw; 322 DrawRecord* draw;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 SkPath::FillType fill, const GrDeviceCoordT exture* dstCopy) { 400 SkPath::FillType fill, const GrDeviceCoordT exture* dstCopy) {
401 if (this->needsNewClip()) { 401 if (this->needsNewClip()) {
402 this->recordClip(); 402 this->recordClip();
403 } 403 }
404 // TODO: Only compare the subset of GrDrawState relevant to path covering? 404 // TODO: Only compare the subset of GrDrawState relevant to path covering?
405 this->recordStateIfNecessary(); 405 this->recordStateIfNecessary();
406 DrawPath* cp = this->recordDrawPath(); 406 DrawPath* cp = this->recordDrawPath();
407 cp->fPath.reset(path); 407 cp->fPath.reset(path);
408 path->ref(); 408 path->ref();
409 cp->fFill = fill; 409 cp->fFill = fill;
410 if (NULL != dstCopy) { 410 if (dstCopy) {
411 cp->fDstCopy = *dstCopy; 411 cp->fDstCopy = *dstCopy;
412 } 412 }
413 } 413 }
414 414
415 void GrInOrderDrawBuffer::onDrawPaths(const GrPathRange* pathRange, 415 void GrInOrderDrawBuffer::onDrawPaths(const GrPathRange* pathRange,
416 const uint32_t indices[], int count, 416 const uint32_t indices[], int count,
417 const float transforms[], PathTransformTyp e transformsType, 417 const float transforms[], PathTransformTyp e transformsType,
418 SkPath::FillType fill, const GrDeviceCoord Texture* dstCopy) { 418 SkPath::FillType fill, const GrDeviceCoord Texture* dstCopy) {
419 SkASSERT(NULL != pathRange); 419 SkASSERT(pathRange);
420 SkASSERT(NULL != indices); 420 SkASSERT(indices);
421 SkASSERT(NULL != transforms); 421 SkASSERT(transforms);
422 422
423 if (this->needsNewClip()) { 423 if (this->needsNewClip()) {
424 this->recordClip(); 424 this->recordClip();
425 } 425 }
426 this->recordStateIfNecessary(); 426 this->recordStateIfNecessary();
427 DrawPaths* dp = this->recordDrawPaths(); 427 DrawPaths* dp = this->recordDrawPaths();
428 dp->fPathRange.reset(SkRef(pathRange)); 428 dp->fPathRange.reset(SkRef(pathRange));
429 dp->fIndices = SkNEW_ARRAY(uint32_t, count); // TODO: Accomplish this withou t a malloc 429 dp->fIndices = SkNEW_ARRAY(uint32_t, count); // TODO: Accomplish this withou t a malloc
430 memcpy(dp->fIndices, indices, sizeof(uint32_t) * count); 430 memcpy(dp->fIndices, indices, sizeof(uint32_t) * count);
431 dp->fCount = count; 431 dp->fCount = count;
432 432
433 const int transformsLength = GrPathRendering::PathTransformSize(transformsTy pe) * count; 433 const int transformsLength = GrPathRendering::PathTransformSize(transformsTy pe) * count;
434 dp->fTransforms = SkNEW_ARRAY(float, transformsLength); 434 dp->fTransforms = SkNEW_ARRAY(float, transformsLength);
435 memcpy(dp->fTransforms, transforms, sizeof(float) * transformsLength); 435 memcpy(dp->fTransforms, transforms, sizeof(float) * transformsLength);
436 dp->fTransformsType = transformsType; 436 dp->fTransformsType = transformsType;
437 437
438 dp->fFill = fill; 438 dp->fFill = fill;
439 439
440 if (NULL != dstCopy) { 440 if (dstCopy) {
441 dp->fDstCopy = *dstCopy; 441 dp->fDstCopy = *dstCopy;
442 } 442 }
443 } 443 }
444 444
445 void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color, 445 void GrInOrderDrawBuffer::clear(const SkIRect* rect, GrColor color,
446 bool canIgnoreRect, GrRenderTarget* renderTarget ) { 446 bool canIgnoreRect, GrRenderTarget* renderTarget ) {
447 SkIRect r; 447 SkIRect r;
448 if (NULL == renderTarget) { 448 if (NULL == renderTarget) {
449 renderTarget = this->drawState()->getRenderTarget(); 449 renderTarget = this->drawState()->getRenderTarget();
450 SkASSERT(NULL != renderTarget); 450 SkASSERT(renderTarget);
451 } 451 }
452 if (NULL == rect) { 452 if (NULL == rect) {
453 // We could do something smart and remove previous draws and clears to 453 // We could do something smart and remove previous draws and clears to
454 // the current render target. If we get that smart we have to make sure 454 // the current render target. If we get that smart we have to make sure
455 // those draws aren't read before this clear (render-to-texture). 455 // those draws aren't read before this clear (render-to-texture).
456 r.setLTRB(0, 0, renderTarget->width(), renderTarget->height()); 456 r.setLTRB(0, 0, renderTarget->width(), renderTarget->height());
457 rect = &r; 457 rect = &r;
458 } 458 }
459 Clear* clr = this->recordClear(); 459 Clear* clr = this->recordClear();
460 GrColorIsPMAssert(color); 460 GrColorIsPMAssert(color);
461 clr->fColor = color; 461 clr->fColor = color;
462 clr->fRect = *rect; 462 clr->fRect = *rect;
463 clr->fCanIgnoreRect = canIgnoreRect; 463 clr->fCanIgnoreRect = canIgnoreRect;
464 clr->fRenderTarget = renderTarget; 464 clr->fRenderTarget = renderTarget;
465 renderTarget->ref(); 465 renderTarget->ref();
466 } 466 }
467 467
468 void GrInOrderDrawBuffer::discard(GrRenderTarget* renderTarget) { 468 void GrInOrderDrawBuffer::discard(GrRenderTarget* renderTarget) {
469 if (!this->caps()->discardRenderTargetSupport()) { 469 if (!this->caps()->discardRenderTargetSupport()) {
470 return; 470 return;
471 } 471 }
472 if (NULL == renderTarget) { 472 if (NULL == renderTarget) {
473 renderTarget = this->drawState()->getRenderTarget(); 473 renderTarget = this->drawState()->getRenderTarget();
474 SkASSERT(NULL != renderTarget); 474 SkASSERT(renderTarget);
475 } 475 }
476 Clear* clr = this->recordClear(); 476 Clear* clr = this->recordClear();
477 clr->fColor = GrColor_ILLEGAL; 477 clr->fColor = GrColor_ILLEGAL;
478 clr->fRenderTarget = renderTarget; 478 clr->fRenderTarget = renderTarget;
479 renderTarget->ref(); 479 renderTarget->ref();
480 } 480 }
481 481
482 void GrInOrderDrawBuffer::reset() { 482 void GrInOrderDrawBuffer::reset() {
483 SkASSERT(1 == fGeoPoolStateStack.count()); 483 SkASSERT(1 == fGeoPoolStateStack.count());
484 this->resetVertexSource(); 484 this->resetVertexSource();
485 this->resetIndexSource(); 485 this->resetIndexSource();
486 486
487 DrawAllocator::Iter drawIter(&fDraws); 487 DrawAllocator::Iter drawIter(&fDraws);
488 while (drawIter.next()) { 488 while (drawIter.next()) {
489 // we always have a VB, but not always an IB 489 // we always have a VB, but not always an IB
490 SkASSERT(NULL != drawIter->fVertexBuffer); 490 SkASSERT(drawIter->fVertexBuffer);
491 drawIter->fVertexBuffer->unref(); 491 drawIter->fVertexBuffer->unref();
492 SkSafeUnref(drawIter->fIndexBuffer); 492 SkSafeUnref(drawIter->fIndexBuffer);
493 } 493 }
494 fCmds.reset(); 494 fCmds.reset();
495 fDraws.reset(); 495 fDraws.reset();
496 fStencilPaths.reset(); 496 fStencilPaths.reset();
497 fDrawPath.reset(); 497 fDrawPath.reset();
498 fDrawPaths.reset(); 498 fDrawPaths.reset();
499 fStates.reset(); 499 fStates.reset();
500 fClears.reset(); 500 fClears.reset();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 case kStencilPath_Cmd: { 569 case kStencilPath_Cmd: {
570 SkASSERT(fDstGpu->drawState() != prevDrawState); 570 SkASSERT(fDstGpu->drawState() != prevDrawState);
571 SkAssertResult(stencilPathIter.next()); 571 SkAssertResult(stencilPathIter.next());
572 fDstGpu->stencilPath(stencilPathIter->fPath.get(), stencilPathIt er->fFill); 572 fDstGpu->stencilPath(stencilPathIter->fPath.get(), stencilPathIt er->fFill);
573 break; 573 break;
574 } 574 }
575 case kDrawPath_Cmd: { 575 case kDrawPath_Cmd: {
576 SkASSERT(fDstGpu->drawState() != prevDrawState); 576 SkASSERT(fDstGpu->drawState() != prevDrawState);
577 SkAssertResult(drawPathIter.next()); 577 SkAssertResult(drawPathIter.next());
578 fDstGpu->executeDrawPath(drawPathIter->fPath.get(), drawPathIter ->fFill, 578 fDstGpu->executeDrawPath(drawPathIter->fPath.get(), drawPathIter ->fFill,
579 NULL != drawPathIter->fDstCopy.texture( ) ? 579 drawPathIter->fDstCopy.texture() ?
580 &drawPathIter->fDstCopy : 580 &drawPathIter->fDstCopy :
581 NULL); 581 NULL);
582 break; 582 break;
583 } 583 }
584 case kDrawPaths_Cmd: { 584 case kDrawPaths_Cmd: {
585 SkASSERT(fDstGpu->drawState() != prevDrawState); 585 SkASSERT(fDstGpu->drawState() != prevDrawState);
586 SkAssertResult(drawPathsIter.next()); 586 SkAssertResult(drawPathsIter.next());
587 const GrDeviceCoordTexture* dstCopy = 587 const GrDeviceCoordTexture* dstCopy =
588 NULL !=drawPathsIter->fDstCopy.texture() ? &drawPathsIter->f DstCopy : NULL; 588 drawPathsIter->fDstCopy.texture() ? &drawPathsIter->fDstCopy : NULL;
589 fDstGpu->executeDrawPaths(drawPathsIter->fPathRange.get(), 589 fDstGpu->executeDrawPaths(drawPathsIter->fPathRange.get(),
590 drawPathsIter->fIndices, 590 drawPathsIter->fIndices,
591 drawPathsIter->fCount, 591 drawPathsIter->fCount,
592 drawPathsIter->fTransforms, 592 drawPathsIter->fTransforms,
593 drawPathsIter->fTransformsType, 593 drawPathsIter->fTransformsType,
594 drawPathsIter->fFill, 594 drawPathsIter->fFill,
595 dstCopy); 595 dstCopy);
596 break; 596 break;
597 } 597 }
598 case kSetState_Cmd: 598 case kSetState_Cmd:
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 this->flush(); 708 this->flush();
709 } 709 }
710 } 710 }
711 711
712 bool GrInOrderDrawBuffer::geometryHints(int* vertexCount, 712 bool GrInOrderDrawBuffer::geometryHints(int* vertexCount,
713 int* indexCount) const { 713 int* indexCount) const {
714 // we will recommend a flush if the data could fit in a single 714 // we will recommend a flush if the data could fit in a single
715 // preallocated buffer but none are left and it can't fit 715 // preallocated buffer but none are left and it can't fit
716 // in the current buffer (which may not be prealloced). 716 // in the current buffer (which may not be prealloced).
717 bool flush = false; 717 bool flush = false;
718 if (NULL != indexCount) { 718 if (indexCount) {
719 int32_t currIndices = fIndexPool.currentBufferIndices(); 719 int32_t currIndices = fIndexPool.currentBufferIndices();
720 if (*indexCount > currIndices && 720 if (*indexCount > currIndices &&
721 (!fIndexPool.preallocatedBuffersRemaining() && 721 (!fIndexPool.preallocatedBuffersRemaining() &&
722 *indexCount <= fIndexPool.preallocatedBufferIndices())) { 722 *indexCount <= fIndexPool.preallocatedBufferIndices())) {
723 723
724 flush = true; 724 flush = true;
725 } 725 }
726 *indexCount = currIndices; 726 *indexCount = currIndices;
727 } 727 }
728 if (NULL != vertexCount) { 728 if (vertexCount) {
729 size_t vertexStride = this->getDrawState().getVertexStride(); 729 size_t vertexStride = this->getDrawState().getVertexStride();
730 int32_t currVertices = fVertexPool.currentBufferVertices(vertexStride); 730 int32_t currVertices = fVertexPool.currentBufferVertices(vertexStride);
731 if (*vertexCount > currVertices && 731 if (*vertexCount > currVertices &&
732 (!fVertexPool.preallocatedBuffersRemaining() && 732 (!fVertexPool.preallocatedBuffersRemaining() &&
733 *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexStride ))) { 733 *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexStride ))) {
734 734
735 flush = true; 735 flush = true;
736 } 736 }
737 *vertexCount = currVertices; 737 *vertexCount = currVertices;
738 } 738 }
739 return flush; 739 return flush;
740 } 740 }
741 741
742 bool GrInOrderDrawBuffer::onReserveVertexSpace(size_t vertexSize, 742 bool GrInOrderDrawBuffer::onReserveVertexSpace(size_t vertexSize,
743 int vertexCount, 743 int vertexCount,
744 void** vertices) { 744 void** vertices) {
745 GeometryPoolState& poolState = fGeoPoolStateStack.back(); 745 GeometryPoolState& poolState = fGeoPoolStateStack.back();
746 SkASSERT(vertexCount > 0); 746 SkASSERT(vertexCount > 0);
747 SkASSERT(NULL != vertices); 747 SkASSERT(vertices);
748 SkASSERT(0 == poolState.fUsedPoolVertexBytes); 748 SkASSERT(0 == poolState.fUsedPoolVertexBytes);
749 749
750 *vertices = fVertexPool.makeSpace(vertexSize, 750 *vertices = fVertexPool.makeSpace(vertexSize,
751 vertexCount, 751 vertexCount,
752 &poolState.fPoolVertexBuffer, 752 &poolState.fPoolVertexBuffer,
753 &poolState.fPoolStartVertex); 753 &poolState.fPoolStartVertex);
754 return NULL != *vertices; 754 return SkToBool(*vertices);
755 } 755 }
756 756
757 bool GrInOrderDrawBuffer::onReserveIndexSpace(int indexCount, void** indices) { 757 bool GrInOrderDrawBuffer::onReserveIndexSpace(int indexCount, void** indices) {
758 GeometryPoolState& poolState = fGeoPoolStateStack.back(); 758 GeometryPoolState& poolState = fGeoPoolStateStack.back();
759 SkASSERT(indexCount > 0); 759 SkASSERT(indexCount > 0);
760 SkASSERT(NULL != indices); 760 SkASSERT(indices);
761 SkASSERT(0 == poolState.fUsedPoolIndexBytes); 761 SkASSERT(0 == poolState.fUsedPoolIndexBytes);
762 762
763 *indices = fIndexPool.makeSpace(indexCount, 763 *indices = fIndexPool.makeSpace(indexCount,
764 &poolState.fPoolIndexBuffer, 764 &poolState.fPoolIndexBuffer,
765 &poolState.fPoolStartIndex); 765 &poolState.fPoolStartIndex);
766 return NULL != *indices; 766 return SkToBool(*indices);
767 } 767 }
768 768
769 void GrInOrderDrawBuffer::releaseReservedVertexSpace() { 769 void GrInOrderDrawBuffer::releaseReservedVertexSpace() {
770 GeometryPoolState& poolState = fGeoPoolStateStack.back(); 770 GeometryPoolState& poolState = fGeoPoolStateStack.back();
771 const GeometrySrcState& geoSrc = this->getGeomSrc(); 771 const GeometrySrcState& geoSrc = this->getGeomSrc();
772 772
773 // If we get a release vertex space call then our current source should eith er be reserved 773 // If we get a release vertex space call then our current source should eith er be reserved
774 // or array (which we copied into reserved space). 774 // or array (which we copied into reserved space).
775 SkASSERT(kReserved_GeometrySrcType == geoSrc.fVertexSrc || 775 SkASSERT(kReserved_GeometrySrcType == geoSrc.fVertexSrc ||
776 kArray_GeometrySrcType == geoSrc.fVertexSrc); 776 kArray_GeometrySrcType == geoSrc.fVertexSrc);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 GrInOrderDrawBuffer::CopySurface* GrInOrderDrawBuffer::recordCopySurface() { 958 GrInOrderDrawBuffer::CopySurface* GrInOrderDrawBuffer::recordCopySurface() {
959 this->addToCmdBuffer(kCopySurface_Cmd); 959 this->addToCmdBuffer(kCopySurface_Cmd);
960 return &fCopySurfaces.push_back(); 960 return &fCopySurfaces.push_back();
961 } 961 }
962 962
963 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { 963 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) {
964 INHERITED::clipWillBeSet(newClipData); 964 INHERITED::clipWillBeSet(newClipData);
965 fClipSet = true; 965 fClipSet = true;
966 fClipProxyState = kUnknown_ClipProxyState; 966 fClipProxyState = kUnknown_ClipProxyState;
967 } 967 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpuResource.cpp ('k') | src/gpu/GrLayerCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698