| 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 #ifndef UI_GL_GL_IMAGE_IO_SURFACE_H_ | 5 #ifndef UI_GL_GL_IMAGE_IO_SURFACE_H_ |
| 6 #define UI_GL_GL_IMAGE_IO_SURFACE_H_ | 6 #define UI_GL_GL_IMAGE_IO_SURFACE_H_ |
| 7 | 7 |
| 8 #include <IOSurface/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "ui/gfx/gpu_memory_buffer.h" | 12 #include "ui/gfx/gpu_memory_buffer.h" |
| 13 #include "ui/gl/gl_image.h" | 13 #include "ui/gl/gl_image.h" |
| 14 | 14 |
| 15 #if defined(__OBJC__) | 15 #if defined(__OBJC__) |
| 16 @class CALayer; | 16 @class CALayer; |
| 17 #else | 17 #else |
| 18 typedef void* CALayer; | 18 typedef void* CALayer; |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 | 22 |
| 23 class GL_EXPORT GLImageIOSurface : public GLImage { | 23 class GL_EXPORT GLImageIOSurface : public GLImage { |
| 24 public: | 24 public: |
| 25 GLImageIOSurface(const gfx::Size& size, unsigned internalformat); | 25 GLImageIOSurface(gfx::GenericSharedMemoryId io_surface_id, |
| 26 const gfx::Size& size, |
| 27 unsigned internalformat); |
| 26 | 28 |
| 27 bool Initialize(IOSurfaceRef io_surface, | 29 bool Initialize(IOSurfaceRef io_surface, BufferFormat format); |
| 28 gfx::GenericSharedMemoryId io_surface_id, | |
| 29 BufferFormat format); | |
| 30 | 30 |
| 31 // Overridden from GLImage: | 31 // Overridden from GLImage: |
| 32 void Destroy(bool have_context) override; | 32 void Destroy(bool have_context) override; |
| 33 gfx::Size GetSize() override; | 33 gfx::Size GetSize() override; |
| 34 unsigned GetInternalFormat() override; | 34 unsigned GetInternalFormat() override; |
| 35 bool BindTexImage(unsigned target) override; | 35 bool BindTexImage(unsigned target) override; |
| 36 void ReleaseTexImage(unsigned target) override {} | 36 void ReleaseTexImage(unsigned target) override {} |
| 37 bool CopyTexSubImage(unsigned target, | 37 bool CopyTexSubImage(unsigned target, |
| 38 const Point& offset, | 38 const Point& offset, |
| 39 const Rect& rect) override; | 39 const Rect& rect) override; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 52 | 52 |
| 53 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(); | 53 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(); |
| 54 | 54 |
| 55 static void SetLayerForWidget(gfx::AcceleratedWidget widget, | 55 static void SetLayerForWidget(gfx::AcceleratedWidget widget, |
| 56 CALayer* layer); | 56 CALayer* layer); |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 ~GLImageIOSurface() override; | 59 ~GLImageIOSurface() override; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 gfx::GenericSharedMemoryId io_surface_id_; |
| 62 const gfx::Size size_; | 63 const gfx::Size size_; |
| 63 const unsigned internalformat_; | 64 const unsigned internalformat_; |
| 64 BufferFormat format_; | 65 BufferFormat format_; |
| 65 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 66 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
| 66 gfx::GenericSharedMemoryId io_surface_id_; | |
| 67 base::ThreadChecker thread_checker_; | 67 base::ThreadChecker thread_checker_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); | 69 DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace gfx | 72 } // namespace gfx |
| 73 | 73 |
| 74 #endif // UI_GL_GL_IMAGE_IO_SURFACE_H_ | 74 #endif // UI_GL_GL_IMAGE_IO_SURFACE_H_ |
| OLD | NEW |