| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 return layer; | 158 return layer; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool GrLayerCache::tryToAtlas(GrCachedLayer* layer, | 161 bool GrLayerCache::tryToAtlas(GrCachedLayer* layer, |
| 162 const GrSurfaceDesc& desc, | 162 const GrSurfaceDesc& desc, |
| 163 bool* needsRendering) { | 163 bool* needsRendering) { |
| 164 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas ? fAtlas->getTexture() : NULL, la
yer);) | 164 SkDEBUGCODE(GrAutoValidateLayer avl(fAtlas ? fAtlas->getTexture() : NULL, la
yer);) |
| 165 | 165 |
| 166 SkASSERT(PlausiblyAtlasable(desc.fWidth, desc.fHeight)); | 166 SkASSERT(PlausiblyAtlasable(desc.fWidth, desc.fHeight)); |
| 167 SkASSERT(0 == desc.fSampleCnt); |
| 167 | 168 |
| 168 if (layer->locked()) { | 169 if (layer->locked()) { |
| 169 // This layer is already locked | 170 // This layer is already locked |
| 170 SkASSERT(fAtlas); | 171 SkASSERT(fAtlas); |
| 171 SkASSERT(layer->isAtlased()); | 172 SkASSERT(layer->isAtlased()); |
| 172 SkASSERT(layer->rect().width() == desc.fWidth); | 173 SkASSERT(layer->rect().width() == desc.fWidth); |
| 173 SkASSERT(layer->rect().height() == desc.fHeight); | 174 SkASSERT(layer->rect().height() == desc.fHeight); |
| 174 *needsRendering = false; | 175 *needsRendering = false; |
| 175 return true; | 176 return true; |
| 176 } | 177 } |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 continue; | 501 continue; |
| 501 } | 502 } |
| 502 | 503 |
| 503 SkString fileName(dirName); | 504 SkString fileName(dirName); |
| 504 fileName.appendf("\\%d-%d.png", layer->fKey.pictureID(), layer->fKey.sta
rt()); | 505 fileName.appendf("\\%d-%d.png", layer->fKey.pictureID(), layer->fKey.sta
rt()); |
| 505 | 506 |
| 506 layer->texture()->surfacePriv().savePixels(fileName.c_str()); | 507 layer->texture()->surfacePriv().savePixels(fileName.c_str()); |
| 507 } | 508 } |
| 508 } | 509 } |
| 509 #endif | 510 #endif |
| OLD | NEW |