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
*/
void resolveRenderTarget(GrRenderTarget* target);
+#ifdef SK_DEVELOPER
+ void dumpFontCache() const;
+#endif
+
///////////////////////////////////////////////////////////////////////////
// Helpers
if (NULL == fTexture) {
// TODO: Update this to use the cache rather than directly creating a texture.
GrTextureDesc desc;
+#ifdef SK_DEVELOPER
+ // RenderTarget so we can read the pixels to dump them
+ desc.fFlags = kDynamicUpdate_GrTextureFlagBit|kRenderTarget_GrTextureFlagBit
+ |kNoStencil_GrTextureFlagBit;
+#else
desc.fFlags = kDynamicUpdate_GrTextureFlagBit;
+#endif
desc.fWidth = GR_ATLAS_TEXTURE_WIDTH;
desc.fHeight = GR_ATLAS_TEXTURE_HEIGHT;
desc.fConfig = fPixelConfig;
}
bool GrAtlasMgr::removeUnusedPlots(GrAtlas* atlas) {
+
// GrPlot** is used so that the head element can be easily
// modified when the first element is deleted
GrPlot** plotRef = &atlas->fPlots;
this->drawRect(*paint, r);
}
+#ifdef SK_DEVELOPER
+void GrContext::dumpFontCache() const {
+ fFontCache->dump();
+}
+#endif
+
////////////////////////////////////////////////////////////////////////////////
namespace {
#include "GrTextStrike.h"
#include "GrTextStrike_impl.h"
#include "SkPath.h"
+#include "SkRTConf.h"
#include "SkStrokeRec.h"
#include "effects/GrCustomCoordsTextureEffect.h"
static const int kGlyphCoordsAttributeIndex = 1;
+SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
+ "Dump the contents of the font cache before every purge.");
+
void GrTextContext::flushGlyphs() {
if (NULL == fDrawTarget) {
return;
goto HAS_ATLAS;
}
+ if (c_DumpFontCache) {
+#ifdef SK_DEVELOPER
+ fContext->getFontCache()->dump();
+#endif
+ }
+
// before we purge the cache, we must flush any accumulated draws
this->flushGlyphs();
fContext->flush();
#include "GrRectanizer.h"
#include "GrTextStrike.h"
#include "GrTextStrike_impl.h"
+#include "SkString.h"
SK_DEFINE_INST_COUNT(GrFontScaler)
SK_DEFINE_INST_COUNT(GrKey)
}
#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
void validate() const {}
#endif
+#ifdef SK_DEVELOPER
+ void dump() const;
+#endif
+
private:
friend class GrFontPurgeListener;
#if GR_CACHE_STATS
if (renderer->isUsingGpuDevice()) {
GrContext* ctx = renderer->getGrContext();
-
ctx->printCacheStats();
+#ifdef SK_DEVELOPER
+ ctx->dumpFontCache();
+#endif
}
#endif
#endif