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

Unified Diff: content/renderer/webclipboard_impl.cc

Issue 289573002: Workaround bad bitmaps in clibpoard code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: 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()) {

Powered by Google App Engine
This is Rietveld 408576698