Mercurial > sdl-ios-xcode
comparison src/video/SDL_blit.h @ 2262:bee005ace1bf
Work in progress: merging new texture features into SDL blit system
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 17 Aug 2007 06:21:58 +0000 |
parents | c20476d7d7b3 |
children | 900c35d8e8fd |
comparison
equal
deleted
inserted
replaced
2261:c20476d7d7b3 | 2262:bee005ace1bf |
---|---|
31 #include <mm3dnow.h> | 31 #include <mm3dnow.h> |
32 #endif | 32 #endif |
33 #ifdef __SSE__ | 33 #ifdef __SSE__ |
34 #include <xmmintrin.h> | 34 #include <xmmintrin.h> |
35 #endif | 35 #endif |
36 #ifdef __SSE2__ | |
37 #include <emmintrin.h> | |
38 #endif | |
36 | 39 |
37 #include "SDL_cpuinfo.h" | 40 #include "SDL_cpuinfo.h" |
38 #include "SDL_endian.h" | 41 #include "SDL_endian.h" |
39 | 42 |
40 /* The structure passed to the low level blit functions */ | 43 /* SDL blit copy flags */ |
41 typedef struct | 44 #define SDL_COPY_MODULATE_COLOR 0x0001 |
42 { | 45 #define SDL_COPY_MODULATE_ALPHA 0x0002 |
43 Uint8 *s_pixels; | 46 #define SDL_COPY_MASK 0x0010 |
44 int s_width; | 47 #define SDL_COPY_BLEND 0x0020 |
45 int s_height; | 48 #define SDL_COPY_ADD 0x0040 |
46 int s_skip; | 49 #define SDL_COPY_MOD 0x0080 |
47 Uint8 *d_pixels; | 50 #define SDL_COPY_COLORKEY 0x0100 |
48 int d_width; | 51 #define SDL_COPY_NEAREST 0x0200 |
49 int d_height; | 52 |
50 int d_skip; | 53 /* SDL blit CPU flags */ |
51 SDL_PixelFormat *src; | 54 #define SDL_CPU_ANY 0x0000 |
55 #define SDL_CPU_MMX 0x0001 | |
56 #define SDL_CPU_3DNOW 0x0002 | |
57 #define SDL_CPU_SSE 0x0004 | |
58 #define SDL_CPU_SSE2 0x0008 | |
59 #define SDL_CPU_ALTIVEC_PREFETCH 0x0010 | |
60 #define SDL_CPU_ALTIVEC_NOPREFETCH 0x0020 | |
61 | |
62 typedef struct { | |
63 Uint8 *src; | |
64 int src_w, src_h; | |
65 int src_pitch; | |
66 Uint8 *dst; | |
67 int dst_w, dst_h; | |
68 int dst_pitch; | |
69 SDL_PixelFormat *src_fmt; | |
70 SDL_PixelFormat *dst_fmt; | |
52 Uint8 *table; | 71 Uint8 *table; |
53 SDL_PixelFormat *dst; | 72 int flags; |
54 Uint32 ckey, cmod; | 73 Uint32 colorkey; |
74 Uint8 r, g, b, a; | |
55 } SDL_BlitInfo; | 75 } SDL_BlitInfo; |
56 | 76 |
57 /* The type definition for the low level blit functions */ | 77 typedef void (SDLCALL * SDL_BlitFunc)(SDL_BlitInfo *info); |
58 typedef void (*SDL_loblit) (SDL_BlitInfo * info); | 78 |
79 typedef struct { | |
80 Uint32 src_format; | |
81 Uint32 dst_format; | |
82 int flags; | |
83 int cpu; | |
84 SDL_BlitFunc func; | |
85 } SDL_BlitFuncEntry; | |
59 | 86 |
60 /* Blit mapping definition */ | 87 /* Blit mapping definition */ |
61 typedef struct SDL_BlitMap | 88 typedef struct SDL_BlitMap |
62 { | 89 { |
63 SDL_Surface *dst; | 90 SDL_Surface *dst; |
64 int identity; | 91 int identity; |
65 Uint8 *table; | |
66 SDL_blit blit; | 92 SDL_blit blit; |
67 void *data; | 93 void *data; |
68 Uint32 ckey; /* colorkey */ | 94 SDL_BlitInfo info; |
69 Uint32 cmod; /* ARGB modulation */ | |
70 | 95 |
71 /* the version count matches the destination; mismatch indicates | 96 /* the version count matches the destination; mismatch indicates |
72 an invalid mapping */ | 97 an invalid mapping */ |
73 unsigned int format_version; | 98 unsigned int format_version; |
74 } SDL_BlitMap; | 99 } SDL_BlitMap; |
75 | 100 |
76 #define SDL_BLIT_ANY 0x00000000 | |
77 #define SDL_BLIT_MMX 0x00000001 | |
78 #define SDL_BLIT_SSE 0x00000002 | |
79 #define SDL_BLIT_ALTIVEC_PREFETCH 0x00000004 | |
80 #define SDL_BLIT_ALTIVEC_NOPREFETCH 0x00000008 | |
81 | |
82 typedef struct SDL_BlitEntry | |
83 { | |
84 Uint32 features; | |
85 SDL_loblit blit; | |
86 } SDL_BlitEntry; | |
87 | |
88 /* Functions found in SDL_blit.c */ | 101 /* Functions found in SDL_blit.c */ |
89 extern int SDL_CalculateBlit(SDL_Surface * surface); | 102 extern int SDL_CalculateBlit(SDL_Surface * surface); |
90 | |
91 /* Functions found in SDL_blit_{0,1,N,A}.c */ | |
92 extern SDL_loblit SDL_CalculateBlit0(SDL_Surface * surface, int complex); | |
93 extern SDL_loblit SDL_CalculateBlit1(SDL_Surface * surface, int complex); | |
94 extern SDL_loblit SDL_CalculateBlitN(SDL_Surface * surface, int complex); | |
95 extern SDL_loblit SDL_CalculateAlphaBlit(SDL_Surface * surface, int complex); | |
96 | 103 |
97 /* | 104 /* |
98 * Useful macros for blitting routines | 105 * Useful macros for blitting routines |
99 */ | 106 */ |
100 | 107 |