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 #include "content/common/gpu/media/rendering_helper.h" | 5 #include "content/common/gpu/media/rendering_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/mac/scoped_nsautorelease_pool.h" | 8 #include "base/mac/scoped_nsautorelease_pool.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/stringize_macros.h" | 10 #include "base/strings/stringize_macros.h" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
13 #include "ui/gl/gl_context_stub_with_extensions.h" | 13 #include "ui/gl/gl_context_stub_with_extensions.h" |
14 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
15 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
16 | 16 |
17 #if defined(USE_X11) | |
18 #include "ui/gfx/x/x11_types.h" | |
19 #endif | |
20 | |
21 #ifdef GL_VARIANT_GLX | 17 #ifdef GL_VARIANT_GLX |
22 typedef GLXWindow NativeWindowType; | 18 typedef GLXWindow NativeWindowType; |
23 struct XFreeDeleter { | 19 struct XFreeDeleter { |
24 void operator()(void* x) const { ::XFree(x); } | 20 void operator()(void* x) const { ::XFree(x); } |
25 }; | 21 }; |
26 #else // EGL | 22 #else // EGL |
27 typedef EGLNativeWindowType NativeWindowType; | 23 typedef EGLNativeWindowType NativeWindowType; |
28 #endif | 24 #endif |
29 | 25 |
30 // Helper for Shader creation. | 26 // Helper for Shader creation. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 105 |
110 CHECK_GT(params.window_dimensions.size(), 0U); | 106 CHECK_GT(params.window_dimensions.size(), 0U); |
111 CHECK_EQ(params.frame_dimensions.size(), params.window_dimensions.size()); | 107 CHECK_EQ(params.frame_dimensions.size(), params.window_dimensions.size()); |
112 window_dimensions_ = params.window_dimensions; | 108 window_dimensions_ = params.window_dimensions; |
113 frame_dimensions_ = params.frame_dimensions; | 109 frame_dimensions_ = params.frame_dimensions; |
114 render_as_thumbnails_ = params.render_as_thumbnails; | 110 render_as_thumbnails_ = params.render_as_thumbnails; |
115 message_loop_ = base::MessageLoop::current(); | 111 message_loop_ = base::MessageLoop::current(); |
116 CHECK_GT(params.num_windows, 0); | 112 CHECK_GT(params.num_windows, 0); |
117 | 113 |
118 #if GL_VARIANT_GLX | 114 #if GL_VARIANT_GLX |
119 x_display_ = gfx::GetXDisplay(); | 115 x_display_ = base::MessagePumpForUI::GetDefaultXDisplay(); |
120 CHECK(x_display_); | 116 CHECK(x_display_); |
121 CHECK(glXQueryVersion(x_display_, NULL, NULL)); | 117 CHECK(glXQueryVersion(x_display_, NULL, NULL)); |
122 const int fbconfig_attr[] = { | 118 const int fbconfig_attr[] = { |
123 GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, | 119 GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, |
124 GLX_RENDER_TYPE, GLX_RGBA_BIT, | 120 GLX_RENDER_TYPE, GLX_RGBA_BIT, |
125 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, | 121 GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, |
126 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE, | 122 GLX_BIND_TO_TEXTURE_RGB_EXT, GL_TRUE, |
127 GLX_DOUBLEBUFFER, True, | 123 GLX_DOUBLEBUFFER, True, |
128 GL_NONE, | 124 GL_NONE, |
129 }; | 125 }; |
(...skipping 11 matching lines...) Expand all Loading... |
141 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); | 137 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); |
142 stub_context->SetGLVersionString( | 138 stub_context->SetGLVersionString( |
143 reinterpret_cast<const char*>(glGetString(GL_VERSION))); | 139 reinterpret_cast<const char*>(glGetString(GL_VERSION))); |
144 | 140 |
145 #else // EGL | 141 #else // EGL |
146 EGLNativeDisplayType native_display; | 142 EGLNativeDisplayType native_display; |
147 | 143 |
148 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
149 native_display = EGL_DEFAULT_DISPLAY; | 145 native_display = EGL_DEFAULT_DISPLAY; |
150 #else | 146 #else |
151 x_display_ = gfx::GetXDisplay(); | 147 x_display_ = base::MessagePumpForUI::GetDefaultXDisplay(); |
152 CHECK(x_display_); | 148 CHECK(x_display_); |
153 native_display = x_display_; | 149 native_display = x_display_; |
154 #endif | 150 #endif |
155 | 151 |
156 gl_display_ = eglGetDisplay(native_display); | 152 gl_display_ = eglGetDisplay(native_display); |
157 CHECK(gl_display_); | 153 CHECK(gl_display_); |
158 CHECK(eglInitialize(gl_display_, NULL, NULL)) << glGetError(); | 154 CHECK(eglInitialize(gl_display_, NULL, NULL)) << glGetError(); |
159 | 155 |
160 static EGLint rgba8888[] = { | 156 static EGLint rgba8888[] = { |
161 EGL_RED_SIZE, 8, | 157 EGL_RED_SIZE, 8, |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 *rgb_ptr++ = *rgba_ptr++; | 557 *rgb_ptr++ = *rgba_ptr++; |
562 solid = solid && (*rgba_ptr == 0xff); | 558 solid = solid && (*rgba_ptr == 0xff); |
563 rgba_ptr++; | 559 rgba_ptr++; |
564 } | 560 } |
565 *alpha_solid = solid; | 561 *alpha_solid = solid; |
566 | 562 |
567 done->Signal(); | 563 done->Signal(); |
568 } | 564 } |
569 | 565 |
570 } // namespace content | 566 } // namespace content |
OLD | NEW |