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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 state->ref(); | 571 state->ref(); |
572 } | 572 } |
573 } | 573 } |
574 | 574 |
575 #if GR_GL_PER_GL_FUNC_CALLBACK | 575 #if GR_GL_PER_GL_FUNC_CALLBACK |
576 static void set_current_context_from_interface(const GrGLInterface* interface) { | 576 static void set_current_context_from_interface(const GrGLInterface* interface) { |
577 set_current_context(reinterpret_cast<State*>(interface->fCallbackData)); | 577 set_current_context(reinterpret_cast<State*>(interface->fCallbackData)); |
578 } | 578 } |
579 #endif | 579 #endif |
580 | 580 |
581 SkNullGLContext* SkNullGLContext::Create(GrGLStandard forcedGpuAPI) { | 581 SkNullGLContext* SkNullGLContext::Create() { |
582 if (kGLES_GrGLStandard == forcedGpuAPI) { | |
583 return nullptr; | |
584 } | |
585 SkNullGLContext* ctx = new SkNullGLContext; | 582 SkNullGLContext* ctx = new SkNullGLContext; |
586 if (!ctx->isValid()) { | 583 if (!ctx->isValid()) { |
587 delete ctx; | 584 delete ctx; |
588 return nullptr; | 585 return nullptr; |
589 } | 586 } |
590 return ctx; | 587 return ctx; |
591 } | 588 } |
592 | 589 |
593 SkNullGLContext::SkNullGLContext() { | 590 SkNullGLContext::SkNullGLContext() { |
594 fState = new ContextState; | 591 fState = new ContextState; |
595 GrGLInterface* interface = create_null_interface(fState); | 592 GrGLInterface* interface = create_null_interface(fState); |
596 this->init(interface); | 593 this->init(interface); |
597 #if GR_GL_PER_GL_FUNC_CALLBACK | 594 #if GR_GL_PER_GL_FUNC_CALLBACK |
598 interface->fCallback = set_current_context_from_interface; | 595 interface->fCallback = set_current_context_from_interface; |
599 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(fStat
e); | 596 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(fStat
e); |
600 #endif | 597 #endif |
601 } | 598 } |
602 | 599 |
603 SkNullGLContext::~SkNullGLContext() { | 600 SkNullGLContext::~SkNullGLContext() { |
604 this->teardown(); | 601 this->teardown(); |
605 fState->unref(); | 602 fState->unref(); |
606 } | 603 } |
607 | 604 |
608 void SkNullGLContext::onPlatformMakeCurrent() const { set_current_context(fState
); } | 605 void SkNullGLContext::onPlatformMakeCurrent() const { set_current_context(fState
); } |
OLD | NEW |