src/video/cocoa/SDL_cocoashape.m
changeset 4830 3dfe779900f5
parent 4829 7160e833c4ac
child 4831 8dabd625079f
equal deleted inserted replaced
4829:7160e833c4ac 4830:3dfe779900f5
    57 NSRect convert_rect(SDL_Rect rect,SDL_Window* window) {
    57 NSRect convert_rect(SDL_Rect rect,SDL_Window* window) {
    58 	NSRect nsrect = NSMakeRect(rect.x,window->h-(rect.y+rect.h),rect.w,rect.h);
    58 	NSRect nsrect = NSMakeRect(rect.x,window->h-(rect.y+rect.h),rect.w,rect.h);
    59 	return [[((SDL_WindowData*)window->driverdata)->nswindow contentView] convertRectFromBase:nsrect];
    59 	return [[((SDL_WindowData*)window->driverdata)->nswindow contentView] convertRectFromBase:nsrect];
    60 }
    60 }
    61 
    61 
    62 void ConglomerateShapeTree(SDL_ShapeTree* tree,SDL_PathConglomeration cong) {
    62 void ConglomerateShapeTree(SDL_ShapeTree* tree,SDL_PathConglomeration* cong) {
    63 	if(tree->kind == OpaqueShape) {
    63 	if(tree->kind == OpaqueShape) {
    64 		NSRect rect = convert_rect(tree->data.shape,cong->window);
    64 		NSRect rect = convert_rect(tree->data.shape,cong->window);
    65 		[cong->clipPath appendBezierPathWithRect:rect];
    65 		[cong->clipPath appendBezierPathWithRect:rect];
    66 	}
    66 	}
    67 }
    67 }
    82            Windoze shape-calculation code: a list of rectangles.  This will work... I think. */
    82            Windoze shape-calculation code: a list of rectangles.  This will work... I think. */
    83 	NSBezierPath* clipPath = [NSBezierPath bezierPath];
    83 	NSBezierPath* clipPath = [NSBezierPath bezierPath];
    84 	
    84 	
    85 	SDL_PathConglomeration cong = {clipPath,shaper->window};
    85 	SDL_PathConglomeration cong = {clipPath,shaper->window};
    86 	
    86 	
    87 	SDL_TraverseShapeTree(data->shape,&ConglomerateShapeTree,cong);
    87 	SDL_TraverseShapeTree(data->shape,(SDL_TraversalFunction)&ConglomerateShapeTree,(void*)&cong);
    88 	
    88 	
    89 	[clipPath addClip];
    89 	[clipPath addClip];
    90 }
    90 }
    91 
    91 
    92 int Cocoa_ResizeWindowShape(SDL_Window *window) {
    92 int Cocoa_ResizeWindowShape(SDL_Window *window) {