OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 void GrGpu::abandonResources() { | 60 void GrGpu::abandonResources() { |
61 | 61 |
62 fClipMaskManager.releaseResources(); | 62 fClipMaskManager.releaseResources(); |
63 | 63 |
64 while (NULL != fResourceList.head()) { | 64 while (NULL != fResourceList.head()) { |
65 fResourceList.head()->abandon(); | 65 fResourceList.head()->abandon(); |
66 } | 66 } |
67 | 67 |
68 SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); | 68 SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); |
69 GrSafeSetNull(fQuadIndexBuffer); | 69 SkSafeSetNull(fQuadIndexBuffer); |
70 delete fVertexPool; | 70 delete fVertexPool; |
71 fVertexPool = NULL; | 71 fVertexPool = NULL; |
72 delete fIndexPool; | 72 delete fIndexPool; |
73 fIndexPool = NULL; | 73 fIndexPool = NULL; |
74 } | 74 } |
75 | 75 |
76 void GrGpu::releaseResources() { | 76 void GrGpu::releaseResources() { |
77 | 77 |
78 fClipMaskManager.releaseResources(); | 78 fClipMaskManager.releaseResources(); |
79 | 79 |
80 while (NULL != fResourceList.head()) { | 80 while (NULL != fResourceList.head()) { |
81 fResourceList.head()->release(); | 81 fResourceList.head()->release(); |
82 } | 82 } |
83 | 83 |
84 SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); | 84 SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); |
85 GrSafeSetNull(fQuadIndexBuffer); | 85 SkSafeSetNull(fQuadIndexBuffer); |
86 delete fVertexPool; | 86 delete fVertexPool; |
87 fVertexPool = NULL; | 87 fVertexPool = NULL; |
88 delete fIndexPool; | 88 delete fIndexPool; |
89 fIndexPool = NULL; | 89 fIndexPool = NULL; |
90 } | 90 } |
91 | 91 |
92 void GrGpu::insertResource(GrResource* resource) { | 92 void GrGpu::insertResource(GrResource* resource) { |
93 SkASSERT(NULL != resource); | 93 SkASSERT(NULL != resource); |
94 SkASSERT(this == resource->getGpu()); | 94 SkASSERT(this == resource->getGpu()); |
95 | 95 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 | 492 |
493 void GrGpu::releaseIndexArray() { | 493 void GrGpu::releaseIndexArray() { |
494 // if index source was array, we stowed data in the pool | 494 // if index source was array, we stowed data in the pool |
495 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 495 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
496 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 496 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
497 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 497 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
498 fIndexPool->putBack(bytes); | 498 fIndexPool->putBack(bytes); |
499 --fIndexPoolUseCnt; | 499 --fIndexPoolUseCnt; |
500 } | 500 } |
OLD | NEW |