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

Unified Diff: content/renderer/media/renderer_gpu_video_decoder_factories.cc

Issue 11043002: ReadPixels from known-usable textures, and give SkBitmap its precious BGRA. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: BGRA for all! Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/video_frame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/renderer_gpu_video_decoder_factories.cc
diff --git a/content/renderer/media/renderer_gpu_video_decoder_factories.cc b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
index 9ef68e89fa767622c7ce5050cbebedfffa133aaf..431b58719f6a4e0b7a997b44b7fcb563b1211ff5 100644
--- a/content/renderer/media/renderer_gpu_video_decoder_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
@@ -175,22 +175,26 @@ void RendererGpuVideoDecoderFactories::AsyncReadPixels(
gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation();
- gles2->ActiveTexture(GL_TEXTURE0);
- gles2->BindTexture(texture_target, texture_id);
- gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ GLuint tmp_texture;
+ gles2->GenTextures(1, &tmp_texture);
+ gles2->BindTexture(texture_target, tmp_texture);
+ gles2->TexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ gles2->TexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ gles2->TexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ context_->copyTextureCHROMIUM(
+ texture_target, texture_id, tmp_texture, 0, GL_RGBA);
GLuint fb;
gles2->GenFramebuffers(1, &fb);
gles2->BindFramebuffer(GL_FRAMEBUFFER, fb);
gles2->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- texture_target, texture_id, 0);
+ texture_target, tmp_texture, 0);
gles2->PixelStorei(GL_PACK_ALIGNMENT, 4);
- gles2->ReadPixels(0, 0, size.width(), size.height(), GL_RGBA,
+ gles2->ReadPixels(0, 0, size.width(), size.height(), GL_BGRA_EXT,
GL_UNSIGNED_BYTE, pixels);
gles2->DeleteFramebuffers(1, &fb);
+ gles2->DeleteTextures(1, &tmp_texture);
DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
waiter->Signal();
}
« no previous file with comments | « no previous file | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698