OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file implements the ViewGLContext and PbufferGLContext classes. | 5 // This file implements the ViewGLContext and PbufferGLContext classes. |
6 | 6 |
7 #include "app/gfx/gl/gl_context.h" | 7 #include "app/gfx/gl/gl_context.h" |
8 | 8 |
9 extern "C" { | 9 extern "C" { |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/basictypes.h" | 21 #include "base/basictypes.h" |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
23 #include "base/scoped_ptr.h" | 23 #include "base/scoped_ptr.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 Display* GetXDisplayHelper() { | 27 Display* GetXDisplayHelper() { |
28 static Display* display = NULL; | 28 static Display* display = NULL; |
29 | 29 |
30 if (!display) { | 30 if (!display) { |
31 if (x11_util::XDisplayExists()) { | 31 display = XOpenDisplay(NULL); |
32 display = x11_util::GetXDisplay(); | 32 CHECK(display); |
33 } else { | |
34 display = XOpenDisplay(NULL); | |
35 } | |
36 } | 33 } |
| 34 |
37 return display; | 35 return display; |
38 } | 36 } |
39 | 37 |
40 } | 38 } // namespace |
41 | 39 |
42 namespace gfx { | 40 namespace gfx { |
43 | 41 |
44 typedef GLXContext GLContextHandle; | 42 typedef GLXContext GLContextHandle; |
45 typedef GLXPbuffer PbufferHandle; | 43 typedef GLXPbuffer PbufferHandle; |
46 | 44 |
47 class BaseLinuxGLContext : public GLContext { | 45 class BaseLinuxGLContext : public GLContext { |
48 public: | 46 public: |
49 virtual std::string GetExtensions(); | 47 virtual std::string GetExtensions(); |
50 }; | 48 }; |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 } | 820 } |
823 case kGLImplementationMockGL: | 821 case kGLImplementationMockGL: |
824 return new StubGLContext; | 822 return new StubGLContext; |
825 default: | 823 default: |
826 NOTREACHED(); | 824 NOTREACHED(); |
827 return NULL; | 825 return NULL; |
828 } | 826 } |
829 } | 827 } |
830 | 828 |
831 } // namespace gfx | 829 } // namespace gfx |
OLD | NEW |