OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/gl/gl_surface.h" | 5 #include "ui/gfx/gl/gl_surface.h" |
6 | 6 |
| 7 #include "base/logging.h" |
7 #include "base/threading/thread_local.h" | 8 #include "base/threading/thread_local.h" |
8 #include "ui/gfx/gl/gl_context.h" | 9 #include "ui/gfx/gl/gl_context.h" |
9 | 10 |
10 namespace gfx { | 11 namespace gfx { |
11 | 12 |
12 static base::ThreadLocalPointer<GLSurface> current_surface_; | 13 static base::ThreadLocalPointer<GLSurface> current_surface_; |
13 | 14 |
14 GLSurface::GLSurface() { | 15 GLSurface::GLSurface() { |
15 } | 16 } |
16 | 17 |
17 GLSurface::~GLSurface() { | 18 GLSurface::~GLSurface() { |
18 if (GetCurrent() == this) | 19 if (GetCurrent() == this) |
19 SetCurrent(NULL); | 20 SetCurrent(NULL); |
20 } | 21 } |
21 | 22 |
22 bool GLSurface::Initialize() | 23 bool GLSurface::Initialize() |
23 { | 24 { |
24 return true; | 25 return true; |
25 } | 26 } |
26 | 27 |
| 28 bool GLSurface::Resize(const gfx::Size& size) { |
| 29 NOTIMPLEMENTED(); |
| 30 return false; |
| 31 } |
| 32 |
27 unsigned int GLSurface::GetBackingFrameBufferObject() { | 33 unsigned int GLSurface::GetBackingFrameBufferObject() { |
28 return 0; | 34 return 0; |
29 } | 35 } |
30 | 36 |
31 bool GLSurface::OnMakeCurrent(GLContext* context) { | 37 bool GLSurface::OnMakeCurrent(GLContext* context) { |
32 return true; | 38 return true; |
33 } | 39 } |
34 | 40 |
35 void GLSurface::SetVisible(bool visible) { | 41 void GLSurface::SetVisible(bool visible) { |
36 } | 42 } |
37 | 43 |
| 44 void* GLSurface::GetShareHandle() { |
| 45 NOTIMPLEMENTED(); |
| 46 return NULL; |
| 47 } |
| 48 |
| 49 void* GLSurface::GetDisplay() { |
| 50 NOTIMPLEMENTED(); |
| 51 return NULL; |
| 52 } |
| 53 |
| 54 void* GLSurface::GetConfig() { |
| 55 NOTIMPLEMENTED(); |
| 56 return NULL; |
| 57 } |
| 58 |
| 59 unsigned GLSurface::GetFormat() { |
| 60 NOTIMPLEMENTED(); |
| 61 return 0; |
| 62 } |
| 63 |
38 GLSurface* GLSurface::GetCurrent() { | 64 GLSurface* GLSurface::GetCurrent() { |
39 return current_surface_.Get(); | 65 return current_surface_.Get(); |
40 } | 66 } |
41 | 67 |
42 void GLSurface::SetCurrent(GLSurface* surface) { | 68 void GLSurface::SetCurrent(GLSurface* surface) { |
43 current_surface_.Set(surface); | 69 current_surface_.Set(surface); |
44 } | 70 } |
45 | 71 |
| 72 GLSurfaceAdapter::GLSurfaceAdapter(GLSurface* surface) : surface_(surface) { |
| 73 } |
| 74 |
| 75 GLSurfaceAdapter::~GLSurfaceAdapter() { |
| 76 } |
| 77 |
| 78 bool GLSurfaceAdapter::Initialize() { |
| 79 return surface_->Initialize(); |
| 80 } |
| 81 |
| 82 void GLSurfaceAdapter::Destroy() { |
| 83 surface_->Destroy(); |
| 84 } |
| 85 |
| 86 bool GLSurfaceAdapter::Resize(const gfx::Size& size) { |
| 87 return surface_->Resize(size); |
| 88 } |
| 89 |
| 90 bool GLSurfaceAdapter::IsOffscreen() { |
| 91 return surface_->IsOffscreen(); |
| 92 } |
| 93 |
| 94 bool GLSurfaceAdapter::SwapBuffers() { |
| 95 return surface_->SwapBuffers(); |
| 96 } |
| 97 |
| 98 gfx::Size GLSurfaceAdapter::GetSize() { |
| 99 return surface_->GetSize(); |
| 100 } |
| 101 |
| 102 void* GLSurfaceAdapter::GetHandle() { |
| 103 return surface_->GetHandle(); |
| 104 } |
| 105 |
| 106 unsigned int GLSurfaceAdapter::GetBackingFrameBufferObject() { |
| 107 return surface_->GetBackingFrameBufferObject(); |
| 108 } |
| 109 |
| 110 bool GLSurfaceAdapter::OnMakeCurrent(GLContext* context) { |
| 111 return surface_->OnMakeCurrent(context); |
| 112 } |
| 113 |
| 114 void* GLSurfaceAdapter::GetShareHandle() { |
| 115 return surface_->GetShareHandle(); |
| 116 } |
| 117 |
| 118 void* GLSurfaceAdapter::GetDisplay() { |
| 119 return surface_->GetDisplay(); |
| 120 } |
| 121 |
| 122 void* GLSurfaceAdapter::GetConfig() { |
| 123 return surface_->GetConfig(); |
| 124 } |
| 125 |
| 126 unsigned GLSurfaceAdapter::GetFormat() { |
| 127 return surface_->GetFormat(); |
| 128 } |
| 129 |
46 } // namespace gfx | 130 } // namespace gfx |
OLD | NEW |