src/video/cocoa/SDL_cocoashape.m
changeset 6848 478ecc8a58b3
parent 6832 156e608ec4ef
child 6885 700f1b25f77f
equal deleted inserted replaced
6847:c0fa29d3fade 6848:478ecc8a58b3
    72 int
    72 int
    73 Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
    73 Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
    74     SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata;
    74     SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata;
    75 	SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata;
    75 	SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata;
    76 	SDL_CocoaClosure closure;
    76 	SDL_CocoaClosure closure;
    77 
    77 	NSAutoreleasePool *pool = NULL;
    78     if(data->saved == SDL_TRUE) {
    78     if(data->saved == SDL_TRUE) {
    79         [data->context restoreGraphicsState];
    79         [data->context restoreGraphicsState];
    80         data->saved = SDL_FALSE;
    80         data->saved = SDL_FALSE;
    81     }
    81     }
    82         
    82         
    86     
    86     
    87     [[NSColor clearColor] set];
    87     [[NSColor clearColor] set];
    88     NSRectFill([[windata->nswindow contentView] frame]);
    88     NSRectFill([[windata->nswindow contentView] frame]);
    89     data->shape = SDL_CalculateShapeTree(*shape_mode,shape);
    89     data->shape = SDL_CalculateShapeTree(*shape_mode,shape);
    90 	
    90 	
    91     @autoreleasepool {
    91 	pool = [[NSAutoreleasePool alloc] init];
    92         closure.view = [windata->nswindow contentView];
    92     closure.view = [windata->nswindow contentView];
    93         closure.path = [[NSBezierPath bezierPath] autorelease];
    93     closure.path = [[NSBezierPath bezierPath] autorelease];
    94         closure.window = shaper->window;
    94 	closure.window = shaper->window;
    95         SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
    95     SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
    96         [closure.path addClip];
    96     [closure.path addClip];
    97     }
       
    98 
    97 
    99     return 0;
    98     return 0;
   100 }
    99 }
   101 
   100 
   102 int
   101 int