Chromium Code Reviews| Index: components/suggestions/image_encoder.cc |
| diff --git a/components/suggestions/image_encoder.cc b/components/suggestions/image_encoder.cc |
| index 8b0fa09fc260d64b8df3bc12cf5499dd017f604e..d99d1fcfc26542162d8750af2d5f2ab604d2643b 100644 |
| --- a/components/suggestions/image_encoder.cc |
| +++ b/components/suggestions/image_encoder.cc |
| @@ -20,10 +20,12 @@ bool EncodeSkBitmapToJPEG(const SkBitmap& bitmap, |
| if (!bitmap.readyToDraw() || bitmap.isNull()) { |
| return false; |
| } |
| - return gfx::JPEGCodec::Encode( |
| - reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), |
| - gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(), |
| - bitmap.rowBytes(), 100, dest); |
| + |
| + SkPixmap pixmap; |
| + bool success = bitmap.peekPixels(&pixmap); |
| + DCHECK(success); |
|
scroggo_chromium
2017/06/07 18:43:56
It's too bad these three lines get repeated so muc
msarett1
2017/06/07 20:51:10
That seems right to me. I considered adding an ad
|
| + |
| + return gfx::JPEGCodec::Encode(pixmap, 100, dest); |
| } |
| } // namespace suggestions |