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

Unified Diff: src/gpu/GrContext.cpp

Issue 1071333002: Added ability to flush context to GrTextBlobCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 5 years, 8 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 | « include/gpu/GrContext.h ('k') | src/gpu/GrTextBlobCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 2d61f35a4f02151bfc5508513ffb52c89e8c96b4..04e3f8fa9ff16aee0b03f47eaf8b1393a3512ae9 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -137,7 +137,7 @@ void GrContext::initCommon() {
// GrBatchFontCache will eventually replace GrFontCache
fBatchFontCache = SkNEW_ARGS(GrBatchFontCache, (this));
- fTextBlobCache.reset(SkNEW(GrTextBlobCache));
+ fTextBlobCache.reset(SkNEW_ARGS(GrTextBlobCache, (TextBlobCacheOverBudgetCB, this)));
}
GrContext::~GrContext() {
@@ -354,6 +354,17 @@ void GrContext::OverBudgetCB(void* data) {
context->fFlushToReduceCacheSize = true;
}
+void GrContext::TextBlobCacheOverBudgetCB(void* data) {
+ SkASSERT(data);
+
+ // Unlike the GrResourceCache, TextBlobs are drawn at the SkGpuDevice level, therefore they
+ // cannot use fFlushTorReduceCacheSize because it uses AutoCheckFlush. The solution is to move
+ // drawText calls to below the GrContext level, but this is not trivial because they call
+ // drawPath on SkGpuDevice
+ GrContext* context = reinterpret_cast<GrContext*>(data);
+ context->flush();
+}
+
int GrContext::getMaxTextureSize() const {
return SkTMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride);
}
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrTextBlobCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698