aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r--src/gpu/GrContext.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 74fbe10ac1..8ccbb2b754 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -77,6 +77,7 @@ public:
GrDDLContext(GrContextThreadSafeProxy* proxy) : INHERITED(proxy) {}
protected:
+ // DDL TODO: grab a GrRestrictedAtlasManager from the proxy
private:
typedef GrContext INHERITED;
@@ -218,7 +219,8 @@ GrContext::GrContext(GrBackend backend)
fResourceCache = nullptr;
fResourceProvider = nullptr;
fProxyProvider = nullptr;
- fAtlasGlyphCache = nullptr;
+ fGlyphCache = nullptr;
+ fFullAtlasManager = nullptr;
}
GrContext::GrContext(GrContextThreadSafeProxy* proxy)
@@ -228,7 +230,8 @@ GrContext::GrContext(GrContextThreadSafeProxy* proxy)
fResourceCache = nullptr;
fResourceProvider = nullptr;
fProxyProvider = nullptr;
- fAtlasGlyphCache = nullptr;
+ fGlyphCache = nullptr;
+ fFullAtlasManager = nullptr;
}
bool GrContext::init(const GrContextOptions& options) {
@@ -293,9 +296,17 @@ bool GrContext::init(const GrContextOptions& options) {
} else {
allowMultitexturing = GrDrawOpAtlas::AllowMultitexturing::kYes;
}
- fAtlasGlyphCache = new GrAtlasGlyphCache(fProxyProvider, options.fGlyphCacheTextureMaximumBytes,
- allowMultitexturing);
- this->contextPriv().addOnFlushCallbackObject(fAtlasGlyphCache);
+
+ fGlyphCache = new GrGlyphCache;
+
+ // DDL TODO: in DDL-mode grab a GrRestrictedAtlasManager from the thread-proxy and
+ // do not add an onFlushCB
+ fFullAtlasManager = new GrAtlasManager(fProxyProvider, fGlyphCache,
+ options.fGlyphCacheTextureMaximumBytes,
+ allowMultitexturing);
+ this->contextPriv().addOnFlushCallbackObject(fFullAtlasManager);
+
+ fGlyphCache->setGlyphSizeLimit(fFullAtlasManager->getGlyphSizeLimit());
fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB,
this, this->uniqueID(), SkToBool(fGpu)));
@@ -327,7 +338,8 @@ GrContext::~GrContext() {
delete fResourceProvider;
delete fResourceCache;
delete fProxyProvider;
- delete fAtlasGlyphCache;
+ delete fGlyphCache;
+ delete fFullAtlasManager;
}
sk_sp<GrContextThreadSafeProxy> GrContext::threadSafeProxy() {
@@ -386,7 +398,8 @@ void GrContext::abandonContext() {
fGpu->disconnect(GrGpu::DisconnectType::kAbandon);
- fAtlasGlyphCache->freeAll();
+ fGlyphCache->freeAll();
+ fFullAtlasManager->freeAll();
fTextBlobCache->freeAll();
}
@@ -405,7 +418,8 @@ void GrContext::releaseResourcesAndAbandonContext() {
fGpu->disconnect(GrGpu::DisconnectType::kCleanup);
- fAtlasGlyphCache->freeAll();
+ fGlyphCache->freeAll();
+ fFullAtlasManager->freeAll();
fTextBlobCache->freeAll();
}
@@ -419,7 +433,8 @@ void GrContext::freeGpuResources() {
this->flush();
- fAtlasGlyphCache->freeAll();
+ fGlyphCache->freeAll();
+ fFullAtlasManager->freeAll();
fDrawingManager->freeGpuResources();