OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_image_egl.h" | 5 #include "ui/gl/gl_image_egl.h" |
6 | 6 |
7 #include "ui/gl/gl_surface_egl.h" | 7 #include "ui/gl/gl_surface_egl.h" |
8 | 8 |
9 namespace gfx { | 9 namespace gfx { |
10 | 10 |
11 GLImageEGL::GLImageEGL(gfx::Size size) | 11 GLImageEGL::GLImageEGL(const gfx::Size& size) |
12 : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {} | 12 : egl_image_(EGL_NO_IMAGE_KHR), size_(size) { |
| 13 } |
13 | 14 |
14 GLImageEGL::~GLImageEGL() { Destroy(); } | 15 GLImageEGL::~GLImageEGL() { Destroy(); } |
15 | 16 |
16 bool GLImageEGL::Initialize(EGLenum target, | 17 bool GLImageEGL::Initialize(EGLenum target, |
17 EGLClientBuffer buffer, | 18 EGLClientBuffer buffer, |
18 const EGLint* attrs) { | 19 const EGLint* attrs) { |
19 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); | 20 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); |
20 egl_image_ = eglCreateImageKHR(GLSurfaceEGL::GetHardwareDisplay(), | 21 egl_image_ = eglCreateImageKHR(GLSurfaceEGL::GetHardwareDisplay(), |
21 EGL_NO_CONTEXT, | 22 EGL_NO_CONTEXT, |
22 target, | 23 target, |
(...skipping 18 matching lines...) Expand all Loading... |
41 gfx::Size GLImageEGL::GetSize() { return size_; } | 42 gfx::Size GLImageEGL::GetSize() { return size_; } |
42 | 43 |
43 bool GLImageEGL::BindTexImage(unsigned target) { | 44 bool GLImageEGL::BindTexImage(unsigned target) { |
44 DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_); | 45 DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_); |
45 glEGLImageTargetTexture2DOES(target, egl_image_); | 46 glEGLImageTargetTexture2DOES(target, egl_image_); |
46 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 47 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
47 return true; | 48 return true; |
48 } | 49 } |
49 | 50 |
50 } // namespace gfx | 51 } // namespace gfx |
OLD | NEW |