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> |
11 | 11 |
12 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
15 #include "ui/gfx/buffer_types.h" | 16 #include "ui/gfx/buffer_types.h" |
16 #include "ui/gfx/generic_shared_memory_id.h" | 17 #include "ui/gfx/generic_shared_memory_id.h" |
17 #include "ui/gl/gl_image.h" | 18 #include "ui/gl/gl_image.h" |
18 | 19 |
19 #if defined(__OBJC__) | 20 #if defined(__OBJC__) |
20 @class CALayer; | 21 @class CALayer; |
21 #else | 22 #else |
22 typedef void* CALayer; | 23 typedef void* CALayer; |
23 #endif | 24 #endif |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer(); | 65 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer(); |
65 | 66 |
66 static void SetLayerForWidget(gfx::AcceleratedWidget widget, CALayer* layer); | 67 static void SetLayerForWidget(gfx::AcceleratedWidget widget, CALayer* layer); |
67 | 68 |
68 static unsigned GetInternalFormatForTesting(gfx::BufferFormat format); | 69 static unsigned GetInternalFormatForTesting(gfx::BufferFormat format); |
69 | 70 |
70 protected: | 71 protected: |
71 ~GLImageIOSurface() override; | 72 ~GLImageIOSurface() override; |
72 | 73 |
73 private: | 74 private: |
| 75 class RGBConverter; |
| 76 |
74 const gfx::Size size_; | 77 const gfx::Size size_; |
75 const unsigned internalformat_; | 78 const unsigned internalformat_; |
76 gfx::BufferFormat format_; | 79 gfx::BufferFormat format_; |
77 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; | 80 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; |
78 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_; | 81 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer_; |
79 gfx::GenericSharedMemoryId io_surface_id_; | 82 gfx::GenericSharedMemoryId io_surface_id_; |
80 base::ThreadChecker thread_checker_; | 83 base::ThreadChecker thread_checker_; |
81 | 84 |
82 // GL state to support 420v IOSurface conversion to RGB. | 85 // GL state to support 420v IOSurface conversion to RGB. |
83 unsigned framebuffer_ = 0; | 86 scoped_ptr<RGBConverter> rgb_converter_; |
84 unsigned vertex_shader_ = 0; | |
85 unsigned fragment_shader_ = 0; | |
86 unsigned program_ = 0; | |
87 int size_location_ = -1; | |
88 unsigned vertex_buffer_ = 0; | |
89 unsigned yuv_textures_[2] = {}; | |
90 | 87 |
91 DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); | 88 DISALLOW_COPY_AND_ASSIGN(GLImageIOSurface); |
92 }; | 89 }; |
93 | 90 |
94 } // namespace gl | 91 } // namespace gl |
95 | 92 |
96 #endif // UI_GL_GL_IMAGE_IO_SURFACE_H_ | 93 #endif // UI_GL_GL_IMAGE_IO_SURFACE_H_ |
OLD | NEW |