| 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(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void GrLayerCache::initAtlas() { | 53 void GrLayerCache::initAtlas() { |
| 53 static const int kAtlasTextureWidth = 1024; | 54 static const int kAtlasTextureWidth = 1024; |
| 54 static const int kAtlasTextureHeight = 1024; | 55 static const int kAtlasTextureHeight = 1024; |
| 55 | 56 |
| 56 SkASSERT(NULL == fAtlas.get()); | 57 SkASSERT(NULL == fAtlas.get()); |
| 57 | 58 |
| 58 // The layer cache only gets 1 plot | 59 // The layer cache only gets 1 plot |
| 59 SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight)
; | 60 SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight)
; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 164 } |
| 164 } | 165 } |
| 165 | 166 |
| 166 for (int i = 0; i < toBeRemoved.count(); ++i) { | 167 for (int i = 0; i < toBeRemoved.count(); ++i) { |
| 167 this->unlock(toBeRemoved[i]); | 168 this->unlock(toBeRemoved[i]); |
| 168 | 169 |
| 169 PictureLayerKey key(picture->uniqueID(), toBeRemoved[i]->layerID()); | 170 PictureLayerKey key(picture->uniqueID(), toBeRemoved[i]->layerID()); |
| 170 fLayerHash.remove(key, toBeRemoved[i]); | 171 fLayerHash.remove(key, toBeRemoved[i]); |
| 171 } | 172 } |
| 172 } | 173 } |
| OLD | NEW |