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 <algorithm> | 7 #include <algorithm> |
8 #include <numeric> | 8 #include <numeric> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 XStoreName(display, window_, "VideoDecodeAcceleratorTest"); | 164 XStoreName(display, window_, "VideoDecodeAcceleratorTest"); |
165 XSelectInput(display, window_, ExposureMask); | 165 XSelectInput(display, window_, ExposureMask); |
166 XMapWindow(display, window_); | 166 XMapWindow(display, window_); |
167 #else | 167 #else |
168 #error unknown platform | 168 #error unknown platform |
169 #endif | 169 #endif |
170 CHECK(window_ != gfx::kNullAcceleratedWidget); | 170 CHECK(window_ != gfx::kNullAcceleratedWidget); |
171 | 171 |
172 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); | 172 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); |
173 gl_context_ = gfx::GLContext::CreateGLContext( | 173 gl_context_ = gfx::GLContext::CreateGLContext( |
174 NULL, gl_surface_, gfx::PreferIntegratedGpu); | 174 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu); |
175 gl_context_->MakeCurrent(gl_surface_); | 175 gl_context_->MakeCurrent(gl_surface_.get()); |
176 | 176 |
177 CHECK_GT(params.window_sizes.size(), 0U); | 177 CHECK_GT(params.window_sizes.size(), 0U); |
178 videos_.resize(params.window_sizes.size()); | 178 videos_.resize(params.window_sizes.size()); |
179 LayoutRenderingAreas(params.window_sizes); | 179 LayoutRenderingAreas(params.window_sizes); |
180 | 180 |
181 if (render_as_thumbnails_) { | 181 if (render_as_thumbnails_) { |
182 CHECK_EQ(videos_.size(), 1U); | 182 CHECK_EQ(videos_.size(), 1U); |
183 | 183 |
184 GLint max_texture_size; | 184 GLint max_texture_size; |
185 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); | 185 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 CHECK_EQ(base::MessageLoop::current(), message_loop_); | 310 CHECK_EQ(base::MessageLoop::current(), message_loop_); |
311 | 311 |
312 // Deletion will also stop the timer. | 312 // Deletion will also stop the timer. |
313 render_timer_.reset(); | 313 render_timer_.reset(); |
314 | 314 |
315 if (render_as_thumbnails_) { | 315 if (render_as_thumbnails_) { |
316 glDeleteTextures(1, &thumbnails_texture_id_); | 316 glDeleteTextures(1, &thumbnails_texture_id_); |
317 glDeleteFramebuffersEXT(1, &thumbnails_fbo_id_); | 317 glDeleteFramebuffersEXT(1, &thumbnails_fbo_id_); |
318 } | 318 } |
319 | 319 |
320 gl_context_->ReleaseCurrent(gl_surface_); | 320 gl_context_->ReleaseCurrent(gl_surface_.get()); |
321 gl_context_ = NULL; | 321 gl_context_ = NULL; |
322 gl_surface_ = NULL; | 322 gl_surface_ = NULL; |
323 | 323 |
324 Clear(); | 324 Clear(); |
325 done->Signal(); | 325 done->Signal(); |
326 } | 326 } |
327 | 327 |
328 void RenderingHelper::CreateTexture(uint32 texture_target, | 328 void RenderingHelper::CreateTexture(uint32 texture_target, |
329 uint32* texture_id, | 329 uint32* texture_id, |
330 const gfx::Size& size, | 330 const gfx::Size& size, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 scale = std::min(1.0f, scale); | 585 scale = std::min(1.0f, scale); |
586 | 586 |
587 size_t w = scale * size.width(); | 587 size_t w = scale * size.width(); |
588 size_t h = scale * size.height(); | 588 size_t h = scale * size.height(); |
589 size_t x = offset_x[i % cols] + (widths[i % cols] - w) / 2; | 589 size_t x = offset_x[i % cols] + (widths[i % cols] - w) / 2; |
590 size_t y = offset_y[i / cols] + (heights[i / cols] - h) / 2; | 590 size_t y = offset_y[i / cols] + (heights[i / cols] - h) / 2; |
591 videos_[i].render_area = gfx::Rect(x, y, w, h); | 591 videos_[i].render_area = gfx::Rect(x, y, w, h); |
592 } | 592 } |
593 } | 593 } |
594 } // namespace content | 594 } // namespace content |
OLD | NEW |