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