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 <CoreVideo/CVPixelBuffer.h> | 8 #include <CoreVideo/CVPixelBuffer.h> |
9 #include <IOSurface/IOSurface.h> | 9 #include <IOSurface/IOSurface.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 gfx::GenericSharedMemoryId io_surface_id() const { return io_surface_id_; } | 64 gfx::GenericSharedMemoryId io_surface_id() const { return io_surface_id_; } |
65 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(); | 65 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(); |
66 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer(); | 66 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer(); |
67 | 67 |
68 // Whether checking IOSurfaceIsInUse() will actually provide a meaningful | 68 // Whether checking IOSurfaceIsInUse() will actually provide a meaningful |
69 // signal about whether the Window Server is still using the IOSurface. | 69 // signal about whether the Window Server is still using the IOSurface. |
70 bool CanCheckIOSurfaceIsInUse() const; | 70 bool CanCheckIOSurfaceIsInUse() const; |
71 | 71 |
72 static unsigned GetInternalFormatForTesting(gfx::BufferFormat format); | 72 static unsigned GetInternalFormatForTesting(gfx::BufferFormat format); |
73 | 73 |
| 74 // Downcasts from |image|. Returns |nullptr| on failure. |
| 75 static GLImageIOSurface* FromGLImage(GLImage* image); |
| 76 |
74 protected: | 77 protected: |
75 ~GLImageIOSurface() override; | 78 ~GLImageIOSurface() override; |
76 | 79 |
77 private: | 80 private: |
| 81 Type GetType() const override; |
78 class RGBConverter; | 82 class RGBConverter; |
79 | 83 |
80 const gfx::Size size_; | 84 const gfx::Size size_; |
81 | 85 |
82 // The "internalformat" exposed to the command buffer, which may not be | 86 // The "internalformat" exposed to the command buffer, which may not be |
83 // "internalformat" requested by the client. | 87 // "internalformat" requested by the client. |
84 const unsigned internalformat_; | 88 const unsigned internalformat_; |
85 | 89 |
86 // The "internalformat" requested by the client. | 90 // The "internalformat" requested by the client. |
87 const unsigned client_internalformat_; | 91 const unsigned client_internalformat_; |
88 | 92 |
89 gfx::BufferFormat format_; | 93 gfx::BufferFormat format_; |
90 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 94 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
91 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_; | 95 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_; |
92 gfx::GenericSharedMemoryId io_surface_id_; | 96 gfx::GenericSharedMemoryId io_surface_id_; |
93 base::ThreadChecker thread_checker_; | 97 base::ThreadChecker thread_checker_; |
94 | 98 |
95 DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); | 99 DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); |
96 }; | 100 }; |
97 | 101 |
98 } // namespace gl | 102 } // namespace gl |
99 | 103 |
100 #endif // UI_GL_GL_IMAGE_IO_SURFACE_H_ | 104 #endif // UI_GL_GL_IMAGE_IO_SURFACE_H_ |
OLD | NEW |