Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Side by Side Diff: content/renderer/media/renderer_gpu_video_accelerator_factories.cc

Issue 31583004: Enable glReadPixels from <video> to 2d context on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Re-enable SkCanvasVideoRendererTest.* Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/gtest/filter/media_unittests_disabled ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer/media/renderer_gpu_video_accelerator_factories.h" 5 #include "content/renderer/media/renderer_gpu_video_accelerator_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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 250 gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
251 context->copyTextureCHROMIUM( 251 context->copyTextureCHROMIUM(
252 GL_TEXTURE_2D, texture_id, tmp_texture, 0, GL_RGBA, GL_UNSIGNED_BYTE); 252 GL_TEXTURE_2D, texture_id, tmp_texture, 0, GL_RGBA, GL_UNSIGNED_BYTE);
253 253
254 GLuint fb; 254 GLuint fb;
255 gles2->GenFramebuffers(1, &fb); 255 gles2->GenFramebuffers(1, &fb);
256 gles2->BindFramebuffer(GL_FRAMEBUFFER, fb); 256 gles2->BindFramebuffer(GL_FRAMEBUFFER, fb);
257 gles2->FramebufferTexture2D( 257 gles2->FramebufferTexture2D(
258 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmp_texture, 0); 258 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmp_texture, 0);
259 gles2->PixelStorei(GL_PACK_ALIGNMENT, 4); 259 gles2->PixelStorei(GL_PACK_ALIGNMENT, 4);
260 #if SK_B32_SHIFT == 0 && SK_G32_SHIFT == 8 && SK_R32_SHIFT == 16 && \
scherkus (not reviewing) 2013/10/22 18:29:10 it seems like the cool kids only check for SK_B32_
scherkus (not reviewing) 2013/10/22 18:29:46 ... there really isn't a reason *NOT* to check ...
Ami GONE FROM CHROMIUM 2013/10/22 18:32:59 Yeah, the first version of this code was actually
261 SK_A32_SHIFT == 24
262 GLenum skia_format = GL_BGRA_EXT;
263 #elif SK_R32_SHIFT == 0 && SK_G32_SHIFT == 8 && SK_B32_SHIFT == 16 && \
264 SK_A32_SHIFT == 24
265 GLenum skia_format = GL_RGBA;
266 #else
267 #error Unexpected Skia ARGB_8888 layout!
268 #endif
260 gles2->ReadPixels(0, 269 gles2->ReadPixels(0,
261 0, 270 0,
262 size.width(), 271 size.width(),
263 size.height(), 272 size.height(),
264 GL_BGRA_EXT, 273 skia_format,
265 GL_UNSIGNED_BYTE, 274 GL_UNSIGNED_BYTE,
266 read_pixels_bitmap_.pixelRef()->pixels()); 275 read_pixels_bitmap_.pixelRef()->pixels());
267 gles2->DeleteFramebuffers(1, &fb); 276 gles2->DeleteFramebuffers(1, &fb);
268 gles2->DeleteTextures(1, &tmp_texture); 277 gles2->DeleteTextures(1, &tmp_texture);
269 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); 278 DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
270 message_loop_async_waiter_.Signal(); 279 message_loop_async_waiter_.Signal();
271 } 280 }
272 281
273 base::SharedMemory* RendererGpuVideoAcceleratorFactories::CreateSharedMemory( 282 base::SharedMemory* RendererGpuVideoAcceleratorFactories::CreateSharedMemory(
274 size_t size) { 283 size_t size) {
(...skipping 24 matching lines...) Expand all
299 } 308 }
300 309
301 void 310 void
302 RendererGpuVideoAcceleratorFactories::AsyncDestroyVideoDecodeAccelerator() { 311 RendererGpuVideoAcceleratorFactories::AsyncDestroyVideoDecodeAccelerator() {
303 // OK to release because Destroy() will delete the VDA instance. 312 // OK to release because Destroy() will delete the VDA instance.
304 if (vda_) 313 if (vda_)
305 vda_.release()->Destroy(); 314 vda_.release()->Destroy();
306 } 315 }
307 316
308 } // namespace content 317 } // namespace content
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/filter/media_unittests_disabled ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698