Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Unified Diff: src/gpu/GrLayerCache.cpp

Issue 654653006: Add GrLayerCache::writeLayersToDisk (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698