| 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/buffer_types.h" |
| 13 #include "ui/gfx/generic_shared_memory_id.h" |
| 13 #include "ui/gl/gl_image.h" | 14 #include "ui/gl/gl_image.h" |
| 14 | 15 |
| 15 #if defined(__OBJC__) | 16 #if defined(__OBJC__) |
| 16 @class CALayer; | 17 @class CALayer; |
| 17 #else | 18 #else |
| 18 typedef void* CALayer; | 19 typedef void* CALayer; |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 namespace gfx { | 22 namespace gfx { |
| 22 | 23 |
| 23 class GL_EXPORT GLImageIOSurface : public GLImage { | 24 class GL_EXPORT GLImageIOSurface : public GLImage { |
| 24 public: | 25 public: |
| 25 GLImageIOSurface(const gfx::Size& size, unsigned internalformat); | 26 GLImageIOSurface(const Size& size, unsigned internalformat); |
| 26 | 27 |
| 27 bool Initialize(IOSurfaceRef io_surface, | 28 bool Initialize(IOSurfaceRef io_surface, |
| 28 gfx::GenericSharedMemoryId io_surface_id, | 29 GenericSharedMemoryId io_surface_id, |
| 29 BufferFormat format); | 30 BufferFormat format); |
| 30 | 31 |
| 31 // Overridden from GLImage: | 32 // Overridden from GLImage: |
| 32 void Destroy(bool have_context) override; | 33 void Destroy(bool have_context) override; |
| 33 gfx::Size GetSize() override; | 34 Size GetSize() override; |
| 34 unsigned GetInternalFormat() override; | 35 unsigned GetInternalFormat() override; |
| 35 bool BindTexImage(unsigned target) override; | 36 bool BindTexImage(unsigned target) override; |
| 36 void ReleaseTexImage(unsigned target) override {} | 37 void ReleaseTexImage(unsigned target) override {} |
| 38 bool CopyTexImage(unsigned target) override; |
| 37 bool CopyTexSubImage(unsigned target, | 39 bool CopyTexSubImage(unsigned target, |
| 38 const Point& offset, | 40 const Point& offset, |
| 39 const Rect& rect) override; | 41 const Rect& rect) override; |
| 40 void WillUseTexImage() override {} | 42 bool ScheduleOverlayPlane(AcceleratedWidget widget, |
| 41 void DidUseTexImage() override {} | |
| 42 void WillModifyTexImage() override {} | |
| 43 void DidModifyTexImage() override {} | |
| 44 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | |
| 45 int z_order, | 43 int z_order, |
| 46 OverlayTransform transform, | 44 OverlayTransform transform, |
| 47 const Rect& bounds_rect, | 45 const Rect& bounds_rect, |
| 48 const RectF& crop_rect) override; | 46 const RectF& crop_rect) override; |
| 49 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, | 47 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
| 50 uint64_t process_tracing_id, | 48 uint64_t process_tracing_id, |
| 51 const std::string& dump_name) override; | 49 const std::string& dump_name) override; |
| 52 | 50 |
| 53 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(); | 51 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(); |
| 54 | 52 |
| 55 static void SetLayerForWidget(gfx::AcceleratedWidget widget, | 53 static void SetLayerForWidget(AcceleratedWidget widget, CALayer* layer); |
| 56 CALayer* layer); | |
| 57 | 54 |
| 58 protected: | 55 protected: |
| 59 ~GLImageIOSurface() override; | 56 ~GLImageIOSurface() override; |
| 60 | 57 |
| 61 private: | 58 private: |
| 62 const gfx::Size size_; | 59 const Size size_; |
| 63 const unsigned internalformat_; | 60 const unsigned internalformat_; |
| 64 BufferFormat format_; | 61 BufferFormat format_; |
| 65 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 62 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
| 66 gfx::GenericSharedMemoryId io_surface_id_; | 63 GenericSharedMemoryId io_surface_id_; |
| 67 base::ThreadChecker thread_checker_; | 64 base::ThreadChecker thread_checker_; |
| 68 | 65 |
| 69 DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); | 66 DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); |
| 70 }; | 67 }; |
| 71 | 68 |
| 72 } // namespace gfx | 69 } // namespace gfx |
| 73 | 70 |
| 74 #endif // UI_GL_GL_IMAGE_IO_SURFACE_H_ | 71 #endif // UI_GL_GL_IMAGE_IO_SURFACE_H_ |
| OLD | NEW |