| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 // There is no need to call our notifyAllCntsAreZero function at this point
since we already | 139 // There is no need to call our notifyAllCntsAreZero function at this point
since we already |
| 140 // told the cache about the state of cnts. | 140 // told the cache about the state of cnts. |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) { | 144 void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) { |
| 145 SkASSERT(!fScratchKey.isValid()); | 145 SkASSERT(!fScratchKey.isValid()); |
| 146 SkASSERT(scratchKey.isValid()); | 146 SkASSERT(scratchKey.isValid()); |
| 147 // Wrapped resources can never have a scratch key. | 147 // Wrapped resources can never have a scratch key. |
| 148 if (this->isWrapped()) { | 148 if (this->cacheAccess().isExternal()) { |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 fScratchKey = scratchKey; | 151 fScratchKey = scratchKey; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void GrGpuResource::removeScratchKey() { | 154 void GrGpuResource::removeScratchKey() { |
| 155 if (!this->wasDestroyed() && fScratchKey.isValid()) { | 155 if (!this->wasDestroyed() && fScratchKey.isValid()) { |
| 156 get_resource_cache(fGpu)->resourceAccess().willRemoveScratchKey(this); | 156 get_resource_cache(fGpu)->resourceAccess().willRemoveScratchKey(this); |
| 157 fScratchKey.reset(); | 157 fScratchKey.reset(); |
| 158 } | 158 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 uint32_t GrGpuResource::CreateUniqueID() { | 175 uint32_t GrGpuResource::CreateUniqueID() { |
| 176 static int32_t gUniqueID = SK_InvalidUniqueID; | 176 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 177 uint32_t id; | 177 uint32_t id; |
| 178 do { | 178 do { |
| 179 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 179 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 180 } while (id == SK_InvalidUniqueID); | 180 } while (id == SK_InvalidUniqueID); |
| 181 return id; | 181 return id; |
| 182 } | 182 } |
| OLD | NEW |