Chromium Code Reviews| Index: components/user_manager/user_image/user_image.cc |
| diff --git a/components/user_manager/user_image/user_image.cc b/components/user_manager/user_image/user_image.cc |
| index db293d53b30249a1bfa9cc8849b64a78e63933eb..1e711c5efd1cfd0567d520e8e0362d90fda814cb 100644 |
| --- a/components/user_manager/user_image/user_image.cc |
| +++ b/components/user_manager/user_image/user_image.cc |
| @@ -29,13 +29,11 @@ scoped_refptr<base::RefCountedBytes> UserImage::Encode( |
| std::vector<unsigned char> output; |
| auto* bitmap_data = reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)); |
|
scroggo_chromium
2017/06/07 18:43:56
This can be moved into the else case (until we upd
msarett1
2017/06/07 20:51:10
Done.
|
| if (image_format == FORMAT_JPEG) { |
| - if (gfx::JPEGCodec::Encode( |
| - bitmap_data, |
| - gfx::JPEGCodec::FORMAT_SkBitmap, |
| - bitmap.width(), |
| - bitmap.height(), |
| - bitmap.width() * bitmap.bytesPerPixel(), |
| - kDefaultEncodingQuality, &output)) { |
| + SkPixmap pixmap; |
| + bool success = bitmap.peekPixels(&pixmap); |
| + DCHECK(success); |
| + |
| + if (gfx::JPEGCodec::Encode(pixmap, kDefaultEncodingQuality, &output)) { |
| return base::RefCountedBytes::TakeVector(&output); |
| } |
| } else if (image_format == FORMAT_PNG) { |