| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrContextFactory.h" | 9 #include "GrContextFactory.h" |
| 10 #include "gl/GLTestContext.h" | 10 #include "gl/GLTestContext.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 | 76 |
| 77 #if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_
FOR_MAC) | 77 #if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_
FOR_MAC) |
| 78 const GrContextFactory::ContextType GrContextFactory::kNativeGL_ContextType = | 78 const GrContextFactory::ContextType GrContextFactory::kNativeGL_ContextType = |
| 79 GrContextFactory::kGL_ContextType; | 79 GrContextFactory::kGL_ContextType; |
| 80 #else | 80 #else |
| 81 const GrContextFactory::ContextType GrContextFactory::kNativeGL_ContextType = | 81 const GrContextFactory::ContextType GrContextFactory::kNativeGL_ContextType = |
| 82 GrContextFactory::kGLES_ContextType; | 82 GrContextFactory::kGLES_ContextType; |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 GrContextFactory::ContextInfo GrContextFactory::getContextInfo(ContextType type, | 85 ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOptions op
tions) { |
| 86 ContextOptions op
tions) { | |
| 87 for (int i = 0; i < fContexts.count(); ++i) { | 86 for (int i = 0; i < fContexts.count(); ++i) { |
| 88 Context& context = fContexts[i]; | 87 Context& context = fContexts[i]; |
| 89 if (!context.fGLContext) { | 88 if (!context.fGLContext) { |
| 90 continue; | 89 continue; |
| 91 } | 90 } |
| 92 if (context.fType == type && | 91 if (context.fType == type && |
| 93 context.fOptions == options) { | 92 context.fOptions == options) { |
| 94 context.fGLContext->makeCurrent(); | 93 context.fGLContext->makeCurrent(); |
| 95 return ContextInfo(context.fGrContext, context.fGLContext); | 94 return ContextInfo(context.fGrContext, context.fGLContext); |
| 96 } | 95 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 172 } |
| 174 | 173 |
| 175 Context& context = fContexts.push_back(); | 174 Context& context = fContexts.push_back(); |
| 176 context.fGLContext = glCtx.release(); | 175 context.fGLContext = glCtx.release(); |
| 177 context.fGrContext = SkRef(grCtx.get()); | 176 context.fGrContext = SkRef(grCtx.get()); |
| 178 context.fType = type; | 177 context.fType = type; |
| 179 context.fOptions = options; | 178 context.fOptions = options; |
| 180 return ContextInfo(context.fGrContext, context.fGLContext); | 179 return ContextInfo(context.fGrContext, context.fGLContext); |
| 181 } | 180 } |
| 182 } // namespace sk_gpu_test | 181 } // namespace sk_gpu_test |
| OLD | NEW |