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

Unified Diff: webkit/glue/webcursor_mac.mm

Issue 10391041: remove WEBKIT_USING_SKIA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 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: webkit/glue/webcursor_mac.mm
diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm
index 1e72e0b9ed220f1936c2d62a2503809664b41fdd..51800cf735889955552f18745c9bbb156ea81aa7 100644
--- a/webkit/glue/webcursor_mac.mm
+++ b/webkit/glue/webcursor_mac.mm
@@ -11,15 +11,12 @@
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/memory/scoped_nsobject.h"
+#include "skia/ext/skia_utils_mac.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
#include "ui/gfx/mac/nsimage_cache.h"
-#if WEBKIT_USING_SKIA
-#include "skia/ext/skia_utils_mac.h"
-#endif
-
using WebKit::WebCursorInfo;
using WebKit::WebImage;
using WebKit::WebSize;
@@ -96,7 +93,6 @@ CGImageRef CreateCGImageFromCustomData(const std::vector<char>& custom_data,
NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
const gfx::Size& custom_size,
const gfx::Point& hotspot) {
-#if WEBKIT_USING_SKIA
// If the data is missing, leave the backing transparent.
void* data = NULL;
size_t data_size = 0;
@@ -122,16 +118,6 @@ NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
else
bitmap.eraseARGB(0, 0, 0, 0);
NSImage* cursor_image = gfx::SkBitmapToNSImage(bitmap);
-#else
- base::mac::ScopedCFTypeRef<CGImageRef> cg_image(
- CreateCGImageFromCustomData(custom_data, custom_size));
-
- scoped_nsobject<NSBitmapImageRep> ns_bitmap(
- [[NSBitmapImageRep alloc] initWithCGImage:cg_image.get()]);
- scoped_nsobject<NSImage> cursor_image([[NSImage alloc] init]);
- DCHECK(cursor_image);
- [cursor_image addRepresentation:ns_bitmap];
-#endif // WEBKIT_USING_SKIA
NSCursor* cursor = [[NSCursor alloc] initWithImage:cursor_image
hotSpot:NSMakePoint(hotspot.x(),
@@ -363,13 +349,9 @@ void WebCursor::InitFromCursor(const Cursor* cursor) {
WebKit::WebCursorInfo cursor_info;
cursor_info.type = WebCursorInfo::TypeCustom;
cursor_info.hotSpot = WebKit::WebPoint(cursor->hotSpot.h, cursor->hotSpot.v);
-#if WEBKIT_USING_SKIA
// TODO(avi): build the cursor image in Skia directly rather than going via
// this roundabout path.
cursor_info.customImage = gfx::CGImageToSkBitmap(cg_image.get());
-#else
- cursor_info.customImage = cg_image.get();
-#endif
InitFromCursorInfo(cursor_info);
}
@@ -429,11 +411,7 @@ void WebCursor::InitFromNSCursor(NSCursor* cursor) {
cursor_info.type = WebCursorInfo::TypeCustom;
NSPoint hot_spot = [cursor hotSpot];
cursor_info.hotSpot = WebKit::WebPoint(hot_spot.x, hot_spot.y);
-#if WEBKIT_USING_SKIA
cursor_info.customImage = gfx::CGImageToSkBitmap(cg_image);
-#else
- cursor_info.customImage = cg_image;
-#endif
} else {
cursor_info.type = WebCursorInfo::TypePointer;
}
@@ -442,49 +420,6 @@ void WebCursor::InitFromNSCursor(NSCursor* cursor) {
InitFromCursorInfo(cursor_info);
}
-#if !WEBKIT_USING_SKIA
-void WebCursor::SetCustomData(const WebImage& image) {
- if (image.isNull())
- return;
-
- base::mac::ScopedCFTypeRef<CGColorSpaceRef> cg_color(
- CGColorSpaceCreateDeviceRGB());
-
- const WebSize& image_dimensions = image.size();
- int image_width = image_dimensions.width;
- int image_height = image_dimensions.height;
-
- size_t size = image_height * image_width * 4;
- custom_data_.resize(size);
- custom_size_.set_width(image_width);
- custom_size_.set_height(image_height);
-
- // These settings match up with the code in CreateCustomCursor() above; keep
- // them in sync.
- // TODO(avi): test to ensure that the flags here are correct for RGBA
- base::mac::ScopedCFTypeRef<CGContextRef> context(
- CGBitmapContextCreate(&custom_data_[0],
- image_width,
- image_height,
- 8,
- image_width * 4,
- cg_color.get(),
- kCGImageAlphaPremultipliedLast |
- kCGBitmapByteOrder32Big));
- CGRect rect = CGRectMake(0, 0, image_width, image_height);
- CGContextDrawImage(context.get(), rect, image.getCGImageRef());
-}
-
-void WebCursor::ImageFromCustomData(WebImage* image) const {
- if (custom_data_.empty())
- return;
-
- base::mac::ScopedCFTypeRef<CGImageRef> cg_image(
- CreateCGImageFromCustomData(custom_data_, custom_size_));
- *image = cg_image.get();
-}
-#endif // !WEBKIT_USING_SKIA
-
void WebCursor::InitPlatformData() {
return;
}
« no previous file with comments | « content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc ('k') | webkit/glue/webthemeengine_impl_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698