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_cgl.h" | 5 #include "ui/gfx/gl/gl_surface_cgl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/gfx/gl/gl_bindings.h" | 9 #include "ui/gfx/gl/gl_bindings.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 bool GLSurfaceCGL::InitializeOneOff() { | 23 bool GLSurfaceCGL::InitializeOneOff() { |
24 static bool initialized = false; | 24 static bool initialized = false; |
25 if (initialized) | 25 if (initialized) |
26 return true; | 26 return true; |
27 | 27 |
28 static const CGLPixelFormatAttribute attribs[] = { | 28 static const CGLPixelFormatAttribute attribs[] = { |
29 (CGLPixelFormatAttribute) kCGLPFAPBuffer, | 29 (CGLPixelFormatAttribute) kCGLPFAPBuffer, |
30 (CGLPixelFormatAttribute) 0 | 30 (CGLPixelFormatAttribute) 0 |
31 }; | 31 }; |
32 CGLPixelFormatObj pixel_format; | |
33 GLint num_pixel_formats; | 32 GLint num_pixel_formats; |
34 if (CGLChoosePixelFormat(attribs, | 33 if (CGLChoosePixelFormat(attribs, |
35 &g_pixel_format, | 34 &g_pixel_format, |
36 &num_pixel_formats) != kCGLNoError) { | 35 &num_pixel_formats) != kCGLNoError) { |
37 LOG(ERROR) << "Error choosing pixel format."; | 36 LOG(ERROR) << "Error choosing pixel format."; |
38 return false; | 37 return false; |
39 } | 38 } |
40 if (num_pixel_formats == 0) { | 39 if (num_pixel_formats == 0) { |
41 LOG(ERROR) << "num_pixel_formats == 0."; | 40 LOG(ERROR) << "num_pixel_formats == 0."; |
42 return false; | 41 return false; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 96 |
98 gfx::Size PbufferGLSurfaceCGL::GetSize() { | 97 gfx::Size PbufferGLSurfaceCGL::GetSize() { |
99 return size_; | 98 return size_; |
100 } | 99 } |
101 | 100 |
102 void* PbufferGLSurfaceCGL::GetHandle() { | 101 void* PbufferGLSurfaceCGL::GetHandle() { |
103 return pbuffer_; | 102 return pbuffer_; |
104 } | 103 } |
105 | 104 |
106 } // namespace gfx | 105 } // namespace gfx |
OLD | NEW |