| 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_fence.h" |
| 8 #include "ui/gl/gl_surface_egl.h" | 9 #include "ui/gl/gl_surface_egl.h" |
| 9 | 10 |
| 10 namespace gl { | 11 namespace gl { |
| 11 | 12 |
| 12 GLImageEGL::GLImageEGL(const gfx::Size& size) | 13 GLImageEGL::GLImageEGL(const gfx::Size& size) |
| 13 : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {} | 14 : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {} |
| 14 | 15 |
| 15 GLImageEGL::~GLImageEGL() { | 16 GLImageEGL::~GLImageEGL() { |
| 16 DCHECK(thread_checker_.CalledOnValidThread()); | 17 DCHECK(thread_checker_.CalledOnValidThread()); |
| 17 if (egl_image_ != EGL_NO_IMAGE_KHR) { | 18 if (egl_image_ != EGL_NO_IMAGE_KHR) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 return true; | 40 return true; |
| 40 } | 41 } |
| 41 | 42 |
| 42 gfx::Size GLImageEGL::GetSize() { | 43 gfx::Size GLImageEGL::GetSize() { |
| 43 return size_; | 44 return size_; |
| 44 } | 45 } |
| 45 | 46 |
| 46 unsigned GLImageEGL::GetInternalFormat() { return GL_RGBA; } | 47 unsigned GLImageEGL::GetInternalFormat() { return GL_RGBA; } |
| 47 | 48 |
| 48 bool GLImageEGL::BindTexImage(unsigned target) { | 49 bool GLImageEGL::BindTexImage(unsigned target, GLFence* fence) { |
| 49 DCHECK(thread_checker_.CalledOnValidThread()); | 50 DCHECK(thread_checker_.CalledOnValidThread()); |
| 50 if (egl_image_ == EGL_NO_IMAGE_KHR) | 51 if (egl_image_ == EGL_NO_IMAGE_KHR) |
| 51 return false; | 52 return false; |
| 52 | 53 |
| 54 // Prevent image from being used before |fence| has signaled. |
| 55 // Note: Fence implementations are allowed to use a client side wait |
| 56 // when server side wait is not supported. |
| 57 if (fence) |
| 58 fence->ServerWait(); |
| 59 |
| 53 glEGLImageTargetTexture2DOES(target, egl_image_); | 60 glEGLImageTargetTexture2DOES(target, egl_image_); |
| 54 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); | 61 DCHECK_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError()); |
| 55 return true; | 62 return true; |
| 56 } | 63 } |
| 57 | 64 |
| 58 bool GLImageEGL::CopyTexImage(unsigned target) { | 65 bool GLImageEGL::CopyTexImage(unsigned target) { |
| 59 return false; | 66 return false; |
| 60 } | 67 } |
| 61 | 68 |
| 62 bool GLImageEGL::CopyTexSubImage(unsigned target, | 69 bool GLImageEGL::CopyTexSubImage(unsigned target, |
| 63 const gfx::Point& offset, | 70 const gfx::Point& offset, |
| 64 const gfx::Rect& rect) { | 71 const gfx::Rect& rect) { |
| 65 return false; | 72 return false; |
| 66 } | 73 } |
| 67 | 74 |
| 68 bool GLImageEGL::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 75 bool GLImageEGL::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 69 int z_order, | 76 int z_order, |
| 70 gfx::OverlayTransform transform, | 77 gfx::OverlayTransform transform, |
| 71 const gfx::Rect& bounds_rect, | 78 const gfx::Rect& bounds_rect, |
| 72 const gfx::RectF& crop_rect) { | 79 const gfx::RectF& crop_rect) { |
| 73 return false; | 80 return false; |
| 74 } | 81 } |
| 75 | 82 |
| 76 } // namespace gl | 83 } // namespace gl |
| OLD | NEW |