| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/gl_context_virtual.h" | 5 #include "gpu/command_buffer/service/gl_context_virtual.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" | 7 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
| 8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 9 #include "ui/gl/gl_surface.h" | 9 #include "ui/gl/gl_surface.h" |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) { | 63 void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) { |
| 64 if (IsCurrent(surface)) | 64 if (IsCurrent(surface)) |
| 65 shared_context_->ReleaseCurrent(surface); | 65 shared_context_->ReleaseCurrent(surface); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) { | 68 bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) { |
| 69 // If it's a real surface it needs to be current. | 69 // If it's a real surface it needs to be current. |
| 70 if (surface && | 70 if (surface && |
| 71 !surface->GetBackingFrameBufferObject() && | 71 !surface->IsOffscreen() && |
| 72 !surface->IsOffscreen()) | 72 !surface->GetBackingFrameBufferObject()) |
| 73 return shared_context_->IsCurrent(surface); | 73 return shared_context_->IsCurrent(surface); |
| 74 | 74 |
| 75 // Otherwise, only insure the context itself is current. | 75 // Otherwise, only insure the context itself is current. |
| 76 return shared_context_->IsCurrent(NULL); | 76 return shared_context_->IsCurrent(NULL); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void* GLContextVirtual::GetHandle() { | 79 void* GLContextVirtual::GetHandle() { |
| 80 return shared_context_->GetHandle(); | 80 return shared_context_->GetHandle(); |
| 81 } | 81 } |
| 82 | 82 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 105 | 105 |
| 106 void GLContextVirtual::SetUnbindFboOnMakeCurrent() { | 106 void GLContextVirtual::SetUnbindFboOnMakeCurrent() { |
| 107 shared_context_->SetUnbindFboOnMakeCurrent(); | 107 shared_context_->SetUnbindFboOnMakeCurrent(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 GLContextVirtual::~GLContextVirtual() { | 110 GLContextVirtual::~GLContextVirtual() { |
| 111 Destroy(); | 111 Destroy(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace gpu | 114 } // namespace gpu |
| OLD | NEW |