| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrTextureStripAtlas_DEFINED | 8 #ifndef GrTextureStripAtlas_DEFINED |
| 9 #define GrTextureStripAtlas_DEFINED | 9 #define GrTextureStripAtlas_DEFINED |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // Hash table entry for atlases | 140 // Hash table entry for atlases |
| 141 class AtlasEntry : public ::SkNoncopyable { | 141 class AtlasEntry : public ::SkNoncopyable { |
| 142 public: | 142 public: |
| 143 // for SkTDynamicHash | 143 // for SkTDynamicHash |
| 144 static const Desc& GetKey(const AtlasEntry& entry) { return entry.fDesc;
} | 144 static const Desc& GetKey(const AtlasEntry& entry) { return entry.fDesc;
} |
| 145 static uint32_t Hash(const Desc& desc) { return SkChecksum::Murmur3(&des
c, sizeof(Desc)); } | 145 static uint32_t Hash(const Desc& desc) { return SkChecksum::Murmur3(&des
c, sizeof(Desc)); } |
| 146 | 146 |
| 147 // AtlasEntry proper | 147 // AtlasEntry proper |
| 148 AtlasEntry() : fAtlas(NULL) {} | 148 AtlasEntry() : fAtlas(NULL) {} |
| 149 ~AtlasEntry() { SkDELETE(fAtlas); } | 149 ~AtlasEntry() { delete fAtlas; } |
| 150 Desc fDesc; | 150 Desc fDesc; |
| 151 GrTextureStripAtlas* fAtlas; | 151 GrTextureStripAtlas* fAtlas; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 class Hash; | 154 class Hash; |
| 155 static Hash* gAtlasCache; | 155 static Hash* gAtlasCache; |
| 156 | 156 |
| 157 static Hash* GetCache(); | 157 static Hash* GetCache(); |
| 158 | 158 |
| 159 // We increment gCacheCount for each atlas | 159 // We increment gCacheCount for each atlas |
| (...skipping 20 matching lines...) Expand all Loading... |
| 180 // Head and tail for linked list of least-recently-used rows (front = least
recently used). | 180 // Head and tail for linked list of least-recently-used rows (front = least
recently used). |
| 181 // Note that when a texture is locked, it gets removed from this list until
it is unlocked. | 181 // Note that when a texture is locked, it gets removed from this list until
it is unlocked. |
| 182 AtlasRow* fLRUFront; | 182 AtlasRow* fLRUFront; |
| 183 AtlasRow* fLRUBack; | 183 AtlasRow* fLRUBack; |
| 184 | 184 |
| 185 // A list of pointers to AtlasRows that currently contain cached images, sor
ted by key | 185 // A list of pointers to AtlasRows that currently contain cached images, sor
ted by key |
| 186 SkTDArray<AtlasRow*> fKeyTable; | 186 SkTDArray<AtlasRow*> fKeyTable; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 #endif | 189 #endif |
| OLD | NEW |