| 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/egl_util.h" | 7 #include "ui/gl/egl_util.h" |
| 8 #include "ui/gl/gl_surface_egl.h" | 8 #include "ui/gl/gl_surface_egl.h" |
| 9 | 9 |
| 10 namespace gl { | 10 namespace gl { |
| 11 | 11 |
| 12 GLImageEGL::GLImageEGL(const gfx::Size& size) | 12 GLImageEGL::GLImageEGL(const gfx::Size& size) |
| 13 : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {} | 13 : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {} |
| 14 | 14 |
| 15 GLImageEGL::~GLImageEGL() { | 15 GLImageEGL::~GLImageEGL() { |
| 16 DCHECK(thread_checker_.CalledOnValidThread()); | 16 DCHECK(thread_checker_.CalledOnValidThread()); |
| 17 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); | 17 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool GLImageEGL::Initialize(EGLenum target, | 20 bool GLImageEGL::Initialize(EGLenum target, |
| 21 EGLClientBuffer buffer, | 21 EGLClientBuffer buffer, |
| 22 const EGLint* attrs) { | 22 const EGLint* attrs) { |
| 23 DCHECK(thread_checker_.CalledOnValidThread()); | 23 DCHECK(thread_checker_.CalledOnValidThread()); |
| 24 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); | 24 DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_); |
| 25 egl_image_ = eglCreateImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), | 25 egl_image_ = eglCreateImageKHR(gl::GLSurfaceEGL::GetHardwareDisplay(), |
| 26 EGL_NO_CONTEXT, | 26 EGL_NO_CONTEXT, target, buffer, attrs); |
| 27 target, | |
| 28 buffer, | |
| 29 attrs); | |
| 30 if (egl_image_ == EGL_NO_IMAGE_KHR) { | 27 if (egl_image_ == EGL_NO_IMAGE_KHR) { |
| 31 DLOG(ERROR) << "Error creating EGLImage: " << ui::GetLastEGLErrorString(); | 28 DLOG(ERROR) << "Error creating EGLImage: " << ui::GetLastEGLErrorString(); |
| 32 return false; | 29 return false; |
| 33 } | 30 } |
| 34 | 31 |
| 35 return true; | 32 return true; |
| 36 } | 33 } |
| 37 | 34 |
| 38 void GLImageEGL::Destroy(bool have_context) { | 35 void GLImageEGL::Destroy(bool have_context) { |
| 39 DCHECK(thread_checker_.CalledOnValidThread()); | 36 DCHECK(thread_checker_.CalledOnValidThread()); |
| 40 if (egl_image_ != EGL_NO_IMAGE_KHR) { | 37 if (egl_image_ != EGL_NO_IMAGE_KHR) { |
| 41 EGLBoolean result = | 38 EGLBoolean result = |
| 42 eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), egl_image_); | 39 eglDestroyImageKHR(gl::GLSurfaceEGL::GetHardwareDisplay(), egl_image_); |
| 43 if (result == EGL_FALSE) { | 40 if (result == EGL_FALSE) { |
| 44 DLOG(ERROR) << "Error destroying EGLImage: " | 41 DLOG(ERROR) << "Error destroying EGLImage: " |
| 45 << ui::GetLastEGLErrorString(); | 42 << ui::GetLastEGLErrorString(); |
| 46 } | 43 } |
| 47 egl_image_ = EGL_NO_IMAGE_KHR; | 44 egl_image_ = EGL_NO_IMAGE_KHR; |
| 48 } | 45 } |
| 49 } | 46 } |
| 50 | 47 |
| 51 gfx::Size GLImageEGL::GetSize() { | 48 gfx::Size GLImageEGL::GetSize() { |
| 52 return size_; | 49 return size_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 | 73 |
| 77 bool GLImageEGL::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 74 bool GLImageEGL::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 78 int z_order, | 75 int z_order, |
| 79 gfx::OverlayTransform transform, | 76 gfx::OverlayTransform transform, |
| 80 const gfx::Rect& bounds_rect, | 77 const gfx::Rect& bounds_rect, |
| 81 const gfx::RectF& crop_rect) { | 78 const gfx::RectF& crop_rect) { |
| 82 return false; | 79 return false; |
| 83 } | 80 } |
| 84 | 81 |
| 85 } // namespace gl | 82 } // namespace gl |
| OLD | NEW |