| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 GrContext* GrGpuResource::getContext() { | 74 GrContext* GrGpuResource::getContext() { |
| 75 if (fGpu) { | 75 if (fGpu) { |
| 76 return fGpu->getContext(); | 76 return fGpu->getContext(); |
| 77 } else { | 77 } else { |
| 78 return NULL; | 78 return NULL; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool GrGpuResource::setContentKey(const GrResourceKey& contentKey) { | 82 bool GrGpuResource::setContentKey(const GrResourceKey& contentKey) { |
| 83 // Currently this can only be called once and can't be called when the resou
rce is scratch. |
| 83 SkASSERT(!contentKey.isScratch()); | 84 SkASSERT(!contentKey.isScratch()); |
| 84 // Currently this can only be called once and can't be called when the resou
rce is scratch. | |
| 85 SkASSERT(this->internalHasRef()); | 85 SkASSERT(this->internalHasRef()); |
| 86 SkASSERT(!this->internalHasPendingIO()); | |
| 87 | 86 |
| 88 if (fContentKeySet) { | 87 if (fContentKeySet) { |
| 89 return false; | 88 return false; |
| 90 } | 89 } |
| 91 | 90 |
| 92 fContentKey = contentKey; | 91 fContentKey = contentKey; |
| 93 fContentKeySet = true; | 92 fContentKeySet = true; |
| 94 | 93 |
| 95 if (!get_resource_cache2(fGpu)->didSetContentKey(this)) { | 94 if (!get_resource_cache2(fGpu)->didSetContentKey(this)) { |
| 96 fContentKeySet = false; | 95 fContentKeySet = false; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 130 } |
| 132 | 131 |
| 133 uint32_t GrGpuResource::CreateUniqueID() { | 132 uint32_t GrGpuResource::CreateUniqueID() { |
| 134 static int32_t gUniqueID = SK_InvalidUniqueID; | 133 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 135 uint32_t id; | 134 uint32_t id; |
| 136 do { | 135 do { |
| 137 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 136 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 138 } while (id == SK_InvalidUniqueID); | 137 } while (id == SK_InvalidUniqueID); |
| 139 return id; | 138 return id; |
| 140 } | 139 } |
| OLD | NEW |