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_context_egl.h" | 5 #include "ui/gfx/gl/gl_context_egl.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "third_party/angle/include/EGL/egl.h" | 10 #include "third_party/angle/include/EGL/egl.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 GLContextEGL::GLContextEGL(GLShareGroup* share_group) | 35 GLContextEGL::GLContextEGL(GLShareGroup* share_group) |
36 : GLContext(share_group), | 36 : GLContext(share_group), |
37 context_(NULL) | 37 context_(NULL) |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 GLContextEGL::~GLContextEGL() { | 41 GLContextEGL::~GLContextEGL() { |
42 Destroy(); | 42 Destroy(); |
43 } | 43 } |
44 | 44 |
45 bool GLContextEGL::Initialize(GLSurface* compatible_surface) { | 45 bool GLContextEGL::Initialize( |
| 46 GLSurface* compatible_surface, GpuPreference gpu_preference) { |
46 DCHECK(compatible_surface); | 47 DCHECK(compatible_surface); |
47 DCHECK(!context_); | 48 DCHECK(!context_); |
48 | 49 |
49 static const EGLint kContextAttributes[] = { | 50 static const EGLint kContextAttributes[] = { |
50 EGL_CONTEXT_CLIENT_VERSION, 2, | 51 EGL_CONTEXT_CLIENT_VERSION, 2, |
51 EGL_NONE | 52 EGL_NONE |
52 }; | 53 }; |
53 | 54 |
54 GLSurfaceEGL* egl_surface = static_cast<GLSurfaceEGL*>(compatible_surface); | 55 GLSurfaceEGL* egl_surface = static_cast<GLSurfaceEGL*>(compatible_surface); |
55 display_ = egl_surface->GetDisplay(); | 56 display_ = egl_surface->GetDisplay(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 139 |
139 void GLContextEGL::SetSwapInterval(int interval) { | 140 void GLContextEGL::SetSwapInterval(int interval) { |
140 DCHECK(IsCurrent(NULL)); | 141 DCHECK(IsCurrent(NULL)); |
141 if (!eglSwapInterval(display_, interval)) { | 142 if (!eglSwapInterval(display_, interval)) { |
142 LOG(ERROR) << "eglSwapInterval failed with error " | 143 LOG(ERROR) << "eglSwapInterval failed with error " |
143 << GetLastEGLErrorString(); | 144 << GetLastEGLErrorString(); |
144 } | 145 } |
145 } | 146 } |
146 | 147 |
147 } // namespace gfx | 148 } // namespace gfx |
OLD | NEW |