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() { | 581 SkNullGLContext* SkNullGLContext::Create(GrGLStandard forcedGpuAPI) { |
| 582 if (kGLES_GrGLStandard == forcedGpuAPI) { |
| 583 return nullptr; |
| 584 } |
582 SkNullGLContext* ctx = new SkNullGLContext; | 585 SkNullGLContext* ctx = new SkNullGLContext; |
583 if (!ctx->isValid()) { | 586 if (!ctx->isValid()) { |
584 delete ctx; | 587 delete ctx; |
585 return nullptr; | 588 return nullptr; |
586 } | 589 } |
587 return ctx; | 590 return ctx; |
588 } | 591 } |
589 | 592 |
590 SkNullGLContext::SkNullGLContext() { | 593 SkNullGLContext::SkNullGLContext() { |
591 fState = new ContextState; | 594 fState = new ContextState; |
592 GrGLInterface* interface = create_null_interface(fState); | 595 GrGLInterface* interface = create_null_interface(fState); |
593 this->init(interface); | 596 this->init(interface); |
594 #if GR_GL_PER_GL_FUNC_CALLBACK | 597 #if GR_GL_PER_GL_FUNC_CALLBACK |
595 interface->fCallback = set_current_context_from_interface; | 598 interface->fCallback = set_current_context_from_interface; |
596 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(fStat
e); | 599 interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(fStat
e); |
597 #endif | 600 #endif |
598 } | 601 } |
599 | 602 |
600 SkNullGLContext::~SkNullGLContext() { | 603 SkNullGLContext::~SkNullGLContext() { |
601 this->teardown(); | 604 this->teardown(); |
602 fState->unref(); | 605 fState->unref(); |
603 } | 606 } |
604 | 607 |
605 void SkNullGLContext::onPlatformMakeCurrent() const { set_current_context(fState
); } | 608 void SkNullGLContext::onPlatformMakeCurrent() const { set_current_context(fState
); } |
OLD | NEW |