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 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" | 5 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation(); | 193 gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation(); |
194 | 194 |
195 GLuint tmp_texture; | 195 GLuint tmp_texture; |
196 gles2->GenTextures(1, &tmp_texture); | 196 gles2->GenTextures(1, &tmp_texture); |
197 gles2->BindTexture(texture_target, tmp_texture); | 197 gles2->BindTexture(texture_target, tmp_texture); |
198 gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 198 gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
199 gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 199 gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
200 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 200 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
201 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 201 gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
202 context_->copyTextureCHROMIUM( | 202 context_->copyTextureCHROMIUM( |
203 texture_target, texture_id, tmp_texture, 0, GL_RGBA); | 203 texture_target, texture_id, tmp_texture, 0, GL_RGBA, GL_UNSIGNED_BYTE); |
204 | 204 |
205 GLuint fb; | 205 GLuint fb; |
206 gles2->GenFramebuffers(1, &fb); | 206 gles2->GenFramebuffers(1, &fb); |
207 gles2->BindFramebuffer(GL_FRAMEBUFFER, fb); | 207 gles2->BindFramebuffer(GL_FRAMEBUFFER, fb); |
208 gles2->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 208 gles2->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
209 texture_target, tmp_texture, 0); | 209 texture_target, tmp_texture, 0); |
210 gles2->PixelStorei(GL_PACK_ALIGNMENT, 4); | 210 gles2->PixelStorei(GL_PACK_ALIGNMENT, 4); |
211 gles2->ReadPixels(0, 0, size.width(), size.height(), GL_BGRA_EXT, | 211 gles2->ReadPixels(0, 0, size.width(), size.height(), GL_BGRA_EXT, |
212 GL_UNSIGNED_BYTE, read_pixels_bitmap_.pixelRef()->pixels()); | 212 GL_UNSIGNED_BYTE, read_pixels_bitmap_.pixelRef()->pixels()); |
213 gles2->DeleteFramebuffers(1, &fb); | 213 gles2->DeleteFramebuffers(1, &fb); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 return aborted_waiter_.IsSignaled(); | 251 return aborted_waiter_.IsSignaled(); |
252 } | 252 } |
253 | 253 |
254 void RendererGpuVideoDecoderFactories::AsyncDestroyVideoDecodeAccelerator() { | 254 void RendererGpuVideoDecoderFactories::AsyncDestroyVideoDecodeAccelerator() { |
255 // OK to release because Destroy() will delete the VDA instance. | 255 // OK to release because Destroy() will delete the VDA instance. |
256 if (vda_) | 256 if (vda_) |
257 vda_.release()->Destroy(); | 257 vda_.release()->Destroy(); |
258 } | 258 } |
259 | 259 |
260 } // namespace content | 260 } // namespace content |
OLD | NEW |