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

Unified Diff: src/gpu/GrAADistanceFieldPathRenderer.cpp

Issue 677463002: Set temporary paths volatile so we don't cache them. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
Index: src/gpu/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index 95e4e7ac98d5a6f418220f959ce628c1841d6c17..105d70d94e4c0ac52a54f012250538b460c93282 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -31,6 +31,11 @@
SK_CONF_DECLARE(bool, c_DumpPathCache, "gpu.dumpPathCache", false,
"Dump the contents of the path cache before every purge.");
+#ifdef DF_PATH_TRACKING
+static int g_NumCachedPaths = 0;
+static int g_NumFreedPaths = 0;
+#endif
+
////////////////////////////////////////////////////////////////////////////////
GrAADistanceFieldPathRenderer::~GrAADistanceFieldPathRenderer() {
PathDataList::Iter iter;
@@ -43,6 +48,11 @@ GrAADistanceFieldPathRenderer::~GrAADistanceFieldPathRenderer() {
}
SkDELETE(fAtlas);
+
+#ifdef DF_PATH_TRACKING
+ SkDebugf("Num cached paths: %d\n", g_NumCachedPaths);
+ SkDebugf("Num freed paths: %d\n", g_NumFreedPaths);
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -50,10 +60,11 @@ bool GrAADistanceFieldPathRenderer::canDrawPath(const SkPath& path,
const SkStrokeRec& stroke,
const GrDrawTarget* target,
bool antiAlias) const {
+
// TODO: Support inverse fill
// TODO: Support strokes
if (!target->caps()->shaderDerivativeSupport() || !antiAlias || path.isInverseFillType()
- || SkStrokeRec::kFill_Style != stroke.getStyle()) {
+ || path.isVolatile() || SkStrokeRec::kFill_Style != stroke.getStyle()) {
return false;
}
@@ -230,7 +241,10 @@ HAS_ATLAS:
fPathCache.add(pathData);
fPathList.addToTail(pathData);
-
+#ifdef DF_PATH_TRACKING
+ ++g_NumCachedPaths;
+#endif
+
return pathData;
}
@@ -252,6 +266,9 @@ bool GrAADistanceFieldPathRenderer::freeUnusedPlot() {
fPathCache.remove(pathData->fGenID);
fPathList.remove(pathData);
SkDELETE(pathData);
+#ifdef DF_PATH_TRACKING
+ --g_NumFreedPaths;
+#endif
}
}

Powered by Google App Engine
This is Rietveld 408576698