| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <EGL/egl.h> | 5 #include <EGL/egl.h> |
| 6 #include <EGL/eglext.h> | 6 #include <EGL/eglext.h> |
| 7 | 7 |
| 8 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h
" | 8 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h
" |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (!gl_decoder) | 270 if (!gl_decoder) |
| 271 return; | 271 return; |
| 272 | 272 |
| 273 const gfx::Size size = state_provider_->GetSize(); | 273 const gfx::Size size = state_provider_->GetSize(); |
| 274 | 274 |
| 275 // Create a 2D texture to hold a copy of the SurfaceTexture's front buffer. | 275 // Create a 2D texture to hold a copy of the SurfaceTexture's front buffer. |
| 276 GLuint tmp_texture_id; | 276 GLuint tmp_texture_id; |
| 277 glGenTextures(1, &tmp_texture_id); | 277 glGenTextures(1, &tmp_texture_id); |
| 278 { | 278 { |
| 279 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, tmp_texture_id); | 279 gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_2D, tmp_texture_id); |
| 280 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 280 // The target texture's size will exactly match the source. |
| 281 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 282 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 281 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 283 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 282 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 284 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 283 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, | 285 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, |
| 284 GL_RGBA, GL_UNSIGNED_BYTE, nullptr); | 286 GL_RGBA, GL_UNSIGNED_BYTE, nullptr); |
| 285 } | 287 } |
| 286 | 288 |
| 287 // TODO(liberato,watk): Use the SurfaceTexture matrix when copying. | 289 // TODO(liberato,watk): Use the SurfaceTexture matrix when copying. |
| 288 gpu::CopyTextureCHROMIUMResourceManager copier; | 290 gpu::CopyTextureCHROMIUMResourceManager copier; |
| 289 copier.Initialize( | 291 copier.Initialize( |
| 290 gl_decoder, | 292 gl_decoder, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 321 | 323 |
| 322 EGLBoolean result = | 324 EGLBoolean result = |
| 323 eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), egl_image); | 325 eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), egl_image); |
| 324 if (result == EGL_FALSE) { | 326 if (result == EGL_FALSE) { |
| 325 DLOG(ERROR) << "Error destroying EGLImage: " | 327 DLOG(ERROR) << "Error destroying EGLImage: " |
| 326 << ui::GetLastEGLErrorString(); | 328 << ui::GetLastEGLErrorString(); |
| 327 } | 329 } |
| 328 } | 330 } |
| 329 | 331 |
| 330 } // namespace content | 332 } // namespace content |
| OLD | NEW |