diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-03 05:58:45 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-03 05:58:45 +0000 |
commit | 8973f52efb98f531369f0b9daba397b1bf26d07b (patch) | |
tree | 297ec596fbaa2dc38af4c980d1a82b6dc49157ec /webkit/glue/webclipboard_impl.cc | |
parent | c505de2b23a6a9b1c38d84cdc301dd6e2a71a9b4 (diff) | |
download | chromium_src-8973f52efb98f531369f0b9daba397b1bf26d07b.zip chromium_src-8973f52efb98f531369f0b9daba397b1bf26d07b.tar.gz chromium_src-8973f52efb98f531369f0b9daba397b1bf26d07b.tar.bz2 |
Port WebImage to CG and rework the Skia version so that WebImage just has a
SkBitmap member (avoiding a level of indirection).
This CL makes it so that Mac Chrome will now write bitmap data to the clipboard
when requested by WebKit. I also simplified the ImageDecoder class that lives
in glue.
BUG=15648
TEST=none
R=dglazkov
Review URL: http://codereview.chromium.org/155010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webclipboard_impl.cc')
-rw-r--r-- | webkit/glue/webclipboard_impl.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc index dd96dca..e2be557 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/webkit/glue/webclipboard_impl.cc @@ -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 @@ void WebClipboardImpl::writeImage( 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()); |