Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 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 "base/timer/timer.h" | |
| 14 #include "ui/gfx/geometry/rect.h" | |
| 15 #include "ui/gfx/geometry/size.h" | |
| 13 #include "ui/gl/gl_bindings.h" | 16 #include "ui/gl/gl_bindings.h" |
| 14 | 17 |
| 15 namespace base { | 18 namespace base { |
| 16 class MessageLoop; | 19 class MessageLoop; |
| 17 class WaitableEvent; | 20 class WaitableEvent; |
| 18 } | 21 } |
| 19 | 22 |
| 20 #if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY) | 23 #if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY) |
| 21 #define GL_VARIANT_GLX 1 | 24 #define GL_VARIANT_GLX 1 |
| 22 typedef GLXContext NativeContextType; | 25 typedef GLXContext NativeContextType; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 | 86 |
| 84 // Get rendered thumbnails as RGB. | 87 // Get rendered thumbnails as RGB. |
| 85 // Sets alpha_solid to true if the alpha channel is entirely 0xff. | 88 // Sets alpha_solid to true if the alpha channel is entirely 0xff. |
| 86 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, | 89 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, |
| 87 bool* alpha_solid, | 90 bool* alpha_solid, |
| 88 base::WaitableEvent* done); | 91 base::WaitableEvent* done); |
| 89 | 92 |
| 90 private: | 93 private: |
| 91 void Clear(); | 94 void Clear(); |
| 92 | 95 |
| 93 // Make window_id's surface current w/ the GL context, or release the context | 96 void RenderContent(); |
| 94 // if |window_id < 0|. | 97 void DrawTexture(const gfx::Rect& area, |
| 95 void MakeCurrent(int window_id); | 98 uint32 texture_target, |
| 99 uint32 texture_id); | |
| 96 | 100 |
| 101 base::RepeatingTimer<RenderingHelper> render_timer_; | |
|
Pawel Osciak
2014/05/27 06:21:49
Document please?
Owen Lin
2014/05/27 07:33:51
Done.
| |
| 97 base::MessageLoop* message_loop_; | 102 base::MessageLoop* message_loop_; |
| 98 std::vector<gfx::Size> window_dimensions_; | |
| 99 std::vector<gfx::Size> frame_dimensions_; | 103 std::vector<gfx::Size> frame_dimensions_; |
| 100 | 104 |
| 101 NativeContextType gl_context_; | 105 NativeContextType gl_context_; |
| 102 std::map<uint32, int> texture_id_to_surface_index_; | 106 std::map<uint32, int> texture_id_to_surface_index_; |
| 103 | 107 |
| 104 #if defined(GL_VARIANT_EGL) | 108 #if defined(GL_VARIANT_EGL) |
| 105 EGLDisplay gl_display_; | 109 EGLDisplay gl_display_; |
| 106 std::vector<EGLSurface> gl_surfaces_; | 110 EGLSurface gl_surface_; |
| 107 #else | 111 #else |
| 108 XVisualInfo* x_visual_; | 112 XVisualInfo* x_visual_; |
| 109 #endif | 113 #endif |
| 110 | 114 |
| 111 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
| 112 std::vector<HWND> windows_; | 116 HWND window_; |
| 113 #else | 117 #else |
| 114 Display* x_display_; | 118 Display* x_display_; |
| 115 std::vector<Window> x_windows_; | 119 Window x_window_; |
| 116 #endif | 120 #endif |
| 117 | 121 |
| 122 // The rendering area of each window on the screen. | |
| 123 std::vector<gfx::Rect> render_areas_; | |
| 124 | |
| 125 // The texture to be rendered on each window. | |
| 126 std::vector<uint32> texture_ids_; | |
| 127 std::vector<uint32> texture_targets_; | |
| 128 | |
| 118 bool render_as_thumbnails_; | 129 bool render_as_thumbnails_; |
| 119 int frame_count_; | 130 int frame_count_; |
| 120 GLuint thumbnails_fbo_id_; | 131 GLuint thumbnails_fbo_id_; |
| 121 GLuint thumbnails_texture_id_; | 132 GLuint thumbnails_texture_id_; |
| 122 gfx::Size thumbnails_fbo_size_; | 133 gfx::Size thumbnails_fbo_size_; |
| 123 gfx::Size thumbnail_size_; | 134 gfx::Size thumbnail_size_; |
| 124 GLuint program_; | 135 GLuint program_; |
| 136 base::TimeDelta frame_duration_; | |
| 125 | 137 |
| 126 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); | 138 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); |
| 127 }; | 139 }; |
| 128 | 140 |
| 129 } // namespace content | 141 } // namespace content |
| 130 | 142 |
| 131 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 143 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ |
| OLD | NEW |