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