From e4e65d5c2c1f7d5354f2bacaed59fbedd678578f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 3 Jun 2011 18:42:52 +0300 Subject: Remove SDL_gfxBlitFunc.h from automake, and leave it only in cmake to fix windows builds. --- src/CMakeLists.txt | 1 + src/Makefile.am | 4 +- src/SDL_gfx/SDL_gfxBlitFunc.h | 128 ++++++++++++++++++++++++++++++++++++++++++ src/SDL_gfxBlitFunc.h | 128 ------------------------------------------ 4 files changed, 131 insertions(+), 130 deletions(-) create mode 100644 src/SDL_gfx/SDL_gfxBlitFunc.h delete mode 100644 src/SDL_gfxBlitFunc.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ac4260391..df0a9ea0f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -69,6 +69,7 @@ ENDIF (USE_X11) INCLUDE_DIRECTORIES( "guichan/include" + "SDL_gfx" ${CMAKE_CURRENT_SOURCE_DIR} ${SDL_INCLUDE_DIR} ${SDLIMAGE_INCLUDE_DIR} diff --git a/src/Makefile.am b/src/Makefile.am index c13f645bd..9863a0f69 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -564,7 +564,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ sprite.h \ statuseffect.cpp \ statuseffect.h \ - SDL_gfxBlitFunc.h \ text.cpp \ text.h \ textmanager.cpp \ @@ -720,7 +719,8 @@ EXTRA_DIST = CMakeLists.txt \ enet/README \ mana.rc \ SDLMain.h \ - SDLMain.m + SDLMain.m \ + SDL_gfx/SDL_gfxBlitFunc.h # set the include path found by configure INCLUDES = $(all_includes) diff --git a/src/SDL_gfx/SDL_gfxBlitFunc.h b/src/SDL_gfx/SDL_gfxBlitFunc.h new file mode 100644 index 000000000..f233aa617 --- /dev/null +++ b/src/SDL_gfx/SDL_gfxBlitFunc.h @@ -0,0 +1,128 @@ +/* + + SDL_gfxBlitFunc: custom blitters (part of SDL_gfx library) + + LGPL (c) A. Schiffler + +*/ + +#ifndef _SDL_gfxBlitFunc_h +#define _SDL_gfxBlitFunc_h + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include +#include + +/* -------- Prototypes */ + +#ifdef WIN32 +# ifdef DLL_EXPORT +# define SDL_GFXBLITFUNC_SCOPE __declspec(dllexport) +# else +# ifdef LIBSDL_GFX_DLL_IMPORT +# define SDL_GFXBLITFUNC_SCOPE __declspec(dllimport) +# endif +# endif +#endif +#ifndef SDL_GFXBLITFUNC_SCOPE +# define SDL_GFXBLITFUNC_SCOPE extern +#endif + + +SDL_GFXBLITFUNC_SCOPE int SDL_gfxBlitRGBA(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); + +SDL_GFXBLITFUNC_SCOPE int SDL_gfxSetAlpha(SDL_Surface * src, Uint8 a); + + +/* -------- Macros */ + +/* Define SDL macros locally as a substitute for a #include "SDL_blit.h", */ + +/* which doesn't work since the include file doesn't get installed. */ + +/* The structure passed to the low level blit functions */ + typedef struct { + Uint8 *s_pixels; + int s_width; + int s_height; + int s_skip; + Uint8 *d_pixels; + int d_width; + int d_height; + int d_skip; + void *aux_data; + SDL_PixelFormat *src; + Uint8 *table; + SDL_PixelFormat *dst; + } SDL_gfxBlitInfo; + +#define GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a) \ +{ \ + r = ((pixel&fmt->Rmask)>>fmt->Rshift)<Rloss; \ + g = ((pixel&fmt->Gmask)>>fmt->Gshift)<Gloss; \ + b = ((pixel&fmt->Bmask)>>fmt->Bshift)<Bloss; \ + a = ((pixel&fmt->Amask)>>fmt->Ashift)<Aloss; \ +} + +#define GFX_DISEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a) \ +do { \ + pixel = *((Uint32 *)(buf)); \ + GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a); \ + pixel &= ~fmt->Amask; \ +} while(0) + +#define GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a) \ +{ \ + pixel = ((r>>fmt->Rloss)<Rshift)| \ + ((g>>fmt->Gloss)<Gshift)| \ + ((b>>fmt->Bloss)<Bshift)| \ + ((a<Aloss)<Ashift); \ +} + +#define GFX_ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \ +{ \ + Uint32 pixel; \ + \ + GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a); \ + *((Uint32 *)(buf)) = pixel; \ +} + +/* Blend the RGB values of two pixels based on a source alpha value */ +#define GFX_ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) \ +do { \ + dR = (((sR-dR)*(A))/255)+dR; \ + dG = (((sG-dG)*(A))/255)+dG; \ + dB = (((sB-dB)*(A))/255)+dB; \ +} while(0) + +/* This is a very useful loop for optimizing blitters */ + +/* 4-times unrolled loop */ +#define GFX_DUFFS_LOOP4(pixel_copy_increment, width) \ +{ int n = (width+3)/4; \ + switch (width & 3) { \ + case 0: do { pixel_copy_increment; \ + case 3: pixel_copy_increment; \ + case 2: pixel_copy_increment; \ + case 1: pixel_copy_increment; \ + } while ( --n > 0 ); \ + } \ +} + +//deleted + +/* --- */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + +#endif /* _SDL_gfxBlitFunc_h */ diff --git a/src/SDL_gfxBlitFunc.h b/src/SDL_gfxBlitFunc.h deleted file mode 100644 index f233aa617..000000000 --- a/src/SDL_gfxBlitFunc.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - - SDL_gfxBlitFunc: custom blitters (part of SDL_gfx library) - - LGPL (c) A. Schiffler - -*/ - -#ifndef _SDL_gfxBlitFunc_h -#define _SDL_gfxBlitFunc_h - -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include -#include - -/* -------- Prototypes */ - -#ifdef WIN32 -# ifdef DLL_EXPORT -# define SDL_GFXBLITFUNC_SCOPE __declspec(dllexport) -# else -# ifdef LIBSDL_GFX_DLL_IMPORT -# define SDL_GFXBLITFUNC_SCOPE __declspec(dllimport) -# endif -# endif -#endif -#ifndef SDL_GFXBLITFUNC_SCOPE -# define SDL_GFXBLITFUNC_SCOPE extern -#endif - - -SDL_GFXBLITFUNC_SCOPE int SDL_gfxBlitRGBA(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); - -SDL_GFXBLITFUNC_SCOPE int SDL_gfxSetAlpha(SDL_Surface * src, Uint8 a); - - -/* -------- Macros */ - -/* Define SDL macros locally as a substitute for a #include "SDL_blit.h", */ - -/* which doesn't work since the include file doesn't get installed. */ - -/* The structure passed to the low level blit functions */ - typedef struct { - Uint8 *s_pixels; - int s_width; - int s_height; - int s_skip; - Uint8 *d_pixels; - int d_width; - int d_height; - int d_skip; - void *aux_data; - SDL_PixelFormat *src; - Uint8 *table; - SDL_PixelFormat *dst; - } SDL_gfxBlitInfo; - -#define GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a) \ -{ \ - r = ((pixel&fmt->Rmask)>>fmt->Rshift)<Rloss; \ - g = ((pixel&fmt->Gmask)>>fmt->Gshift)<Gloss; \ - b = ((pixel&fmt->Bmask)>>fmt->Bshift)<Bloss; \ - a = ((pixel&fmt->Amask)>>fmt->Ashift)<Aloss; \ -} - -#define GFX_DISEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a) \ -do { \ - pixel = *((Uint32 *)(buf)); \ - GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a); \ - pixel &= ~fmt->Amask; \ -} while(0) - -#define GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a) \ -{ \ - pixel = ((r>>fmt->Rloss)<Rshift)| \ - ((g>>fmt->Gloss)<Gshift)| \ - ((b>>fmt->Bloss)<Bshift)| \ - ((a<Aloss)<Ashift); \ -} - -#define GFX_ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \ -{ \ - Uint32 pixel; \ - \ - GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a); \ - *((Uint32 *)(buf)) = pixel; \ -} - -/* Blend the RGB values of two pixels based on a source alpha value */ -#define GFX_ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) \ -do { \ - dR = (((sR-dR)*(A))/255)+dR; \ - dG = (((sG-dG)*(A))/255)+dG; \ - dB = (((sB-dB)*(A))/255)+dB; \ -} while(0) - -/* This is a very useful loop for optimizing blitters */ - -/* 4-times unrolled loop */ -#define GFX_DUFFS_LOOP4(pixel_copy_increment, width) \ -{ int n = (width+3)/4; \ - switch (width & 3) { \ - case 0: do { pixel_copy_increment; \ - case 3: pixel_copy_increment; \ - case 2: pixel_copy_increment; \ - case 1: pixel_copy_increment; \ - } while ( --n > 0 ); \ - } \ -} - -//deleted - -/* --- */ - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -} -#endif - -#endif /* _SDL_gfxBlitFunc_h */ -- cgit v1.2.3-70-g09d2