Index: src/gpu/GrContext.cpp |
=================================================================== |
--- src/gpu/GrContext.cpp (revision 10125) |
+++ src/gpu/GrContext.cpp (working copy) |
@@ -66,9 +66,11 @@ |
// Glorified typedef to avoid including GrDrawState.h in GrContext.h |
class GrContext::AutoRestoreEffects : public GrDrawState::AutoRestoreEffects {}; |
-GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext) { |
+GrContext* GrContext::Create(GrBackend backend, |
+ GrBackendContext backendContext, |
+ bool* reuseScratchTextures) { |
GrContext* context = SkNEW(GrContext); |
- if (context->init(backend, backendContext)) { |
+ if (context->init(backend, backendContext, reuseScratchTextures)) { |
return context; |
} else { |
context->unref(); |
@@ -104,7 +106,9 @@ |
fViewMatrix.reset(); |
} |
-bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { |
+bool GrContext::init(GrBackend backend, |
+ GrBackendContext backendContext, |
+ bool* reuseScratchTextures) { |
GrAssert(NULL == fGpu); |
fGpu = GrGpu::Create(backend, backendContext, this); |
@@ -115,6 +119,11 @@ |
fDrawState = SkNEW(GrDrawState); |
fGpu->setDrawState(fDrawState); |
+ if (NULL == reuseScratchTextures) { |
+ this->setReuseScratchTextures(fGpu->caps()->reuseScratchTextures()); |
+ } else { |
+ this->setReuseScratchTextures(*reuseScratchTextures); |
+ } |
fTextureCache = SkNEW_ARGS(GrResourceCache, |
(MAX_TEXTURE_CACHE_COUNT, |