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

Unified Diff: src/gpu/GrContext.cpp

Issue 459033002: Change GR_COMPRESS_ALPHA_MASK from compile-time flag to run-time flag (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Pass options struct to GrContext Created 6 years, 4 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
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;
};
-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) {

Powered by Google App Engine
This is Rietveld 408576698