OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "GrAtlas.h" | 8 #include "GrAtlas.h" |
9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
10 #include "GrLayerCache.h" | 10 #include "GrLayerCache.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 uint32_t fPictureID; | 40 uint32_t fPictureID; |
41 int fLayerID; | 41 int fLayerID; |
42 }; | 42 }; |
43 | 43 |
44 GrLayerCache::GrLayerCache(GrContext* context) | 44 GrLayerCache::GrLayerCache(GrContext* context) |
45 : fContext(context) { | 45 : fContext(context) { |
46 this->initAtlas(); | 46 this->initAtlas(); |
47 } | 47 } |
48 | 48 |
49 GrLayerCache::~GrLayerCache() { | 49 GrLayerCache::~GrLayerCache() { |
50 this->freeAll(); | |
51 } | 50 } |
52 | 51 |
53 void GrLayerCache::initAtlas() { | 52 void GrLayerCache::initAtlas() { |
54 static const int kAtlasTextureWidth = 1024; | 53 static const int kAtlasTextureWidth = 1024; |
55 static const int kAtlasTextureHeight = 1024; | 54 static const int kAtlasTextureHeight = 1024; |
56 | 55 |
57 SkASSERT(NULL == fAtlas.get()); | 56 SkASSERT(NULL == fAtlas.get()); |
58 | 57 |
59 // The layer cache only gets 1 plot | 58 // The layer cache only gets 1 plot |
60 SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight)
; | 59 SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight)
; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 163 } |
165 } | 164 } |
166 | 165 |
167 for (int i = 0; i < toBeRemoved.count(); ++i) { | 166 for (int i = 0; i < toBeRemoved.count(); ++i) { |
168 this->unlock(toBeRemoved[i]); | 167 this->unlock(toBeRemoved[i]); |
169 | 168 |
170 PictureLayerKey key(picture->uniqueID(), toBeRemoved[i]->layerID()); | 169 PictureLayerKey key(picture->uniqueID(), toBeRemoved[i]->layerID()); |
171 fLayerHash.remove(key, toBeRemoved[i]); | 170 fLayerHash.remove(key, toBeRemoved[i]); |
172 } | 171 } |
173 } | 172 } |
OLD | NEW |