 Chromium Code Reviews
 Chromium Code Reviews Issue 289573002:
  Workaround bad bitmaps in clibpoard code  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 289573002:
  Workaround bad bitmaps in clibpoard code  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: content/renderer/webclipboard_impl.cc | 
| diff --git a/content/renderer/webclipboard_impl.cc b/content/renderer/webclipboard_impl.cc | 
| index 317ec7d283d707849e2829b8035760fd2530d4b7..914febfa44d88968d243a8c78ffc9963150f1734 100644 | 
| --- a/content/renderer/webclipboard_impl.cc | 
| +++ b/content/renderer/webclipboard_impl.cc | 
| @@ -155,8 +155,16 @@ void WebClipboardImpl::writeImage(const WebImage& image, | 
| if (!image.isNull()) { | 
| const SkBitmap& bitmap = image.getSkBitmap(); | 
| + | 
| + // WriteBitmapFromPixels expects 32-bit data. | 
| + if (bitmap.config() != SkBitmap::kARGB_8888_Config) | 
| 
dcheng
2014/05/19 19:44:59
Hm... are you aware of any cases where we don't pa
 
piman
2014/05/19 19:45:56
Can't it be arbitrary?
E.g. what if the png is gra
 
dcheng
2014/05/19 19:51:01
I'm not an expert in this area, but this is the de
 
piman
2014/05/19 22:50:00
I'm not sure we want to make assumptions about cod
 
piman
2014/05/20 06:48:47
OK, replaced by a DCHECK.
 | 
| + return; | 
| SkAutoLockPixels locked(bitmap); | 
| - scw.WriteBitmapFromPixels(bitmap.getPixels(), image.size()); | 
| + void *pixels = bitmap.getPixels(); | 
| + // TODO(piman): this should not be NULL, but it is. crbug.com/369621 | 
| + if (!pixels) | 
| + return; | 
| + scw.WriteBitmapFromPixels(pixels, image.size()); | 
| } | 
| if (!url.isEmpty()) { |