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 "GrLayerAtlas.h" | 8 #include "GrLayerAtlas.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 for (; !iter.done(); ++iter) { | 91 for (; !iter.done(); ++iter) { |
92 GrCachedLayer* layer = &(*iter); | 92 GrCachedLayer* layer = &(*iter); |
93 SkASSERT(0 == layer->uses()); | 93 SkASSERT(0 == layer->uses()); |
94 this->unlock(layer); | 94 this->unlock(layer); |
95 delete layer; | 95 delete layer; |
96 } | 96 } |
97 | 97 |
98 SkASSERT(0 == fPictureHash.count()); | 98 SkASSERT(0 == fPictureHash.count()); |
99 | 99 |
100 // The atlas only lets go of its texture when the atlas is deleted. | 100 // The atlas only lets go of its texture when the atlas is deleted. |
101 fAtlas.reset(); | 101 fAtlas.free(); |
102 } | 102 } |
103 | 103 |
104 void GrLayerCache::initAtlas() { | 104 void GrLayerCache::initAtlas() { |
105 SkASSERT(nullptr == fAtlas.get()); | 105 SkASSERT(nullptr == fAtlas.get()); |
106 GR_STATIC_ASSERT(kNumPlotsX*kNumPlotsX == GrPictureInfo::kNumPlots); | 106 GR_STATIC_ASSERT(kNumPlotsX*kNumPlotsX == GrPictureInfo::kNumPlots); |
107 | 107 |
108 SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight)
; | 108 SkISize textureSize = SkISize::Make(kAtlasTextureWidth, kAtlasTextureHeight)
; |
109 fAtlas.reset(new GrLayerAtlas(fContext->textureProvider(), kSkia8888_GrPixel
Config, | 109 fAtlas.reset(new GrLayerAtlas(fContext->textureProvider(), kSkia8888_GrPixel
Config, |
110 kRenderTarget_GrSurfaceFlag, textureSize, | 110 kRenderTarget_GrSurfaceFlag, textureSize, |
111 kNumPlotsX, kNumPlotsY)); | 111 kNumPlotsX, kNumPlotsY)); |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 fileName.appendf("\\%d", layer->fKey.pictureID()); | 548 fileName.appendf("\\%d", layer->fKey.pictureID()); |
549 for (int i = 0; i < layer->fKey.keySize(); ++i) { | 549 for (int i = 0; i < layer->fKey.keySize(); ++i) { |
550 fileName.appendf("-%d", layer->fKey.key()[i]); | 550 fileName.appendf("-%d", layer->fKey.key()[i]); |
551 } | 551 } |
552 fileName.appendf(".png"); | 552 fileName.appendf(".png"); |
553 | 553 |
554 layer->texture()->surfacePriv().savePixels(fileName.c_str()); | 554 layer->texture()->surfacePriv().savePixels(fileName.c_str()); |
555 } | 555 } |
556 } | 556 } |
557 #endif | 557 #endif |
OLD | NEW |