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

Unified Diff: media/gpu/rendering_helper.cc

Issue 2943433002: Revert of Remove FORMAT_RGB from gfx::PngCodec (Closed)
Patch Set: 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 4db40b1dbbbeb047b7540ae15e1c1f7b956e9652..1031ed43d592484e6b38d6b182ccb571f9350337 100644
--- a/media/gpu/rendering_helper.cc
+++ b/media/gpu/rendering_helper.cc
@@ -710,12 +710,14 @@
thumbnails_texture_id_ = 0;
}
-void RenderingHelper::GetThumbnailsAsRGBA(std::vector<unsigned char>* rgba,
- base::WaitableEvent* done) {
+void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
+ bool* alpha_solid,
+ base::WaitableEvent* done) {
CHECK(render_as_thumbnails_);
const size_t num_pixels = thumbnails_fbo_size_.GetArea();
- rgba->resize(num_pixels * 4);
+ std::vector<unsigned char> rgba;
+ 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.
@@ -726,6 +728,19 @@
&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