| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) { | 97 void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) { |
| 98 SkASSERT(fScratchKey.isNullScratch()); | 98 SkASSERT(fScratchKey.isNullScratch()); |
| 99 SkASSERT(scratchKey.isScratch()); | 99 SkASSERT(scratchKey.isScratch()); |
| 100 SkASSERT(!scratchKey.isNullScratch()); | 100 SkASSERT(!scratchKey.isNullScratch()); |
| 101 fScratchKey = scratchKey; | 101 fScratchKey = scratchKey; |
| 102 } | 102 } |
| 103 | 103 |
| 104 const GrResourceKey* GrGpuResource::getContentKey() const { | |
| 105 if (fCacheEntry && !fCacheEntry->key().isScratch()) { | |
| 106 return &fCacheEntry->key(); | |
| 107 } | |
| 108 return NULL; | |
| 109 } | |
| 110 | |
| 111 uint32_t GrGpuResource::CreateUniqueID() { | 104 uint32_t GrGpuResource::CreateUniqueID() { |
| 112 static int32_t gUniqueID = SK_InvalidUniqueID; | 105 static int32_t gUniqueID = SK_InvalidUniqueID; |
| 113 uint32_t id; | 106 uint32_t id; |
| 114 do { | 107 do { |
| 115 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 108 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
| 116 } while (id == SK_InvalidUniqueID); | 109 } while (id == SK_InvalidUniqueID); |
| 117 return id; | 110 return id; |
| 118 } | 111 } |
| OLD | NEW |