diff --git a/VisualC/SDL_VS2010.sdf b/VisualC/SDL_VS2010.sdf deleted file mode 100644 index 86fff4e3b..000000000 Binary files a/VisualC/SDL_VS2010.sdf and /dev/null differ diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c index 670f1b377..4352c97a2 100644 --- a/src/video/SDL_shape.c +++ b/src/video/SDL_shape.c @@ -242,7 +242,7 @@ int SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode } SDL_bool SDL_WindowHasAShape(SDL_Window *window) { - if (window == NULL && !SDL_IsShapedWindow(window)) + if (window == NULL || !SDL_IsShapedWindow(window)) return SDL_FALSE; return window->shaper->hasshape; } diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m index 87720ea0a..39ea0cdb9 100644 --- a/src/video/cocoa/SDL_cocoashape.m +++ b/src/video/cocoa/SDL_cocoashape.m @@ -29,8 +29,8 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) { SDL_WindowData* data = (SDL_WindowData*)window->driverdata; - [data->nswindow setAlphaValue:1.0]; - [data->nswindow setOpaque:YES]; + [data->nswindow setOpaque:NO]; + [data->nswindow setBackgroundColor:[NSColor clearColor]]; [data->nswindow setStyleMask:NSBorderlessWindowMask]; SDL_WindowShaper* result = SDL_malloc(sizeof(SDL_WindowShaper)); result->window = window; @@ -42,6 +42,7 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) { SDL_ShapeData* shape_data = SDL_malloc(sizeof(SDL_ShapeData)); result->driverdata = shape_data; shape_data->context = [data->nswindow graphicsContext]; + SDL_assert(shape_data->context != NULL); shape_data->saved = SDL_FALSE; shape_data->shape = NULL; @@ -70,26 +71,32 @@ void ConglomerateShapeTree(SDL_ShapeTree* tree,SDL_PathConglomeration* cong) { int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata; - if(data->saved == SDL_TRUE) { + /* if(data->saved == SDL_TRUE) { [data->context restoreGraphicsState]; data->saved = SDL_FALSE; - } + }*/ - [data->context saveGraphicsState]; - data->saved = SDL_TRUE; + /*[data->context saveGraphicsState]; + data->saved = SDL_TRUE;*/ + + [NSGraphicsContext saveGraphicsState]; + + [NSGraphicsContext setCurrentContext:data->context]; + SDL_WindowData* window_data = (SDL_WindowData*)shaper->window->driverdata; - //[[NSColor clearColor] set]; - //NSRectFill([[((SDL_WindowData*)shaper->window->driverdata)->nswindow contentView] frame]); - /* TODO: It looks like Cocoa can set a clipping path based on a list of rectangles. That's what we get from the - Windoze shape-calculation code: a list of rectangles. This will work... I think. */ data->shape = SDL_CalculateShapeTree(*shapeMode,shape,SDL_FALSE); - NSBezierPath* clipPath = [NSBezierPath bezierPath]; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSBezierPath* clipPath = [[NSBezierPath bezierPath] autorelease]; SDL_PathConglomeration cong = {clipPath,shaper->window}; SDL_TraverseShapeTree(data->shape,(SDL_TraversalFunction)&ConglomerateShapeTree,(void*)&cong); + SDL_assert([NSGraphicsContext currentContext] != NULL); [clipPath addClip]; + + [NSGraphicsContext restoreGraphicsState]; + [pool release]; } int Cocoa_ResizeWindowShape(SDL_Window *window) { diff --git a/test/shapes/p01_shape24.png b/test/shapes/p01_shape24.png deleted file mode 100644 index 261c99aee..000000000 Binary files a/test/shapes/p01_shape24.png and /dev/null differ diff --git a/test/shapes/p01_shape32alpha.png b/test/shapes/p01_shape32alpha.png deleted file mode 100644 index ec8ef3767..000000000 Binary files a/test/shapes/p01_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p01_shape8.png b/test/shapes/p01_shape8.png deleted file mode 100644 index 0a2cf2a01..000000000 Binary files a/test/shapes/p01_shape8.png and /dev/null differ diff --git a/test/shapes/p01_shape8alpha.png b/test/shapes/p01_shape8alpha.png deleted file mode 100644 index 6e2bddf94..000000000 Binary files a/test/shapes/p01_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p02_shape24.png b/test/shapes/p02_shape24.png deleted file mode 100644 index 63528b873..000000000 Binary files a/test/shapes/p02_shape24.png and /dev/null differ diff --git a/test/shapes/p02_shape32alpha.png b/test/shapes/p02_shape32alpha.png deleted file mode 100644 index 2e7122ac8..000000000 Binary files a/test/shapes/p02_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p02_shape8.png b/test/shapes/p02_shape8.png deleted file mode 100644 index cf2b2d2fc..000000000 Binary files a/test/shapes/p02_shape8.png and /dev/null differ diff --git a/test/shapes/p02_shape8alpha.png b/test/shapes/p02_shape8alpha.png deleted file mode 100644 index 970a528de..000000000 Binary files a/test/shapes/p02_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p03_shape24.png b/test/shapes/p03_shape24.png deleted file mode 100644 index 87b38b896..000000000 Binary files a/test/shapes/p03_shape24.png and /dev/null differ diff --git a/test/shapes/p03_shape8.png b/test/shapes/p03_shape8.png deleted file mode 100644 index 26c7945ba..000000000 Binary files a/test/shapes/p03_shape8.png and /dev/null differ diff --git a/test/shapes/p04_shape1.png b/test/shapes/p04_shape1.png deleted file mode 100644 index 53f775d44..000000000 Binary files a/test/shapes/p04_shape1.png and /dev/null differ diff --git a/test/shapes/p04_shape24.png b/test/shapes/p04_shape24.png deleted file mode 100644 index 650581842..000000000 Binary files a/test/shapes/p04_shape24.png and /dev/null differ diff --git a/test/shapes/p04_shape32alpha.png b/test/shapes/p04_shape32alpha.png deleted file mode 100644 index f80cb274e..000000000 Binary files a/test/shapes/p04_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p04_shape8.png b/test/shapes/p04_shape8.png deleted file mode 100644 index f9f2883b3..000000000 Binary files a/test/shapes/p04_shape8.png and /dev/null differ diff --git a/test/shapes/p05_shape8.png b/test/shapes/p05_shape8.png deleted file mode 100644 index 31a823165..000000000 Binary files a/test/shapes/p05_shape8.png and /dev/null differ diff --git a/test/shapes/p06_shape1alpha.png b/test/shapes/p06_shape1alpha.png deleted file mode 100644 index 7d6c4db0e..000000000 Binary files a/test/shapes/p06_shape1alpha.png and /dev/null differ diff --git a/test/shapes/p06_shape24.png b/test/shapes/p06_shape24.png deleted file mode 100644 index adcf4964e..000000000 Binary files a/test/shapes/p06_shape24.png and /dev/null differ diff --git a/test/shapes/p06_shape32alpha.png b/test/shapes/p06_shape32alpha.png deleted file mode 100644 index 9ba4bba84..000000000 Binary files a/test/shapes/p06_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p06_shape8.png b/test/shapes/p06_shape8.png deleted file mode 100644 index 8151e8766..000000000 Binary files a/test/shapes/p06_shape8.png and /dev/null differ diff --git a/test/shapes/p06_shape8alpha.png b/test/shapes/p06_shape8alpha.png deleted file mode 100644 index d09a82ecc..000000000 Binary files a/test/shapes/p06_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p07_shape1alpha.png b/test/shapes/p07_shape1alpha.png deleted file mode 100644 index 91855bc6c..000000000 Binary files a/test/shapes/p07_shape1alpha.png and /dev/null differ diff --git a/test/shapes/p07_shape24.png b/test/shapes/p07_shape24.png deleted file mode 100644 index 6e568926d..000000000 Binary files a/test/shapes/p07_shape24.png and /dev/null differ diff --git a/test/shapes/p07_shape32alpha.png b/test/shapes/p07_shape32alpha.png deleted file mode 100644 index 1b4604cf2..000000000 Binary files a/test/shapes/p07_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p07_shape8.png b/test/shapes/p07_shape8.png deleted file mode 100644 index 2c1b2291e..000000000 Binary files a/test/shapes/p07_shape8.png and /dev/null differ diff --git a/test/shapes/p07_shape8alpha.png b/test/shapes/p07_shape8alpha.png deleted file mode 100644 index 2cd365593..000000000 Binary files a/test/shapes/p07_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p08_shape1alpha.png b/test/shapes/p08_shape1alpha.png deleted file mode 100644 index 97f1b23b4..000000000 Binary files a/test/shapes/p08_shape1alpha.png and /dev/null differ diff --git a/test/shapes/p08_shape24.png b/test/shapes/p08_shape24.png deleted file mode 100644 index 1861f454c..000000000 Binary files a/test/shapes/p08_shape24.png and /dev/null differ diff --git a/test/shapes/p08_shape32alpha.png b/test/shapes/p08_shape32alpha.png deleted file mode 100644 index 9780255d6..000000000 Binary files a/test/shapes/p08_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p08_shape8.png b/test/shapes/p08_shape8.png deleted file mode 100644 index e5211b80c..000000000 Binary files a/test/shapes/p08_shape8.png and /dev/null differ diff --git a/test/shapes/p08_shape8alpha.png b/test/shapes/p08_shape8alpha.png deleted file mode 100644 index c04c7b7ff..000000000 Binary files a/test/shapes/p08_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p09_shape24.png b/test/shapes/p09_shape24.png deleted file mode 100644 index 9c6d45741..000000000 Binary files a/test/shapes/p09_shape24.png and /dev/null differ diff --git a/test/shapes/p09_shape32alpha.png b/test/shapes/p09_shape32alpha.png deleted file mode 100644 index 1caadd7d0..000000000 Binary files a/test/shapes/p09_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p09_shape8.png b/test/shapes/p09_shape8.png deleted file mode 100644 index dcabf3819..000000000 Binary files a/test/shapes/p09_shape8.png and /dev/null differ diff --git a/test/shapes/p09_shape8alpha.png b/test/shapes/p09_shape8alpha.png deleted file mode 100644 index b0ba45066..000000000 Binary files a/test/shapes/p09_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p10_shape1.png b/test/shapes/p10_shape1.png deleted file mode 100644 index eaa28a2af..000000000 Binary files a/test/shapes/p10_shape1.png and /dev/null differ diff --git a/test/shapes/p10_shape1alpha.png b/test/shapes/p10_shape1alpha.png deleted file mode 100644 index 1ab5a1290..000000000 Binary files a/test/shapes/p10_shape1alpha.png and /dev/null differ diff --git a/test/shapes/p10_shape24.png b/test/shapes/p10_shape24.png deleted file mode 100644 index e4d7cb922..000000000 Binary files a/test/shapes/p10_shape24.png and /dev/null differ diff --git a/test/shapes/p10_shape32alpha.png b/test/shapes/p10_shape32alpha.png deleted file mode 100644 index e94035e3d..000000000 Binary files a/test/shapes/p10_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p10_shape8.png b/test/shapes/p10_shape8.png deleted file mode 100644 index 2e623c256..000000000 Binary files a/test/shapes/p10_shape8.png and /dev/null differ diff --git a/test/shapes/p10_shape8alpha.png b/test/shapes/p10_shape8alpha.png deleted file mode 100644 index 4f979fe09..000000000 Binary files a/test/shapes/p10_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p11_shape24.png b/test/shapes/p11_shape24.png deleted file mode 100644 index c9589fb74..000000000 Binary files a/test/shapes/p11_shape24.png and /dev/null differ diff --git a/test/shapes/p11_shape32alpha.png b/test/shapes/p11_shape32alpha.png deleted file mode 100644 index 87775a128..000000000 Binary files a/test/shapes/p11_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p11_shape8.png b/test/shapes/p11_shape8.png deleted file mode 100644 index ea3799598..000000000 Binary files a/test/shapes/p11_shape8.png and /dev/null differ diff --git a/test/shapes/p11_shape8alpha.png b/test/shapes/p11_shape8alpha.png deleted file mode 100644 index 6b8d34171..000000000 Binary files a/test/shapes/p11_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p12_shape24.png b/test/shapes/p12_shape24.png deleted file mode 100644 index 576b6a803..000000000 Binary files a/test/shapes/p12_shape24.png and /dev/null differ diff --git a/test/shapes/p12_shape8.png b/test/shapes/p12_shape8.png deleted file mode 100644 index 0f20b52db..000000000 Binary files a/test/shapes/p12_shape8.png and /dev/null differ diff --git a/test/shapes/p13_shape24.png b/test/shapes/p13_shape24.png deleted file mode 100644 index ff3a8bef5..000000000 Binary files a/test/shapes/p13_shape24.png and /dev/null differ diff --git a/test/shapes/p13_shape32alpha.png b/test/shapes/p13_shape32alpha.png deleted file mode 100644 index e5a13eee0..000000000 Binary files a/test/shapes/p13_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p13_shape8.png b/test/shapes/p13_shape8.png deleted file mode 100644 index 21c054bcc..000000000 Binary files a/test/shapes/p13_shape8.png and /dev/null differ diff --git a/test/shapes/p13_shape8alpha.png b/test/shapes/p13_shape8alpha.png deleted file mode 100644 index dd9cafe4c..000000000 Binary files a/test/shapes/p13_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p14_shape24.png b/test/shapes/p14_shape24.png deleted file mode 100644 index 00179dfa7..000000000 Binary files a/test/shapes/p14_shape24.png and /dev/null differ diff --git a/test/shapes/p14_shape8.png b/test/shapes/p14_shape8.png deleted file mode 100644 index 138343e54..000000000 Binary files a/test/shapes/p14_shape8.png and /dev/null differ diff --git a/test/shapes/p15_shape24.png b/test/shapes/p15_shape24.png deleted file mode 100644 index f088a399f..000000000 Binary files a/test/shapes/p15_shape24.png and /dev/null differ diff --git a/test/shapes/p15_shape32alpha.png b/test/shapes/p15_shape32alpha.png deleted file mode 100644 index be8d40501..000000000 Binary files a/test/shapes/p15_shape32alpha.png and /dev/null differ diff --git a/test/shapes/p15_shape8.png b/test/shapes/p15_shape8.png deleted file mode 100644 index a54d12af9..000000000 Binary files a/test/shapes/p15_shape8.png and /dev/null differ diff --git a/test/shapes/p15_shape8alpha.png b/test/shapes/p15_shape8alpha.png deleted file mode 100644 index 6ef3372cb..000000000 Binary files a/test/shapes/p15_shape8alpha.png and /dev/null differ diff --git a/test/shapes/p16_shape1.png b/test/shapes/p16_shape1.png deleted file mode 100644 index 8db3863dd..000000000 Binary files a/test/shapes/p16_shape1.png and /dev/null differ diff --git a/test/shapes/p16_shape24.png b/test/shapes/p16_shape24.png deleted file mode 100644 index 77de12bb1..000000000 Binary files a/test/shapes/p16_shape24.png and /dev/null differ diff --git a/test/shapes/p16_shape8.png b/test/shapes/p16_shape8.png deleted file mode 100644 index 7d9232279..000000000 Binary files a/test/shapes/p16_shape8.png and /dev/null differ