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

Unified Diff: media/capture/video/fake_video_capture_device.cc

Issue 2895953003: Use SkJpegEncoder in gfx jpeg_codec (Closed)
Patch Set: Remove brackets 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
Index: media/capture/video/fake_video_capture_device.cc
diff --git a/media/capture/video/fake_video_capture_device.cc b/media/capture/video/fake_video_capture_device.cc
index 2d0ec493b6a7e6604fbecd4488c22d27a4806495..ac4615598c7dd2ffa6281505d3b3517c6618231b 100644
--- a/media/capture/video/fake_video_capture_device.cc
+++ b/media/capture/video/fake_video_capture_device.cc
@@ -591,17 +591,13 @@ void JpegEncodingFrameDeliverer::PaintAndDeliverNextFrame(
frame_painter()->PaintFrame(timestamp_to_paint, &sk_n32_buffer_[0]);
static const int kQuality = 75;
- const gfx::JPEGCodec::ColorFormat encoding_source_format =
- (kN32_SkColorType == kRGBA_8888_SkColorType)
- ? gfx::JPEGCodec::FORMAT_RGBA
- : gfx::JPEGCodec::FORMAT_BGRA;
- bool success = gfx::JPEGCodec::Encode(
- &sk_n32_buffer_[0], encoding_source_format,
+ SkImageInfo info = SkImageInfo::MakeN32(
device_state()->format.frame_size.width(),
- device_state()->format.frame_size.height(),
- VideoFrame::RowBytes(0 /* plane */, PIXEL_FORMAT_ARGB,
- device_state()->format.frame_size.width()),
- kQuality, &jpeg_buffer_);
+ device_state()->format.frame_size.height(), kOpaque_SkAlphaType);
+ SkPixmap src(info, &sk_n32_buffer_[0],
+ VideoFrame::RowBytes(0 /* plane */, PIXEL_FORMAT_ARGB,
+ device_state()->format.frame_size.width()));
+ bool success = gfx::JPEGCodec::Encode(src, kQuality, &jpeg_buffer_);
if (!success) {
DLOG(ERROR) << "Jpeg encoding failed";
return;

Powered by Google App Engine
This is Rietveld 408576698