Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(829)

Side by Side Diff: src/gpu/gl/SkNullGLContext.cpp

Issue 1490113005: Add config options to run different GPU APIs to dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-03-context-factory-glcontext-type
Patch Set: win angle Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 ); }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698