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

Unified Diff: webkit/glue/webclipboard_impl.cc

Issue 155010: Port WebImage to CG and rework the Skia version so that WebImage just has a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « webkit/glue/image_decoder.cc ('k') | webkit/webkit.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webclipboard_impl.cc
===================================================================
--- webkit/glue/webclipboard_impl.cc (revision 19827)
+++ webkit/glue/webclipboard_impl.cc (working copy)
@@ -9,12 +9,18 @@
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "webkit/api/public/WebImage.h"
+#include "webkit/api/public/WebSize.h"
#include "webkit/api/public/WebString.h"
#include "webkit/api/public/WebURL.h"
#include "webkit/glue/scoped_clipboard_writer_glue.h"
#include "webkit/glue/webkit_glue.h"
+#if WEBKIT_USING_CG
+#include "skia/ext/skia_utils_mac.h"
+#endif
+
using WebKit::WebClipboard;
using WebKit::WebImage;
using WebKit::WebString;
@@ -121,10 +127,15 @@
const WebImage& image, const WebURL& url, const WebString& title) {
ScopedClipboardWriterGlue scw(ClipboardGetClipboard());
-#if defined(OS_WIN) || defined(OS_LINUX)
- if (!image.isNull())
- scw.WriteBitmapFromPixels(image.pixels(), image.size());
+ if (!image.isNull()) {
+#if WEBKIT_USING_SKIA
+ const SkBitmap& bitmap = image.getSkBitmap();
+#elif WEBKIT_USING_CG
+ const SkBitmap& bitmap = gfx::CGImageToSkBitmap(image.getCGImageRef());
#endif
+ SkAutoLockPixels locked(bitmap);
+ scw.WriteBitmapFromPixels(bitmap.getPixels(), image.size());
+ }
if (!url.isEmpty()) {
scw.WriteBookmark(title, url.spec());
« no previous file with comments | « webkit/glue/image_decoder.cc ('k') | webkit/webkit.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698