| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_io_surface.h" | 5 #include "ui/gl/gl_image_io_surface.h" |
| 6 | 6 |
| 7 #include "ui/gl/gl_bindings.h" | 7 #include "ui/gl/gl_bindings.h" |
| 8 #include "ui/gl/gl_context.h" | 8 #include "ui/gl/gl_context.h" |
| 9 | 9 |
| 10 // Note that this must be included after gl_bindings.h to avoid conflicts. | 10 // Note that this must be included after gl_bindings.h to avoid conflicts. |
| 11 #include <OpenGL/CGLIOSurface.h> | 11 #include <OpenGL/CGLIOSurface.h> |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 | 14 |
| 15 GLImageIOSurface::GLImageIOSurface(const gfx::Size& size) : size_(size) { | 15 GLImageIOSurface::GLImageIOSurface(const gfx::Size& size) : size_(size) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 GLImageIOSurface::~GLImageIOSurface() { | 18 GLImageIOSurface::~GLImageIOSurface() { |
| 19 DCHECK(!io_surface_); | 19 DCHECK(!io_surface_); |
| 20 } | 20 } |
| 21 | 21 |
| 22 bool GLImageIOSurface::Initialize(const gfx::GpuMemoryBufferHandle& handle) { | 22 bool GLImageIOSurface::Initialize(IOSurfaceRef io_surface) { |
| 23 io_surface_.reset(IOSurfaceLookup(handle.io_surface_id)); | 23 DCHECK(!io_surface_); |
| 24 if (!io_surface_) { | 24 io_surface_.reset(io_surface); |
| 25 LOG(ERROR) << "IOSurface lookup failed"; | |
| 26 return false; | |
| 27 } | |
| 28 | |
| 29 return true; | 25 return true; |
| 30 } | 26 } |
| 31 | 27 |
| 32 void GLImageIOSurface::Destroy(bool have_context) { | 28 void GLImageIOSurface::Destroy(bool have_context) { |
| 33 io_surface_.reset(); | 29 io_surface_.reset(); |
| 34 } | 30 } |
| 35 | 31 |
| 36 gfx::Size GLImageIOSurface::GetSize() { return size_; } | 32 gfx::Size GLImageIOSurface::GetSize() { return size_; } |
| 37 | 33 |
| 38 bool GLImageIOSurface::BindTexImage(unsigned target) { | 34 bool GLImageIOSurface::BindTexImage(unsigned target) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 66 |
| 71 bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 67 bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 72 int z_order, | 68 int z_order, |
| 73 OverlayTransform transform, | 69 OverlayTransform transform, |
| 74 const Rect& bounds_rect, | 70 const Rect& bounds_rect, |
| 75 const RectF& crop_rect) { | 71 const RectF& crop_rect) { |
| 76 return false; | 72 return false; |
| 77 } | 73 } |
| 78 | 74 |
| 79 } // namespace gfx | 75 } // namespace gfx |
| OLD | NEW |