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 "ui/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include <OpenGL/CGLRenderers.h> | 7 #include <OpenGL/CGLRenderers.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // A "no-op" surface. It is not required that a CGLContextObj have an | 24 // A "no-op" surface. It is not required that a CGLContextObj have an |
25 // associated drawable (pbuffer or fullscreen context) in order to be | 25 // associated drawable (pbuffer or fullscreen context) in order to be |
26 // made current. Everywhere this surface type is used, we allocate an | 26 // made current. Everywhere this surface type is used, we allocate an |
27 // FBO at the user level as the drawable of the associated context. | 27 // FBO at the user level as the drawable of the associated context. |
28 class GL_EXPORT NoOpGLSurface : public GLSurface { | 28 class GL_EXPORT NoOpGLSurface : public GLSurface { |
29 public: | 29 public: |
30 explicit NoOpGLSurface(const gfx::Size& size) : size_(size) {} | 30 explicit NoOpGLSurface(const gfx::Size& size) : size_(size) {} |
31 | 31 |
32 // Implement GLSurface. | 32 // Implement GLSurface. |
33 virtual bool Initialize() override { return true; } | 33 bool Initialize() override { return true; } |
34 virtual void Destroy() override {} | 34 void Destroy() override {} |
35 virtual bool IsOffscreen() override { return true; } | 35 bool IsOffscreen() override { return true; } |
36 virtual bool SwapBuffers() override { | 36 bool SwapBuffers() override { |
37 NOTREACHED() << "Cannot call SwapBuffers on a NoOpGLSurface."; | 37 NOTREACHED() << "Cannot call SwapBuffers on a NoOpGLSurface."; |
38 return false; | 38 return false; |
39 } | 39 } |
40 virtual gfx::Size GetSize() override { return size_; } | 40 gfx::Size GetSize() override { return size_; } |
41 virtual void* GetHandle() override { return NULL; } | 41 void* GetHandle() override { return NULL; } |
42 virtual void* GetDisplay() override { return NULL; } | 42 void* GetDisplay() override { return NULL; } |
43 virtual bool IsSurfaceless() const override { return true; } | 43 bool IsSurfaceless() const override { return true; } |
44 | 44 |
45 protected: | 45 protected: |
46 virtual ~NoOpGLSurface() {} | 46 ~NoOpGLSurface() override {} |
47 | 47 |
48 private: | 48 private: |
49 gfx::Size size_; | 49 gfx::Size size_; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(NoOpGLSurface); | 51 DISALLOW_COPY_AND_ASSIGN(NoOpGLSurface); |
52 }; | 52 }; |
53 | 53 |
54 // static | 54 // static |
55 bool InitializeOneOffForSandbox() { | 55 bool InitializeOneOffForSandbox() { |
56 static bool initialized = false; | 56 static bool initialized = false; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 153 } |
154 case kGLImplementationMockGL: | 154 case kGLImplementationMockGL: |
155 return new GLSurfaceStub; | 155 return new GLSurfaceStub; |
156 default: | 156 default: |
157 NOTREACHED(); | 157 NOTREACHED(); |
158 return NULL; | 158 return NULL; |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 } // namespace gfx | 162 } // namespace gfx |
OLD | NEW |