| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 GrGpu::~GrGpu() { | 52 GrGpu::~GrGpu() { |
| 53 this->releaseResources(); | 53 this->releaseResources(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void GrGpu::abandonResources() { | 56 void GrGpu::abandonResources() { |
| 57 | 57 |
| 58 fClipMaskManager.releaseResources(); | 58 fClipMaskManager.releaseResources(); |
| 59 | 59 |
| 60 while (NULL != fResourceList.head()) { | 60 while (NULL != fObjectList.head()) { |
| 61 fResourceList.head()->abandon(); | 61 fObjectList.head()->abandon(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); | 64 SkASSERT(NULL == fQuadIndexBuffer || fQuadIndexBuffer->wasDestroyed()); |
| 65 SkSafeSetNull(fQuadIndexBuffer); | 65 SkSafeSetNull(fQuadIndexBuffer); |
| 66 delete fVertexPool; | 66 delete fVertexPool; |
| 67 fVertexPool = NULL; | 67 fVertexPool = NULL; |
| 68 delete fIndexPool; | 68 delete fIndexPool; |
| 69 fIndexPool = NULL; | 69 fIndexPool = NULL; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void GrGpu::releaseResources() { | 72 void GrGpu::releaseResources() { |
| 73 | 73 |
| 74 fClipMaskManager.releaseResources(); | 74 fClipMaskManager.releaseResources(); |
| 75 | 75 |
| 76 while (NULL != fResourceList.head()) { | 76 while (NULL != fObjectList.head()) { |
| 77 fResourceList.head()->release(); | 77 fObjectList.head()->release(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid()); | 80 SkASSERT(NULL == fQuadIndexBuffer || fQuadIndexBuffer->wasDestroyed()); |
| 81 SkSafeSetNull(fQuadIndexBuffer); | 81 SkSafeSetNull(fQuadIndexBuffer); |
| 82 delete fVertexPool; | 82 delete fVertexPool; |
| 83 fVertexPool = NULL; | 83 fVertexPool = NULL; |
| 84 delete fIndexPool; | 84 delete fIndexPool; |
| 85 fIndexPool = NULL; | 85 fIndexPool = NULL; |
| 86 } | 86 } |
| 87 | 87 |
| 88 void GrGpu::insertResource(GrResource* resource) { | 88 void GrGpu::insertObject(GrGpuObject* object) { |
| 89 SkASSERT(NULL != resource); | 89 SkASSERT(NULL != object); |
| 90 SkASSERT(this == resource->getGpu()); | 90 SkASSERT(this == object->getGpu()); |
| 91 | 91 |
| 92 fResourceList.addToHead(resource); | 92 fObjectList.addToHead(object); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void GrGpu::removeResource(GrResource* resource) { | 95 void GrGpu::removeObject(GrGpuObject* object) { |
| 96 SkASSERT(NULL != resource); | 96 SkASSERT(NULL != object); |
| 97 SkASSERT(this == resource->getGpu()); | 97 SkASSERT(this == object->getGpu()); |
| 98 | 98 |
| 99 fResourceList.remove(resource); | 99 fObjectList.remove(object); |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 void GrGpu::unimpl(const char msg[]) { | 103 void GrGpu::unimpl(const char msg[]) { |
| 104 #ifdef SK_DEBUG | 104 #ifdef SK_DEBUG |
| 105 GrPrintf("--- GrGpu unimplemented(\"%s\")\n", msg); | 105 GrPrintf("--- GrGpu unimplemented(\"%s\")\n", msg); |
| 106 #endif | 106 #endif |
| 107 } | 107 } |
| 108 | 108 |
| 109 //////////////////////////////////////////////////////////////////////////////// | 109 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 } | 550 } |
| 551 | 551 |
| 552 void GrGpu::releaseIndexArray() { | 552 void GrGpu::releaseIndexArray() { |
| 553 // if index source was array, we stowed data in the pool | 553 // if index source was array, we stowed data in the pool |
| 554 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 554 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
| 555 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 555 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
| 556 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 556 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
| 557 fIndexPool->putBack(bytes); | 557 fIndexPool->putBack(bytes); |
| 558 --fIndexPoolUseCnt; | 558 --fIndexPoolUseCnt; |
| 559 } | 559 } |
| OLD | NEW |