Index: src/gpu/GrContextFactory.cpp |
diff --git a/src/gpu/GrContextFactory.cpp b/src/gpu/GrContextFactory.cpp |
index 097b99b0b75f50e5082e0a66ac93635feecea5fe..15af8162b1e90bdbf0fa71d5da6c3ce358703eda 100755 |
--- a/src/gpu/GrContextFactory.cpp |
+++ b/src/gpu/GrContextFactory.cpp |
@@ -24,13 +24,13 @@ |
#include "GrCaps.h" |
GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType type, |
- GrGLStandard forcedGpuAPI) { |
+ GrGLStandard forcedGpuAPI, |
+ GLContextOptions options) { |
for (int i = 0; i < fContexts.count(); ++i) { |
- if (forcedGpuAPI != kNone_GrGLStandard && |
- forcedGpuAPI != fContexts[i]->fGLContext->gl()->fStandard) |
- continue; |
- |
- if (fContexts[i]->fType == type) { |
+ if (fContexts[i]->fType == type && |
+ fContexts[i]->fOptions == options && |
+ (forcedGpuAPI == kNone_GrGLStandard || |
+ forcedGpuAPI == fContexts[i]->fGLContext->gl()->fStandard)) { |
fContexts[i]->fGLContext->makeCurrent(); |
return fContexts[i]; |
} |
@@ -38,7 +38,6 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty |
SkAutoTUnref<SkGLContext> glCtx; |
SkAutoTUnref<GrContext> grCtx; |
switch (type) { |
- case kNVPR_GLContextType: // fallthru |
case kNative_GLContextType: |
glCtx.reset(SkCreatePlatformGLContext(forcedGpuAPI)); |
break; |
@@ -75,7 +74,7 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty |
// Block NVPR from non-NVPR types. |
SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx->gl())); |
- if (kNVPR_GLContextType != type) { |
+ if (!(kEnableNVPR_GLContextOptions & options)) { |
glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface)); |
if (!glInterface) { |
return nullptr; |
@@ -92,7 +91,7 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty |
if (!grCtx.get()) { |
return nullptr; |
} |
- if (kNVPR_GLContextType == type) { |
+ if (kEnableNVPR_GLContextOptions & options) { |
if (!grCtx->caps()->shaderCaps()->pathRenderingSupport()) { |
return nullptr; |
} |
@@ -102,5 +101,6 @@ GrContextFactory::ContextInfo* GrContextFactory::getContextInfo(GLContextType ty |
ctx->fGLContext = SkRef(glCtx.get()); |
ctx->fGrContext = SkRef(grCtx.get()); |
ctx->fType = type; |
+ ctx->fOptions = options; |
return ctx; |
} |