API: Remove gdk_cursor_new_from_pixmap()
gdk_cursor_new_from_pixbuf() is the proper replacement.
This commit is contained in:
@ -237,91 +237,6 @@ gdk_cursor_new_for_display (GdkDisplay *display,
|
||||
return gdk_quartz_cursor_new_from_nscursor (nscursor, cursor_type);
|
||||
}
|
||||
|
||||
GdkCursor*
|
||||
gdk_cursor_new_from_pixmap (GdkPixmap *source,
|
||||
GdkPixmap *mask,
|
||||
const GdkColor *fg,
|
||||
const GdkColor *bg,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
NSBitmapImageRep *bitmap_rep;
|
||||
NSImage *image;
|
||||
NSCursor *nscursor;
|
||||
GdkCursor *cursor;
|
||||
int width, height;
|
||||
gint tmp_x, tmp_y;
|
||||
guchar *dst_data, *mask_data, *src_data;
|
||||
guchar *mask_start, *src_start;
|
||||
int dst_stride;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_PIXMAP (source), NULL);
|
||||
g_return_val_if_fail (GDK_IS_PIXMAP (mask), NULL);
|
||||
g_return_val_if_fail (fg != NULL, NULL);
|
||||
g_return_val_if_fail (bg != NULL, NULL);
|
||||
|
||||
GDK_QUARTZ_ALLOC_POOL;
|
||||
|
||||
gdk_drawable_get_size (source, &width, &height);
|
||||
|
||||
bitmap_rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:(NSInteger)width pixelsHigh:(NSInteger)height
|
||||
bitsPerSample:8 samplesPerPixel:4
|
||||
hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:0 bitsPerPixel:0];
|
||||
|
||||
dst_stride = [bitmap_rep bytesPerRow];
|
||||
mask_start = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (mask)->impl)->data;
|
||||
src_start = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (source)->impl)->data;
|
||||
|
||||
for (tmp_y = 0; tmp_y < height; tmp_y++)
|
||||
{
|
||||
dst_data = [bitmap_rep bitmapData] + tmp_y * dst_stride;
|
||||
mask_data = mask_start + tmp_y * width;
|
||||
src_data = src_start + tmp_y * width;
|
||||
|
||||
for (tmp_x = 0; tmp_x < width; tmp_x++)
|
||||
{
|
||||
if (*mask_data++)
|
||||
{
|
||||
const GdkColor *color;
|
||||
|
||||
if (*src_data++)
|
||||
color = fg;
|
||||
else
|
||||
color = bg;
|
||||
|
||||
*dst_data++ = (color->red >> 8) & 0xff;
|
||||
*dst_data++ = (color->green >> 8) & 0xff;
|
||||
*dst_data++ = (color->blue >> 8) & 0xff;
|
||||
*dst_data++ = 0xff;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
*dst_data++ = 0x00;
|
||||
*dst_data++ = 0x00;
|
||||
*dst_data++ = 0x00;
|
||||
*dst_data++ = 0x00;
|
||||
|
||||
src_data++;
|
||||
}
|
||||
}
|
||||
}
|
||||
image = [[NSImage alloc] init];
|
||||
[image addRepresentation:bitmap_rep];
|
||||
[bitmap_rep release];
|
||||
|
||||
nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x, y)];
|
||||
[image release];
|
||||
|
||||
cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);
|
||||
|
||||
GDK_QUARTZ_RELEASE_POOL;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
static NSImage *
|
||||
_gdk_quartz_pixbuf_to_ns_image (GdkPixbuf *pixbuf)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user