| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // There is no need to call our notifyAllCntsAreZero function at this point
since we already | 163 // There is no need to call our notifyAllCntsAreZero function at this point
since we already |
| 164 // told the cache about the state of cnts. | 164 // told the cache about the state of cnts. |
| 165 return false; | 165 return false; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) { | 168 void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) { |
| 169 SkASSERT(!fScratchKey.isValid()); | 169 SkASSERT(!fScratchKey.isValid()); |
| 170 SkASSERT(scratchKey.isValid()); | 170 SkASSERT(scratchKey.isValid()); |
| 171 // Wrapped resources can never have a scratch key. | 171 // Wrapped resources can never have a scratch key. |
| 172 if (this->cacheAccess().isExternal()) { | 172 if (this->resourcePriv().isExternal()) { |
| 173 return; | 173 return; |
| 174 } | 174 } |
| 175 fScratchKey = scratchKey; | 175 fScratchKey = scratchKey; |
| 176 } | 176 } |
| 177 | 177 |
| 178 void GrGpuResource::removeScratchKey() { | 178 void GrGpuResource::removeScratchKey() { |
| 179 if (!this->wasDestroyed() && fScratchKey.isValid()) { | 179 if (!this->wasDestroyed() && fScratchKey.isValid()) { |
| 180 get_resource_cache(fGpu)->resourceAccess().willRemoveScratchKey(this); | 180 get_resource_cache(fGpu)->resourceAccess().willRemoveScratchKey(this); |
| 181 fScratchKey.reset(); | 181 fScratchKey.reset(); |
| 182 } | 182 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 uint32_t GrGpuResource::CreateUniqueID() { | 200 uint32_t GrGpuResource::CreateUniqueID() { |
| 201 static int32_t gUniqueID = SK_InvalidUniqueID; | 201 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 202 uint32_t id; | 202 uint32_t id; |
| 203 do { | 203 do { |
| 204 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 204 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 205 } while (id == SK_InvalidUniqueID); | 205 } while (id == SK_InvalidUniqueID); |
| 206 return id; | 206 return id; |
| 207 } | 207 } |
| OLD | NEW |