| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 #ifdef SK_DEVELOPER | 438 #ifdef SK_DEVELOPER |
| 439 void GrLayerCache::writeLayersToDisk(const SkString& dirName) { | 439 void GrLayerCache::writeLayersToDisk(const SkString& dirName) { |
| 440 | 440 |
| 441 GrTexture* atlasTexture = fAtlas->getTexture(); | 441 GrTexture* atlasTexture = fAtlas->getTexture(); |
| 442 if (NULL != atlasTexture) { | 442 if (NULL != atlasTexture) { |
| 443 SkString fileName(dirName); | 443 SkString fileName(dirName); |
| 444 fileName.append("\\atlas.png"); | 444 fileName.append("\\atlas.png"); |
| 445 | 445 |
| 446 atlasTexture->surfacePriv().savePixels(fileName.c_str()); | 446 SkSaveGrSurfacePixelsAsPNG(atlasTexture, fileName.c_str()); |
| 447 } | 447 } |
| 448 | 448 |
| 449 SkTDynamicHash<GrCachedLayer, GrCachedLayer::Key>::Iter iter(&fLayerHash); | 449 SkTDynamicHash<GrCachedLayer, GrCachedLayer::Key>::Iter iter(&fLayerHash); |
| 450 for (; !iter.done(); ++iter) { | 450 for (; !iter.done(); ++iter) { |
| 451 GrCachedLayer* layer = &(*iter); | 451 GrCachedLayer* layer = &(*iter); |
| 452 | 452 |
| 453 if (layer->isAtlased() || !layer->texture()) { | 453 if (layer->isAtlased() || !layer->texture()) { |
| 454 continue; | 454 continue; |
| 455 } | 455 } |
| 456 | 456 |
| 457 SkString fileName(dirName); | 457 SkString fileName(dirName); |
| 458 fileName.append("\\"); | 458 fileName.append("\\"); |
| 459 fileName.appendU32(layer->fKey.pictureID()); | 459 fileName.appendU32(layer->fKey.pictureID()); |
| 460 fileName.append("-"); | 460 fileName.append("-"); |
| 461 fileName.appendU32(layer->fKey.start()); | 461 fileName.appendU32(layer->fKey.start()); |
| 462 fileName.append(".png"); | 462 fileName.append(".png"); |
| 463 | 463 |
| 464 layer->texture()->surfacePriv().savePixels(fileName.c_str()); | 464 SkSaveGrSurfacePixelsAsPNG(layer->texture(), fileName.c_str()); |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 #endif | 467 #endif |
| OLD | NEW |