Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index 96380bdfe66995a73532acbd8999a279507673d4..5a2a2b658480a7b304b0c3555cec6c7657c2eeea 100755 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -84,9 +84,20 @@ private: |
GrContext* fContext; |
}; |
robertphillips
2014/08/11 19:22:20
Can we just have this in the header?
krajcevski
2014/08/11 20:01:33
Done.
|
-GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext) { |
+GrContext::Options::Options() |
+ : fDrawPathToCompressedTexture(false) |
+{ } |
+ |
+GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext, |
+ const Options* opts) { |
GrContext* context = SkNEW(GrContext); |
- if (context->init(backend, backendContext)) { |
+ |
+ Options defaultOpts; |
+ if (NULL == opts) { |
+ opts = &defaultOpts; |
+ } |
+ |
+ if (context->init(backend, backendContext, *opts)) { |
return context; |
} else { |
context->unref(); |
@@ -112,7 +123,7 @@ GrContext::GrContext() { |
fMaxTextureSizeOverride = 1 << 20; |
} |
-bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { |
+bool GrContext::init(GrBackend backend, GrBackendContext backendContext, const Options& opts) { |
SkASSERT(NULL == fGpu); |
fGpu = GrGpu::Create(backend, backendContext, this); |
@@ -140,6 +151,8 @@ bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { |
this->setupDrawBuffer(); |
+ fSupportsDrawPathToCompressed = opts.fDrawPathToCompressedTexture; |
+ |
return true; |
} |
@@ -607,6 +620,14 @@ int GrContext::getMaxSampleCount() const { |
return fGpu->caps()->maxSampleCount(); |
} |
+bool GrContext::supportsDrawPathToCompressedTexture() const { |
+ if (!(fGpu->caps()->compressedTexSubImageSupport())) { |
+ return false; |
+ } |
+ |
+ return fSupportsDrawPathToCompressed; |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
GrTexture* GrContext::wrapBackendTexture(const GrBackendTextureDesc& desc) { |