annotate src/video/SDL_shape_internals.h @ 4833:34fb492cefe3

Shaped windows for Cocoa build and testshape runs, but the actual shaping doesn't work. Something, however, is definitely happening, because we get the backgrounds drawn in two different colors.
author egottlieb
date Thu, 05 Aug 2010 01:03:24 -0400
parents 3dfe779900f5
children 2e446923c9fb
rev   line source
4814
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
1 /*
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
3 Copyright (C) 2010 Eli Gottlieb
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
4
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
9
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
13 Lesser General Public License for more details.
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
14
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
18
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
19 Eli Gottlieb
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
20 eligottlieb@gmail.com
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
21 */
4817
c68e7490e4cf Fixed a couple of bugs in the general and X11 shape code, and fixed a bug in testshape that was keeping it from recognizing surfaces without alpha. Thanks to Andreas's bit-bashing tip, X11 shaped windows now work entirely, AFAICT.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4814
diff changeset
22 #include "SDL_config.h"
4814
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
23
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
24 #ifndef _SDL_shape_internals_h
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
25 #define _SDL_shape_internals_h
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
26
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
27 #include "SDL_rect.h"
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
28 #include "SDL_shape.h"
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
29 #include "SDL_surface.h"
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
30
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
31 #include "begin_code.h"
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
32 /* Set up for C function definitions, even when using C++ */
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
33 #ifdef __cplusplus
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
34 /* *INDENT-OFF* */
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
35 extern "C" {
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
36 /* *INDENT-ON* */
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
37 #endif
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
38
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
39 typedef struct {
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
40 struct SDL_ShapeTree *upleft,*upright,*downleft,*downright;
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
41 } SDL_QuadTreeChildren;
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
42
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
43 typedef union {
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
44 SDL_QuadTreeChildren children;
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
45 SDL_Rect shape;
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
46 } SDL_ShapeUnion;
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
47
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
48 typedef enum { QuadShape,TransparentShape,OpaqueShape } SDL_ShapeKind;
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
49
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
50 typedef struct {
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
51 SDL_ShapeKind kind;
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
52 SDL_ShapeUnion data;
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
53 } SDL_ShapeTree;
4830
3dfe779900f5 Compiling for cocoa now works. Does it run? We'll see.
egottlieb
parents: 4817
diff changeset
54
3dfe779900f5 Compiling for cocoa now works. Does it run? We'll see.
egottlieb
parents: 4817
diff changeset
55 typedef void(*SDL_TraversalFunction)(SDL_ShapeTree*,void*);
4814
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
56
4817
c68e7490e4cf Fixed a couple of bugs in the general and X11 shape code, and fixed a bug in testshape that was keeping it from recognizing surfaces without alpha. Thanks to Andreas's bit-bashing tip, X11 shaped windows now work entirely, AFAICT.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4814
diff changeset
57 extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb);
4814
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
58 extern SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape,SDL_bool invert);
4830
3dfe779900f5 Compiling for cocoa now works. Does it run? We'll see.
egottlieb
parents: 4817
diff changeset
59 extern void SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure);
4814
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
60 extern void SDL_FreeShapeTree(SDL_ShapeTree** shapeTree);
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
61
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
62 /* Ends C function definitions when using C++ */
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
63 #ifdef __cplusplus
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
64 /* *INDENT-OFF* */
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
65 }
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
66 /* *INDENT-ON* */
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
67 #endif
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
68 #include "close_code.h"
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
69
4f7133445367 Added the header to the repo. Oops.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
70 #endif