comparison src/video/cybergfx/SDL_cgxaccel.c @ 255:dcb5e869f8b5

Updated Amiga port by Gabriele Greco
author Sam Lantinga <slouken@libsdl.org>
date Sun, 16 Dec 2001 20:00:27 +0000
parents 75a95f82bc1f
children c9b51268668f
comparison
equal deleted inserted replaced
254:4fc12b8edf74 255:dcb5e869f8b5
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997, 1998, 1999, 2000 Sam Lantinga
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
20 slouken@libsdl.org
21 */
22
23 #ifdef SAVE_RCSID
24 static char rcsid =
25 "@(#) $Id$";
26 #endif
27
1 #include "SDL_error.h" 28 #include "SDL_error.h"
2 #include "SDL_endian.h" 29 #include "SDL_endian.h"
3 #include "SDL_sysvideo.h" 30 #include "SDL_sysvideo.h"
4 #include "SDL_blit.h" 31 #include "SDL_blit.h"
5 #include "SDL_video.h" 32 #include "SDL_video.h"
8 static int CGX_HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, 35 static int CGX_HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
9 SDL_Surface *dst, SDL_Rect *dstrect); 36 SDL_Surface *dst, SDL_Rect *dstrect);
10 37
11 // These are needed to avoid register troubles with gcc -O2! 38 // These are needed to avoid register troubles with gcc -O2!
12 39
13 #if defined(__SASC) || defined(__PPC__) 40 #if defined(__SASC) || defined(__PPC__) || defined(MORPHOS)
14 #define BMKBRP(a,b,c,d,e,f,g,h,i,j) BltMaskBitMapRastPort(a,b,c,d,e,f,g,h,i,j) 41 #define BMKBRP(a,b,c,d,e,f,g,h,i,j) BltMaskBitMapRastPort(a,b,c,d,e,f,g,h,i,j)
15 #define BBRP(a,b,c,d,e,f,g,h,i) BltBitMapRastPort(a,b,c,d,e,f,g,h,i) 42 #define BBRP(a,b,c,d,e,f,g,h,i) BltBitMapRastPort(a,b,c,d,e,f,g,h,i)
16 #define BBB(a,b,c,d,e,f,g,h,i,j,k) BltBitMap(a,b,c,d,e,f,g,h,i,j,k) 43 #define BBB(a,b,c,d,e,f,g,h,i,j,k) BltBitMap(a,b,c,d,e,f,g,h,i,j,k)
17 #else 44 #else
18 void BMKBRP(struct BitMap *a,WORD b, WORD c,struct RastPort *d,WORD e,WORD f,WORD g,WORD h,UBYTE i,APTR j) 45 void BMKBRP(struct BitMap *a,WORD b, WORD c,struct RastPort *d,WORD e,WORD f,WORD g,WORD h,UBYTE i,APTR j)
19 {BltMaskBitMapRastPort(a,b,c,d,e,f,g,h,i,j);} 46 {BltMaskBitMapRastPort(a,b,c,d,e,f,g,h,i,j);}
20 47
21 void BBRP(struct BitMap *a,WORD b, WORD c,struct RastPort *d,WORD e,WORD f,WORD g,WORD h,UBYTE i) 48 void BBRP(struct BitMap *a,WORD b, WORD c,struct RastPort *d,WORD e,WORD f,WORD g,WORD h,UBYTE i)
22 {BltBitMapRastPort(a,b,c,d,e,f,g,h,i);} 49 {BltBitMapRastPort(a,b,c,d,e,f,g,h,i);}
23 50
24 void BBB(struct BitMap *a,WORD b, WORD c,struct BitMap *d,WORD e,WORD f,WORD g,WORD h,UBYTE i,UBYTE j,UWORD *k) 51 void BBB(struct BitMap *a,WORD b, WORD c,struct BitMap *d,WORD e,WORD f,WORD g,WORD h,UBYTE i,UBYTE j,UWORD *k)
25 {BltBitMap(a,b,c,d,e,f,g,h,i,j,k);} 52 {BltBitMap(a,b,c,d,e,f,g,h,i,j,k);}
26 #endif 53 #endif
27 54
28 int CGX_SetHWColorKey(_THIS,SDL_Surface *surface, Uint32 key) 55 int CGX_SetHWColorKey(_THIS,SDL_Surface *surface, Uint32 key)
29 { 56 {
37 Uint32 pitch,ok=0; 64 Uint32 pitch,ok=0;
38 APTR lock; 65 APTR lock;
39 66
40 memset(surface->hwdata->mask,255,RASSIZE(surface->w,surface->h)); 67 memset(surface->hwdata->mask,255,RASSIZE(surface->w,surface->h));
41 68
42 D(bug("Costruisco colorkey: colore: %ld, size: %ld x %ld, %ld bytes...Bpp:%ld\n",key,surface->w,surface->h,RASSIZE(surface->w,surface->h),surface->format->BytesPerPixel)); 69 D(bug("Building colorkey mask: color: %ld, size: %ld x %ld, %ld bytes...Bpp:%ld\n",key,surface->w,surface->h,RASSIZE(surface->w,surface->h),surface->format->BytesPerPixel));
43 70
44 if(lock=LockBitMapTags(surface->hwdata->bmap,LBMI_BASEADDRESS,(ULONG)&surface->pixels, 71 if(lock=LockBitMapTags(surface->hwdata->bmap,LBMI_BASEADDRESS,(ULONG)&surface->pixels,
45 LBMI_BYTESPERROW,(ULONG)&pitch,TAG_DONE)) 72 LBMI_BYTESPERROW,(ULONG)&pitch,TAG_DONE))
46 { 73 {
47 switch(surface->format->BytesPerPixel) 74 switch(surface->format->BytesPerPixel)
136 free(surface->hwdata->mask); 163 free(surface->hwdata->mask);
137 surface->hwdata->mask=NULL; 164 surface->hwdata->mask=NULL;
138 ok=-1; 165 ok=-1;
139 } 166 }
140 UnLockBitMap(lock); 167 UnLockBitMap(lock);
141 D(bug("...Colorkey costruito!\n")); 168 D(bug("...Colorkey built!\n"));
142 return ok; 169 return ok;
143 } 170 }
144 } 171 }
145 } 172 }
146 D(bug("HW colorkey not supported for this depth\n")); 173 D(bug("HW colorkey not supported for this depth\n"));