This replaces the texture creation/caching functions on GrContext with a GrTextureProvider interface. The goal is to pass this narrowly focused object in places that currently take a GrContext but don't need and shouldn't use its other methods. It also has an extended private interface for interacting with non-texture resource types.
Review URL: https://codereview.chromium.org/1107973004
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index 0d64915..a2abfa7 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -11,6 +11,7 @@
#include "GrGpu.h"
#include "GrPath.h"
#include "GrPathRange.h"
+#include "GrResourceProvider.h"
#include "SkAutoKern.h"
#include "SkDraw.h"
#include "SkDrawProcs.h"
@@ -235,10 +236,10 @@
builder.finish();
SkAutoTUnref<GrPathRange> glyphs(
- static_cast<GrPathRange*>(ctx->findAndRefCachedResource(key)));
+ static_cast<GrPathRange*>(ctx->resourceProvider()->findAndRefResourceByUniqueKey(key)));
if (NULL == glyphs || (NULL != desc && !glyphs->isEqualTo(*desc))) {
glyphs.reset(ctx->getGpu()->pathRendering()->createGlyphs(typeface, desc, stroke));
- ctx->addResourceToCache(key, glyphs);
+ ctx->resourceProvider()->assignUniqueKeyToResource(key, glyphs);
}
return glyphs.detach();