| 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 | 9 |
| 10 #include "GrGpuResource.h" | 10 #include "GrGpuResource.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 void GrGpuResource::abandon() { | 51 void GrGpuResource::abandon() { |
| 52 SkASSERT(fGpu); | 52 SkASSERT(fGpu); |
| 53 this->onAbandon(); | 53 this->onAbandon(); |
| 54 get_resource_cache2(fGpu)->resourceAccess().removeResource(this); | 54 get_resource_cache2(fGpu)->resourceAccess().removeResource(this); |
| 55 fGpu = NULL; | 55 fGpu = NULL; |
| 56 fGpuMemorySize = 0; | 56 fGpuMemorySize = 0; |
| 57 } | 57 } |
| 58 | 58 |
| 59 const SkData* GrGpuResource::setCustomData(const SkData* data) { |
| 60 SkSafeRef(data); |
| 61 fData.reset(data); |
| 62 return data; |
| 63 } |
| 64 |
| 59 const GrContext* GrGpuResource::getContext() const { | 65 const GrContext* GrGpuResource::getContext() const { |
| 60 if (fGpu) { | 66 if (fGpu) { |
| 61 return fGpu->getContext(); | 67 return fGpu->getContext(); |
| 62 } else { | 68 } else { |
| 63 return NULL; | 69 return NULL; |
| 64 } | 70 } |
| 65 } | 71 } |
| 66 | 72 |
| 67 GrContext* GrGpuResource::getContext() { | 73 GrContext* GrGpuResource::getContext() { |
| 68 if (fGpu) { | 74 if (fGpu) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 uint32_t oldFlags = fFlags; | 160 uint32_t oldFlags = fFlags; |
| 155 if (countsAgainstBudget) { | 161 if (countsAgainstBudget) { |
| 156 fFlags |= kBudgeted_Flag; | 162 fFlags |= kBudgeted_Flag; |
| 157 } else { | 163 } else { |
| 158 fFlags &= ~kBudgeted_Flag; | 164 fFlags &= ~kBudgeted_Flag; |
| 159 } | 165 } |
| 160 if (fFlags != oldFlags) { | 166 if (fFlags != oldFlags) { |
| 161 get_resource_cache2(fGpu)->resourceAccess().didChangeBudgetStatus(this); | 167 get_resource_cache2(fGpu)->resourceAccess().didChangeBudgetStatus(this); |
| 162 } | 168 } |
| 163 } | 169 } |
| OLD | NEW |