| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "GrGpuResource.h" | 9 #include "GrGpuResource.h" |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (this->isPurgeable()) { | 66 if (this->isPurgeable()) { |
| 67 traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size", "b
ytes", | 67 traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size", "b
ytes", |
| 68 this->gpuMemorySize()); | 68 this->gpuMemorySize()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Call setMemoryBacking to allow sub-classes with implementation specific b
ackings (such as GL | 71 // Call setMemoryBacking to allow sub-classes with implementation specific b
ackings (such as GL |
| 72 // objects) to provide additional information. | 72 // objects) to provide additional information. |
| 73 this->setMemoryBacking(traceMemoryDump, dumpName); | 73 this->setMemoryBacking(traceMemoryDump, dumpName); |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool GrGpuResource::reuseable() const { |
| 77 return true; |
| 78 } |
| 79 |
| 76 const SkData* GrGpuResource::setCustomData(const SkData* data) { | 80 const SkData* GrGpuResource::setCustomData(const SkData* data) { |
| 77 SkSafeRef(data); | 81 SkSafeRef(data); |
| 78 fData.reset(data); | 82 fData.reset(data); |
| 79 return data; | 83 return data; |
| 80 } | 84 } |
| 81 | 85 |
| 82 const GrContext* GrGpuResource::getContext() const { | 86 const GrContext* GrGpuResource::getContext() const { |
| 83 if (fGpu) { | 87 if (fGpu) { |
| 84 return fGpu->getContext(); | 88 return fGpu->getContext(); |
| 85 } else { | 89 } else { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 202 } |
| 199 | 203 |
| 200 uint32_t GrGpuResource::CreateUniqueID() { | 204 uint32_t GrGpuResource::CreateUniqueID() { |
| 201 static int32_t gUniqueID = SK_InvalidUniqueID; | 205 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 202 uint32_t id; | 206 uint32_t id; |
| 203 do { | 207 do { |
| 204 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 208 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 205 } while (id == SK_InvalidUniqueID); | 209 } while (id == SK_InvalidUniqueID); |
| 206 return id; | 210 return id; |
| 207 } | 211 } |
| OLD | NEW |