Mercurial > sdl-ios-xcode
annotate src/video/cybergfx/SDL_cgxvideo.h @ 1240:3b8a43c428bb
From Bug #36:
There are a couple of issues with the selection of Altivec alpha-blitting
routines in CalculateAlphaBlit() in src/video/SDL_Blit_A.c.
1) There's no check for the presence of Altivec when checking if the
Blit32to565PixelAlphaAltivec() routine can be selected.
2) Altivec cannot be used in video memory, and there's no check if the
destination surface is a hardware surface. (Alpha-blitting to a hardware
surface with GPU support is a bad idea, but somebody's bound to do it anyway.)
Patch to fix these attached.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 08 Jan 2006 21:18:15 +0000 |
parents | b8d311d90021 |
children | c9b51268668f |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
769
b8d311d90021
Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
3 Copyright (C) 1997-2004 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
21
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #ifndef _SDL_cgxvideo_h | |
29 #define _SDL_cgxvideo_h | |
30 | |
31 | |
32 #include <stdio.h> | |
33 #include <stdlib.h> | |
34 #include <string.h> | |
35 | |
36 #include <exec/exec.h> | |
37 #include <cybergraphx/cybergraphics.h> | |
38 #include <graphics/scale.h> | |
39 #include <graphics/gfx.h> | |
40 #include <intuition/intuition.h> | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
41 #if defined(__SASC) || defined(STORMC4_WOS) |
0 | 42 #include <proto/exec.h> |
43 #include <proto/cybergraphics.h> | |
44 #include <proto/graphics.h> | |
45 #include <proto/intuition.h> | |
46 #include <proto/console.h> | |
47 #else | |
48 #include <inline/exec.h> | |
49 #include <inline/cybergraphics.h> | |
50 #include <inline/graphics.h> | |
51 #include <inline/intuition.h> | |
52 #include <inline/console.h> | |
53 #endif | |
54 | |
55 #include "mydebug.h" | |
56 #include "SDL_mouse.h" | |
57 #include "SDL_sysvideo.h" | |
58 | |
59 #define USE_CGX_WRITELUTPIXEL | |
60 | |
61 /* Hidden "this" pointer for the video functions */ | |
62 #define _THIS SDL_VideoDevice *this | |
63 | |
64 /* Private display data */ | |
65 struct SDL_PrivateVideoData { | |
66 struct Screen *Public_Display; /* Used for events and window management */ | |
67 struct Screen *GFX_Display; /* Used for graphics and colormap stuff */ | |
68 Uint32 SDL_VisualUnused; /* The visual used by our window */ | |
69 struct Window *SDL_Window; /* Shared by both displays (no X security?) */ | |
70 unsigned char *BlankCursor; /* The invisible cursor */ | |
71 | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
72 char *SDL_windowid; /* Flag: true if we have been passed a window */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
73 |
0 | 74 /* The variables used for displaying graphics */ |
75 Uint8 *Ximage; /* The X image for our window */ | |
76 int swap_pixels; /* Flag: true if display is swapped endian */ | |
77 | |
78 /* The current width and height of the fullscreen mode */ | |
79 int current_w; | |
80 int current_h; | |
81 | |
82 /* Support for internal mouse warping */ | |
83 struct { | |
84 int x; | |
85 int y; | |
86 } mouse_last; | |
87 struct { | |
88 int numerator; | |
89 int denominator; | |
90 int threshold; | |
91 } mouse_accel; | |
92 int mouse_relative; | |
93 | |
94 /* The current list of available video modes */ | |
95 SDL_Rect **modelist; | |
96 | |
97 /* available visuals of interest to us, sorted deepest first */ | |
98 struct { | |
99 Uint32 visual; | |
100 int depth; /* number of significant bits/pixel */ | |
101 int bpp; /* pixel quantum in bits */ | |
102 } visuals[5]; /* at most entries for 8, 15, 16, 24 */ | |
103 int nvisuals; | |
104 | |
105 Uint32 vis; /* current visual in use */ | |
106 int depth; /* current visual depth (not bpp) */ | |
107 int BytesPerPixel; | |
108 int currently_fullscreen,same_format,dbuffer; | |
109 | |
110 /* Automatic mode switching support (entering/leaving fullscreen) */ | |
111 Uint32 switch_waiting; | |
112 Uint32 switch_time; | |
113 | |
114 /* Prevent too many XSync() calls */ | |
115 int blit_queued; | |
116 | |
117 /* Colormap handling */ | |
118 LONG Pens; | |
119 Sint32 *XPixels; /* A list of pixels that have been allocated, the size depends on the screen format */ | |
120 struct ScreenBuffer *SB[2]; | |
121 struct RastPort *RP; | |
122 short *iconcolors; /* List of colors used by the icon */ | |
123 }; | |
124 | |
125 /* Old variable names */ | |
126 #define local_X11 (this->hidden->local_X11) | |
127 #define SDL_Display (this->hidden->Public_Display) | |
128 #define GFX_Display (this->hidden->GFX_Display) | |
129 #define SDL_Screen DefaultScreen(this->hidden->Public_Display) | |
130 | |
131 #define SDL_Visual (this->hidden->vis) | |
132 | |
133 #define SDL_Root RootWindow(SDL_Display, SDL_Screen) | |
134 #define WMwindow (this->hidden->WMwindow) | |
135 #define FSwindow (this->hidden->FSwindow) | |
136 #define SDL_Window (this->hidden->SDL_Window) | |
137 #define WM_DELETE_WINDOW (this->hidden->WM_DELETE_WINDOW) | |
138 #define SDL_BlankCursor (this->hidden->BlankCursor) | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
139 #define SDL_windowid (this->hidden->SDL_windowid) |
0 | 140 #define SDL_Ximage (this->hidden->Ximage) |
141 #define SDL_GC (this->hidden->gc) | |
142 #define swap_pixels (this->hidden->swap_pixels) | |
143 #define current_w (this->hidden->current_w) | |
144 #define current_h (this->hidden->current_h) | |
145 #define mouse_last (this->hidden->mouse_last) | |
146 #define mouse_accel (this->hidden->mouse_accel) | |
147 #define mouse_relative (this->hidden->mouse_relative) | |
148 #define SDL_modelist (this->hidden->modelist) | |
149 #define SDL_RastPort (this->hidden->RP) | |
150 #define saved_mode (this->hidden->saved_mode) | |
151 #define saved_view (this->hidden->saved_view) | |
152 #define currently_fullscreen (this->hidden->currently_fullscreen) | |
153 #define blit_queued (this->hidden->blit_queued) | |
154 #define SDL_DisplayColormap (this->hidden->GFX_Display->ViewPort.ColorMap) | |
155 #define SDL_XPixels (this->hidden->XPixels) | |
156 #define SDL_iconcolors (this->hidden->iconcolors) | |
157 | |
21
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
158 /* Used to get the X cursor from a window-manager specific cursor */ |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
159 // extern Cursor SDL_GetWMXCursor(WMcursor *cursor); |
75a95f82bc1f
Updated the Amiga OS port of SDL (thanks Gabriele)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
160 |
0 | 161 extern int CGX_CreateWindow(_THIS, SDL_Surface *screen, |
162 int w, int h, int bpp, Uint32 flags); | |
163 extern int CGX_ResizeWindow(_THIS, | |
164 SDL_Surface *screen, int w, int h, Uint32 flags); | |
165 | |
166 extern void CGX_DestroyWindow(_THIS, SDL_Surface *screen); | |
167 | |
168 extern struct Library *CyberGfxBase; | |
169 extern struct IntuitionBase *IntuitionBase; | |
170 extern struct GfxBase *GfxBase; | |
171 extern struct ExecBase *SysBase; | |
172 extern struct DosLibrary *DOSBase; | |
173 | |
174 struct private_hwdata | |
175 { | |
176 struct BitMap *bmap; | |
177 APTR lock; | |
178 struct SDL_VideoDevice *videodata; | |
179 APTR mask; | |
255
dcb5e869f8b5
Updated Amiga port by Gabriele Greco
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
180 int allocated; |
0 | 181 }; |
182 | |
183 int CGX_CheckHWBlit(_THIS,SDL_Surface *src,SDL_Surface *dst); | |
184 int CGX_FillHWRect(_THIS,SDL_Surface *dst,SDL_Rect *dstrect,Uint32 color); | |
185 int CGX_SetHWColorKey(_THIS,SDL_Surface *surface, Uint32 key); | |
186 #endif /* _SDL_x11video_h */ |