OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Ami GONE FROM CHROMIUM
2014/05/08 21:15:09
CL description has a bunch of typos; please fix
| |
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 CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "ui/gfx/size.h" | 12 #include "base/time/time.h" |
13 #include "ui/gfx/geometry/rect.h" | |
14 #include "ui/gfx/geometry/size.h" | |
13 #include "ui/gl/gl_bindings.h" | 15 #include "ui/gl/gl_bindings.h" |
14 | 16 |
15 namespace base { | 17 namespace base { |
16 class MessageLoop; | 18 class MessageLoop; |
17 class WaitableEvent; | 19 class WaitableEvent; |
18 } | 20 } |
19 | 21 |
20 #if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY) | 22 #if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY) |
21 #define GL_VARIANT_GLX 1 | 23 #define GL_VARIANT_GLX 1 |
22 typedef GLXContext NativeContextType; | 24 typedef GLXContext NativeContextType; |
23 #else | 25 #else |
24 #define GL_VARIANT_EGL 1 | 26 #define GL_VARIANT_EGL 1 |
25 typedef EGLContext NativeContextType; | 27 typedef EGLContext NativeContextType; |
26 #endif | 28 #endif |
27 | 29 |
28 namespace content { | 30 namespace content { |
29 | 31 |
32 enum RenderingState { | |
Ami GONE FROM CHROMIUM
2014/05/08 21:15:09
only used by the impl; should be in the private: s
Owen Lin
2014/05/09 10:25:03
Done.
| |
33 RENDERING_START, RENDERING_STOPPING, RENDERING_STOPPED | |
34 }; | |
35 | |
30 struct RenderingHelperParams { | 36 struct RenderingHelperParams { |
31 RenderingHelperParams(); | 37 RenderingHelperParams(); |
32 ~RenderingHelperParams(); | 38 ~RenderingHelperParams(); |
33 | 39 |
34 bool suppress_swap_to_display; | 40 bool suppress_swap_to_display; |
35 int num_windows; | 41 int num_windows; |
36 // Dimensions of window(s) created for displaying frames. In the | 42 // Dimensions of window(s) created for displaying frames. In the |
37 // case of thumbnail rendering, these won't match the frame dimensions. | 43 // case of thumbnail rendering, these won't match the frame dimensions. |
38 std::vector<gfx::Size> window_dimensions; | 44 std::vector<gfx::Size> window_dimensions; |
39 // Dimensions of video frame texture(s). | 45 // Dimensions of video frame texture(s). |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 NativeContextType GetGLContext(); | 88 NativeContextType GetGLContext(); |
83 | 89 |
84 // Get rendered thumbnails as RGB. | 90 // Get rendered thumbnails as RGB. |
85 // Sets alpha_solid to true if the alpha channel is entirely 0xff. | 91 // Sets alpha_solid to true if the alpha channel is entirely 0xff. |
86 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, | 92 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, |
87 bool* alpha_solid, | 93 bool* alpha_solid, |
88 base::WaitableEvent* done); | 94 base::WaitableEvent* done); |
89 | 95 |
90 private: | 96 private: |
91 void Clear(); | 97 void Clear(); |
98 void StartRendering(); | |
99 void StopRendering(); | |
100 | |
92 | 101 |
93 // Make window_id's surface current w/ the GL context, or release the context | 102 // Make window_id's surface current w/ the GL context, or release the context |
94 // if |window_id < 0|. | 103 // if |window_id < 0|. |
95 void MakeCurrent(int window_id); | 104 void MakeCurrent(int window_id); |
96 | 105 |
106 void RenderContent(); | |
107 void DrawTexture(const gfx::Rect &area, | |
108 uint32 texture_target, | |
109 uint32 texture_id); | |
110 | |
97 base::MessageLoop* message_loop_; | 111 base::MessageLoop* message_loop_; |
98 std::vector<gfx::Size> window_dimensions_; | |
99 std::vector<gfx::Size> frame_dimensions_; | 112 std::vector<gfx::Size> frame_dimensions_; |
100 | 113 |
101 NativeContextType gl_context_; | 114 NativeContextType gl_context_; |
102 std::map<uint32, int> texture_id_to_surface_index_; | 115 std::map<uint32, int> texture_id_to_surface_index_; |
103 | 116 |
104 #if defined(GL_VARIANT_EGL) | 117 #if defined(GL_VARIANT_EGL) |
105 EGLDisplay gl_display_; | 118 EGLDisplay gl_display_; |
106 std::vector<EGLSurface> gl_surfaces_; | 119 EGLSurface gl_surface_; |
107 #else | 120 #else |
108 XVisualInfo* x_visual_; | 121 XVisualInfo* x_visual_; |
109 #endif | 122 #endif |
110 | 123 |
111 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
112 std::vector<HWND> windows_; | 125 HWND window_; |
113 #else | 126 #else |
114 Display* x_display_; | 127 Display* x_display_; |
115 std::vector<Window> x_windows_; | 128 Window x_window_; |
116 #endif | 129 #endif |
117 | 130 |
131 std::vector<gfx::Rect> render_areas_; | |
132 std::vector<uint32> texture_ids_; | |
133 std::vector<uint32> texture_targets_; | |
134 | |
118 bool render_as_thumbnails_; | 135 bool render_as_thumbnails_; |
136 RenderingState rendering_state_; | |
119 int frame_count_; | 137 int frame_count_; |
120 GLuint thumbnails_fbo_id_; | 138 GLuint thumbnails_fbo_id_; |
121 GLuint thumbnails_texture_id_; | 139 GLuint thumbnails_texture_id_; |
122 gfx::Size thumbnails_fbo_size_; | 140 gfx::Size thumbnails_fbo_size_; |
123 gfx::Size thumbnail_size_; | 141 gfx::Size thumbnail_size_; |
124 GLuint program_; | 142 GLuint program_; |
143 base::TimeDelta frame_duration_; | |
125 | 144 |
126 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); | 145 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); |
127 }; | 146 }; |
128 | 147 |
129 } // namespace content | 148 } // namespace content |
130 | 149 |
131 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 150 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
OLD | NEW |