OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/gl/gl_context_virtual.h" |
| 6 |
| 7 #include "ui/gl/gl_surface.h" |
| 8 |
| 9 namespace gfx { |
| 10 |
| 11 GLContextVirtual::GLContextVirtual( |
| 12 GLShareGroup* share_group, |
| 13 GLContext* shared_context, |
| 14 const gpu::gles2::GLES2Decoder* decoder) |
| 15 : GLContext(share_group), |
| 16 shared_context_(shared_context), |
| 17 display_(NULL), |
| 18 decoder_(decoder) { |
| 19 shared_context_->SetupForVirtualization(); |
| 20 } |
| 21 |
| 22 Display* GLContextVirtual::display() { |
| 23 return display_; |
| 24 } |
| 25 |
| 26 bool GLContextVirtual::Initialize( |
| 27 GLSurface* compatible_surface, GpuPreference gpu_preference) { |
| 28 display_ = static_cast<Display*>(compatible_surface->GetDisplay()); |
| 29 |
| 30 return true; |
| 31 } |
| 32 |
| 33 void GLContextVirtual::Destroy() { |
| 34 //if (context_) { |
| 35 // context_ = NULL; |
| 36 //} |
| 37 } |
| 38 |
| 39 bool GLContextVirtual::MakeCurrent(GLSurface* surface) { |
| 40 shared_context_->MakeVirtuallyCurrent(this, surface); |
| 41 return true; |
| 42 } |
| 43 |
| 44 void GLContextVirtual::ReleaseCurrent(GLSurface* surface) { |
| 45 shared_context_ = NULL; |
| 46 display_ = NULL; |
| 47 } |
| 48 |
| 49 bool GLContextVirtual::IsCurrent(GLSurface* surface) { |
| 50 return true; |
| 51 } |
| 52 |
| 53 void* GLContextVirtual::GetHandle() { |
| 54 return NULL; //return context_; |
| 55 } |
| 56 |
| 57 const gpu::gles2::GLES2Decoder* GLContextVirtual::GetDecoder() { |
| 58 return decoder_; |
| 59 } |
| 60 |
| 61 void GLContextVirtual::SetSwapInterval(int interval) { |
| 62 shared_context_->SetSwapInterval(interval); |
| 63 } |
| 64 |
| 65 std::string GLContextVirtual::GetExtensions() { |
| 66 return shared_context_->GetExtensions(); |
| 67 } |
| 68 |
| 69 bool GLContextVirtual::GetTotalGpuMemory(size_t* bytes) { |
| 70 return shared_context_->GetTotalGpuMemory(bytes); |
| 71 } |
| 72 |
| 73 bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() { |
| 74 return shared_context_->WasAllocatedUsingRobustnessExtension(); |
| 75 } |
| 76 |
| 77 GLContextVirtual::~GLContextVirtual() { |
| 78 Destroy(); |
| 79 } |
| 80 |
| 81 } // namespace gfx |
OLD | NEW |