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

Unified Diff: media/gpu/rendering_helper.cc

Issue 2927893002: Remove FORMAT_RGB from gfx::PngCodec (Closed)
Patch Set: Compile fixes Created 3 years, 6 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 | « media/gpu/rendering_helper.h ('k') | media/gpu/video_decode_accelerator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/rendering_helper.cc
diff --git a/media/gpu/rendering_helper.cc b/media/gpu/rendering_helper.cc
index e6696ed9349f07da9711b6e1f782664e55e2f052..693daf2d18a34d9a95dee6da2adafc9c73899388 100644
--- a/media/gpu/rendering_helper.cc
+++ b/media/gpu/rendering_helper.cc
@@ -710,37 +710,20 @@ void RenderingHelper::Clear() {
thumbnails_texture_id_ = 0;
}
-void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
- bool* alpha_solid,
- base::WaitableEvent* done) {
+void RenderingHelper::GetThumbnailsAsRGBA(std::vector<unsigned char>* rgba,
+ base::WaitableEvent* done) {
CHECK(render_as_thumbnails_);
const size_t num_pixels = thumbnails_fbo_size_.GetArea();
- std::vector<unsigned char> rgba;
- rgba.resize(num_pixels * 4);
+ rgba->resize(num_pixels * 4);
glBindFramebufferEXT(GL_FRAMEBUFFER, thumbnails_fbo_id_);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
// We can only count on GL_RGBA/GL_UNSIGNED_BYTE support.
- glReadPixels(0, 0,
- thumbnails_fbo_size_.width(), thumbnails_fbo_size_.height(),
- GL_RGBA,
- GL_UNSIGNED_BYTE,
- &rgba[0]);
+ glReadPixels(0, 0, thumbnails_fbo_size_.width(),
+ thumbnails_fbo_size_.height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ &(*rgba)[0]);
glBindFramebufferEXT(GL_FRAMEBUFFER,
gl_surface_->GetBackingFramebufferObject());
- rgb->resize(num_pixels * 3);
- // Drop the alpha channel, but check as we go that it is all 0xff.
- bool solid = true;
- unsigned char* rgb_ptr = &((*rgb)[0]);
- unsigned char* rgba_ptr = &rgba[0];
- for (size_t i = 0; i < num_pixels; ++i) {
- *rgb_ptr++ = *rgba_ptr++;
- *rgb_ptr++ = *rgba_ptr++;
- *rgb_ptr++ = *rgba_ptr++;
- solid = solid && (*rgba_ptr == 0xff);
- rgba_ptr++;
- }
- *alpha_solid = solid;
done->Signal();
}
« no previous file with comments | « media/gpu/rendering_helper.h ('k') | media/gpu/video_decode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698