| OLD | NEW | 
|    1  |    1  | 
|    2 /* |    2 /* | 
|    3  * Copyright 2011 Google Inc. |    3  * Copyright 2011 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 "gl/SkNullGLContext.h" |    9 #include "gl/SkNullGLContext.h" | 
|   10 #include "gl/GrGLInterface.h" |   10 #include "gl/GrGLInterface.h" | 
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  525         state->ref(); |  525         state->ref(); | 
|  526     } |  526     } | 
|  527 } |  527 } | 
|  528  |  528  | 
|  529 #if GR_GL_PER_GL_FUNC_CALLBACK |  529 #if GR_GL_PER_GL_FUNC_CALLBACK | 
|  530 static void set_current_context_from_interface(const GrGLInterface* interface) { |  530 static void set_current_context_from_interface(const GrGLInterface* interface) { | 
|  531     set_current_context(reinterpret_cast<State*>(interface->fCallbackData)); |  531     set_current_context(reinterpret_cast<State*>(interface->fCallbackData)); | 
|  532 } |  532 } | 
|  533 #endif |  533 #endif | 
|  534  |  534  | 
|  535 SkNullGLContext* SkNullGLContext::Create(GrGLStandard forcedGpuAPI) { |  535 SkNullGLContext* SkNullGLContext::Create() { | 
|  536     if (kGLES_GrGLStandard == forcedGpuAPI) { |  | 
|  537         return nullptr; |  | 
|  538     } |  | 
|  539     SkNullGLContext* ctx = new SkNullGLContext; |  536     SkNullGLContext* ctx = new SkNullGLContext; | 
|  540     if (!ctx->isValid()) { |  537     if (!ctx->isValid()) { | 
|  541         delete ctx; |  538         delete ctx; | 
|  542         return nullptr; |  539         return nullptr; | 
|  543     } |  540     } | 
|  544     return ctx; |  541     return ctx; | 
|  545 } |  542 } | 
|  546  |  543  | 
|  547 SkNullGLContext::SkNullGLContext() { |  544 SkNullGLContext::SkNullGLContext() { | 
|  548     fState = new ContextState; |  545     fState = new ContextState; | 
|  549     GrGLInterface* interface = create_null_interface(fState); |  546     GrGLInterface* interface = create_null_interface(fState); | 
|  550     this->init(interface); |  547     this->init(interface); | 
|  551 #if GR_GL_PER_GL_FUNC_CALLBACK |  548 #if GR_GL_PER_GL_FUNC_CALLBACK | 
|  552     interface->fCallback = set_current_context_from_interface; |  549     interface->fCallback = set_current_context_from_interface; | 
|  553     interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(fStat
     e); |  550     interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(fStat
     e); | 
|  554 #endif |  551 #endif | 
|  555 } |  552 } | 
|  556  |  553  | 
|  557 SkNullGLContext::~SkNullGLContext() { |  554 SkNullGLContext::~SkNullGLContext() { | 
|  558     this->teardown(); |  555     this->teardown(); | 
|  559     fState->unref(); |  556     fState->unref(); | 
|  560 } |  557 } | 
|  561  |  558  | 
|  562 void SkNullGLContext::onPlatformMakeCurrent() const { set_current_context(fState
     ); } |  559 void SkNullGLContext::onPlatformMakeCurrent() const { set_current_context(fState
     ); } | 
| OLD | NEW |