Add GrLayerCache::writeLayersToDisk
I'm tired of readding this capability whenever I need to debug. Review URL: https://codereview.chromium.org/654653006
This commit is contained in:
parent
ab84fae29f
commit
84ac082fd4
@ -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
|
||||
|
@ -222,6 +222,10 @@ public:
|
||||
|
||||
SkDEBUGCODE(void validate() const;)
|
||||
|
||||
#ifdef SK_DEVELOPER
|
||||
void writeLayersToDisk(const SkString& dirName);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static const int kAtlasTextureWidth = 1024;
|
||||
static const int kAtlasTextureHeight = 1024;
|
||||
|
Loading…
Reference in New Issue
Block a user