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