Index: src/gpu/GrLayerCache.cpp |
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp |
index 570b2d6eafef15a8558532aa2f785f869786d463..de4a90a1c1debb5ec99e887bcbfbab2a6e5b7735 100644 |
--- a/src/gpu/GrLayerCache.cpp |
+++ b/src/gpu/GrLayerCache.cpp |
@@ -8,6 +8,7 @@ |
#include "GrAtlas.h" |
#include "GrGpu.h" |
#include "GrLayerCache.h" |
+#include "GrSurfacePriv.h" |
DECLARE_SKMESSAGEBUS_MESSAGE(GrPictureDeletedMessage); |
@@ -434,3 +435,33 @@ void GrLayerCache::processDeletedPictures() { |
} |
} |
+#ifdef SK_DEVELOPER |
+void GrLayerCache::writeLayersToDisk(const SkString& dirName) { |
+ |
+ GrTexture* atlasTexture = fAtlas->getTexture(); |
+ if (NULL != atlasTexture) { |
+ SkString fileName(dirName); |
+ fileName.append("\\atlas.png"); |
+ |
+ atlasTexture->surfacePriv().savePixels(fileName.c_str()); |
+ } |
+ |
+ SkTDynamicHash<GrCachedLayer, GrCachedLayer::Key>::Iter iter(&fLayerHash); |
+ for (; !iter.done(); ++iter) { |
+ GrCachedLayer* layer = &(*iter); |
+ |
+ if (layer->isAtlased() || !layer->texture()) { |
+ continue; |
+ } |
+ |
+ SkString fileName(dirName); |
+ fileName.append("\\"); |
+ fileName.appendU32(layer->fKey.pictureID()); |
+ fileName.append("-"); |
+ fileName.appendU32(layer->fKey.start()); |
+ fileName.append(".png"); |
+ |
+ layer->texture()->surfacePriv().savePixels(fileName.c_str()); |
+ } |
+} |
+#endif |