Add support to dump font cache texture for debug purposes
R=robertphillips@google.com, bsalomon@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/25736002
git-svn-id: http://skia.googlecode.com/svn/trunk@11579 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index e399c91..7cab335 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -10,6 +10,7 @@
#include "GrRectanizer.h"
#include "GrTextStrike.h"
#include "GrTextStrike_impl.h"
+#include "SkString.h"
SK_DEFINE_INST_COUNT(GrFontScaler)
SK_DEFINE_INST_COUNT(GrKey)
@@ -170,6 +171,23 @@
}
#endif
+#ifdef SK_DEVELOPER
+void GrFontCache::dump() const {
+ static int gDumpCount = 0;
+ for (int i = 0; i < kMaskFormatCount; ++i) {
+ if (NULL != fAtlasMgr[i]) {
+ GrTexture* texture = fAtlasMgr[i]->getTexture();
+ if (NULL != texture) {
+ SkString filename;
+ filename.printf("fontcache_%d%d.png", gDumpCount, i);
+ texture->savePixels(filename.c_str());
+ }
+ }
+ }
+ ++gDumpCount;
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
#ifdef SK_DEBUG