Change the way the image for the cursor gets passed on to the backend.

The old way could only work for 8 bit data.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32491 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2011-03-07 19:45:04 +00:00
parent 0456c89f56
commit d4d795bdb2
4 changed files with 11 additions and 34 deletions

View file

@ -1,3 +1,11 @@
2011-03-07 Fred Kiefer <FredKiefer@gmx.de>
* gui/Headers/Additions/GNUstepGUI/GSDisplayServer.h
* gui/Source/GSDisplayServer.m
* gui/Source/NSCursor.m: Change the way the image for the cursor
gets passed on to the backend. The old way could only work for 8
bit data.
2011-03-07 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSKeyValueBinding.h

View file

@ -165,8 +165,7 @@ APPKIT_EXPORT NSString *GSScreenNumber;
- (void) hidecursor;
- (void) showcursor;
- (void) standardcursor: (int) style : (void**)cid;
- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int)colors
: (const unsigned char *) image : (void**)cid;
- (void) imagecursor: (NSPoint)hotp : (NSImage *) image : (void**)cid;
- (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*)cid;
- (void) recolorcursor: (NSColor *)fg : (NSColor *)bg : (void*) cid;
- (void) setcursor: (void*) cid;

View file

@ -891,8 +891,7 @@ GSCurrentServer(void)
/** Create a cursor from an image. Returns a pointer to the internal
device representation that can be used later to make this cursor
the current one */
- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors
: (const unsigned char *) image : (void**) cid
- (void) imagecursor: (NSPoint)hotp : (NSImage *) image : (void**) cid
{
[self subclassResponsibility: _cmd];
}

View file

@ -83,7 +83,6 @@ static NSMutableDictionary *cursorDict = nil;
- (void) _computeCid
{
void *c;
NSBitmapImageRep *rep;
if (_cursor_image == nil)
{
@ -91,35 +90,7 @@ static NSMutableDictionary *cursorDict = nil;
return;
}
/*
We should rather convert the image to a bitmap representation here via
the following code, but this is currently not supported by the libart backend
{
NSSize size = [_cursor_image size];
[_cursor_image lockFocus];
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:
NSMakeRect(0, 0, size.width, size.height)];
AUTORELEASE(rep);
[_cursor_image unlockFocus];
}
*/
rep = (NSBitmapImageRep *)[_cursor_image bestRepresentationForDevice: nil];
if (!rep || ![rep respondsToSelector: @selector(samplesPerPixel)])
{
NSLog(@"NSCursor can only handle NSBitmapImageReps for now");
return;
}
if (_hot_spot.x >= [rep pixelsWide])
_hot_spot.x = [rep pixelsWide]-1;
if (_hot_spot.y >= [rep pixelsHigh])
_hot_spot.y = [rep pixelsHigh]-1;
[GSCurrentServer() imagecursor: _hot_spot
: [rep pixelsWide] : [rep pixelsHigh]
: [rep samplesPerPixel] : [rep bitmapData] : &c];
[GSCurrentServer() imagecursor: _hot_spot : _cursor_image : &c];
_cid = c;
}