Mercurial > pygame
annotate src/surface.h @ 3194:9fcb7abf3185 default tip
Remove some gcc 4.7.2 compiler warnings
| author | Lenard Lindstrom <len-l@telus.net> |
|---|---|
| date | Tue, 23 Apr 2013 19:53:36 -0700 |
| parents | 55d7ab7a344f |
| children |
| rev | line source |
|---|---|
| 820 | 1 /* |
| 2 pygame - Python Game Library | |
| 3 Copyright (C) 2000-2001 Pete Shinners | |
| 4 Copyright (C) 2007 Marcus von Appen | |
| 5 | |
| 6 This library is free software; you can redistribute it and/or | |
| 7 modify it under the terms of the GNU Library General Public | |
| 8 License as published by the Free Software Foundation; either | |
| 9 version 2 of the License, or (at your option) any later version. | |
| 10 | |
| 11 This library is distributed in the hope that it will be useful, | |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 Library General Public License for more details. | |
| 15 | |
| 16 You should have received a copy of the GNU Library General Public | |
| 17 License along with this library; if not, write to the Free | |
| 18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | |
| 20 Pete Shinners | |
| 21 pete@shinners.org | |
| 22 */ | |
| 23 | |
| 24 #ifndef SURFACE_H | |
| 25 #define SURFACE_H | |
| 26 | |
|
2075
38a814e12f12
Remove distracting '"_POSIX_C_SOURCE" redefined' GCC warnings from linux builds.
Lenard Lindstrom <len-l@telus.net>
parents:
1514
diff
changeset
|
27 /* This is defined in SDL.h */ |
|
38a814e12f12
Remove distracting '"_POSIX_C_SOURCE" redefined' GCC warnings from linux builds.
Lenard Lindstrom <len-l@telus.net>
parents:
1514
diff
changeset
|
28 #if defined(_POSIX_C_SOURCE) |
|
38a814e12f12
Remove distracting '"_POSIX_C_SOURCE" redefined' GCC warnings from linux builds.
Lenard Lindstrom <len-l@telus.net>
parents:
1514
diff
changeset
|
29 #undef _POSIX_C_SOURCE |
|
38a814e12f12
Remove distracting '"_POSIX_C_SOURCE" redefined' GCC warnings from linux builds.
Lenard Lindstrom <len-l@telus.net>
parents:
1514
diff
changeset
|
30 #endif |
|
38a814e12f12
Remove distracting '"_POSIX_C_SOURCE" redefined' GCC warnings from linux builds.
Lenard Lindstrom <len-l@telus.net>
parents:
1514
diff
changeset
|
31 |
| 820 | 32 #include <SDL.h> |
| 33 #include "pygame.h" | |
| 34 | |
| 35 #define PYGAME_BLEND_ADD 0x1 | |
| 36 #define PYGAME_BLEND_SUB 0x2 | |
| 37 #define PYGAME_BLEND_MULT 0x3 | |
| 38 #define PYGAME_BLEND_MIN 0x4 | |
| 39 #define PYGAME_BLEND_MAX 0x5 | |
| 40 | |
|
1141
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
41 #define PYGAME_BLEND_RGB_ADD 0x1 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
42 #define PYGAME_BLEND_RGB_SUB 0x2 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
43 #define PYGAME_BLEND_RGB_MULT 0x3 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
44 #define PYGAME_BLEND_RGB_MIN 0x4 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
45 #define PYGAME_BLEND_RGB_MAX 0x5 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
46 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
47 #define PYGAME_BLEND_RGBA_ADD 0x6 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
48 #define PYGAME_BLEND_RGBA_SUB 0x7 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
49 #define PYGAME_BLEND_RGBA_MULT 0x8 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
50 #define PYGAME_BLEND_RGBA_MIN 0x9 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
51 #define PYGAME_BLEND_RGBA_MAX 0x10 |
|
3095
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
52 #define PYGAME_BLEND_PREMULTIPLIED 0x11 |
|
1141
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
53 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
54 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
55 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
56 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
57 |
|
1502
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
58 #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
59 #define GET_PIXEL_24(b) (b[0] + (b[1] << 8) + (b[2] << 16)) |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
60 #else |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
61 #define GET_PIXEL_24(b) (b[2] + (b[1] << 8) + (b[0] << 16)) |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
62 #endif |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
63 |
| 820 | 64 #define GET_PIXEL(pxl, bpp, source) \ |
| 65 switch (bpp) \ | |
| 66 { \ | |
| 67 case 2: \ | |
| 68 pxl = *((Uint16 *) (source)); \ | |
| 69 break; \ | |
| 70 case 4: \ | |
| 71 pxl = *((Uint32 *) (source)); \ | |
| 72 break; \ | |
| 73 default: \ | |
| 74 { \ | |
| 75 Uint8 *b = (Uint8 *) source; \ | |
|
1502
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
76 pxl = GET_PIXEL_24(b); \ |
| 820 | 77 } \ |
| 78 break; \ | |
| 79 } | |
| 80 | |
|
1505
902b98865c6c
fix per-pixel alpha bug involving pixel unpacking
Lenard Lindstrom <len-l@telus.net>
parents:
1504
diff
changeset
|
81 #define GET_PIXELVALS(_sR, _sG, _sB, _sA, px, fmt, ppa) \ |
|
985
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
82 _sR = ((px & fmt->Rmask) >> fmt->Rshift); \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
83 _sR = (_sR << fmt->Rloss) + (_sR >> (8 - (fmt->Rloss << 1))); \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
84 _sG = ((px & fmt->Gmask) >> fmt->Gshift); \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
85 _sG = (_sG << fmt->Gloss) + (_sG >> (8 - (fmt->Gloss << 1))); \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
86 _sB = ((px & fmt->Bmask) >> fmt->Bshift); \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
87 _sB = (_sB << fmt->Bloss) + (_sB >> (8 - (fmt->Bloss << 1))); \ |
|
1505
902b98865c6c
fix per-pixel alpha bug involving pixel unpacking
Lenard Lindstrom <len-l@telus.net>
parents:
1504
diff
changeset
|
88 if (ppa) \ |
|
985
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
89 { \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
90 _sA = ((px & fmt->Amask) >> fmt->Ashift); \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
91 _sA = (_sA << fmt->Aloss) + (_sA >> (8 - (fmt->Aloss << 1))); \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
92 } \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
93 else \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
94 { \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
95 _sA = 255; \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
96 } |
| 820 | 97 |
|
985
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
98 #define GET_PIXELVALS_1(sr, sg, sb, sa, _src, _fmt) \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
99 sr = _fmt->palette->colors[*((Uint8 *) (_src))].r; \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
100 sg = _fmt->palette->colors[*((Uint8 *) (_src))].g; \ |
|
9799aebf78f9
Improved blit and fill macros for surface operations.
marcus
parents:
820
diff
changeset
|
101 sb = _fmt->palette->colors[*((Uint8 *) (_src))].b; \ |
| 820 | 102 sa = 255; |
| 103 | |
|
1142
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
104 |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
105 |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
106 |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
107 |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
108 |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
109 |
|
1502
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
110 #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
111 #define SET_OFFSETS_24(or, og, ob, fmt) \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
112 { \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
113 or = (fmt->Rshift == 0 ? 0 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
114 fmt->Rshift == 8 ? 1 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
115 2 ); \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
116 og = (fmt->Gshift == 0 ? 0 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
117 fmt->Gshift == 8 ? 1 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
118 2 ); \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
119 ob = (fmt->Bshift == 0 ? 0 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
120 fmt->Bshift == 8 ? 1 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
121 2 ); \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
122 } |
|
1514
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
123 |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
124 #define SET_OFFSETS_32(or, og, ob, fmt) \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
125 { \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
126 or = (fmt->Rshift == 0 ? 0 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
127 fmt->Rshift == 8 ? 1 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
128 fmt->Rshift == 16 ? 2 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
129 3 ); \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
130 og = (fmt->Gshift == 0 ? 0 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
131 fmt->Gshift == 8 ? 1 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
132 fmt->Gshift == 16 ? 2 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
133 3 ); \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
134 ob = (fmt->Bshift == 0 ? 0 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
135 fmt->Bshift == 8 ? 1 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
136 fmt->Bshift == 16 ? 2 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
137 3 ); \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
138 } |
|
1502
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
139 #else |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
140 #define SET_OFFSETS_24(or, og, ob, fmt) \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
141 { \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
142 or = (fmt->Rshift == 0 ? 2 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
143 fmt->Rshift == 8 ? 1 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
144 0 ); \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
145 og = (fmt->Gshift == 0 ? 2 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
146 fmt->Gshift == 8 ? 1 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
147 0 ); \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
148 ob = (fmt->Bshift == 0 ? 2 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
149 fmt->Bshift == 8 ? 1 : \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
150 0 ); \ |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
151 } |
|
1514
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
152 |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
153 #define SET_OFFSETS_32(or, og, ob, fmt) \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
154 { \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
155 or = (fmt->Rshift == 0 ? 3 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
156 fmt->Rshift == 8 ? 2 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
157 fmt->Rshift == 16 ? 1 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
158 0 ); \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
159 og = (fmt->Gshift == 0 ? 3 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
160 fmt->Gshift == 8 ? 2 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
161 fmt->Gshift == 16 ? 1 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
162 0 ); \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
163 ob = (fmt->Bshift == 0 ? 3 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
164 fmt->Bshift == 8 ? 2 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
165 fmt->Bshift == 16 ? 1 : \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
166 0 ); \ |
|
eb0a75be1765
fix bug involving blit blends and 32 bit surfaces having non-standard masks
Lenard Lindstrom <len-l@telus.net>
parents:
1511
diff
changeset
|
167 } |
|
1502
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
168 #endif |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
169 |
|
b3dab2110999
BLEND_xxx blit options tested and bugs fixed
Lenard Lindstrom <len-l@telus.net>
parents:
1315
diff
changeset
|
170 |
| 820 | 171 #define CREATE_PIXEL(buf, r, g, b, a, bp, ft) \ |
| 172 switch (bp) \ | |
| 173 { \ | |
| 174 case 2: \ | |
| 175 *((Uint16 *) (buf)) = \ | |
| 176 ((r >> ft->Rloss) << ft->Rshift) | \ | |
| 177 ((g >> ft->Gloss) << ft->Gshift) | \ | |
| 178 ((b >> ft->Bloss) << ft->Bshift) | \ | |
|
1315
baa6043f0695
fixing CREATE_PIXEL macro, it made no-alpha surfaces get filled with green
brian
parents:
1296
diff
changeset
|
179 ((a >> ft->Aloss) << ft->Ashift); \ |
| 820 | 180 break; \ |
| 181 case 4: \ | |
| 182 *((Uint32 *) (buf)) = \ | |
| 183 ((r >> ft->Rloss) << ft->Rshift) | \ | |
| 184 ((g >> ft->Gloss) << ft->Gshift) | \ | |
| 185 ((b >> ft->Bloss) << ft->Bshift) | \ | |
|
1315
baa6043f0695
fixing CREATE_PIXEL macro, it made no-alpha surfaces get filled with green
brian
parents:
1296
diff
changeset
|
186 ((a >> ft->Aloss) << ft->Ashift); \ |
| 820 | 187 break; \ |
| 188 } | |
| 189 | |
| 190 /* Pretty good idea from Tom Duff :-). */ | |
| 191 #define LOOP_UNROLLED4(code, n, width) \ | |
| 192 n = (width + 3) / 4; \ | |
| 193 switch (width & 3) \ | |
| 194 { \ | |
| 195 case 0: do { code; \ | |
| 196 case 3: code; \ | |
| 197 case 2: code; \ | |
| 198 case 1: code; \ | |
| 199 } while (--n > 0); \ | |
| 200 } | |
| 201 | |
| 202 /* Used in the srcbpp == dstbpp == 1 blend functions */ | |
| 203 #define REPEAT_3(code) \ | |
| 204 code; \ | |
| 205 code; \ | |
| 206 code; | |
| 207 | |
|
1142
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
208 #define REPEAT_4(code) \ |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
209 code; \ |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
210 code; \ |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
211 code; \ |
|
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
212 code; |
|
1141
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
213 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
214 |
| 1026 | 215 #define BLEND_ADD(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \ |
| 820 | 216 tmp = dR + sR; dR = (tmp <= 255 ? tmp : 255); \ |
| 217 tmp = dG + sG; dG = (tmp <= 255 ? tmp : 255); \ | |
| 1034 | 218 tmp = dB + sB; dB = (tmp <= 255 ? tmp : 255); |
| 820 | 219 |
| 220 #define BLEND_SUB(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \ | |
| 221 tmp = dR - sR; dR = (tmp >= 0 ? tmp : 0); \ | |
| 222 tmp = dG - sG; dG = (tmp >= 0 ? tmp : 0); \ | |
| 1034 | 223 tmp = dB - sB; dB = (tmp >= 0 ? tmp : 0); |
| 820 | 224 |
| 225 #define BLEND_MULT(sR, sG, sB, sA, dR, dG, dB, dA) \ | |
| 226 dR = (dR && sR) ? (dR * sR) >> 8 : 0; \ | |
| 227 dG = (dG && sG) ? (dG * sG) >> 8 : 0; \ | |
| 1034 | 228 dB = (dB && sB) ? (dB * sB) >> 8 : 0; |
| 820 | 229 |
| 230 #define BLEND_MIN(sR, sG, sB, sA, dR, dG, dB, dA) \ | |
| 231 if(sR < dR) { dR = sR; } \ | |
| 232 if(sG < dG) { dG = sG; } \ | |
| 1034 | 233 if(sB < dB) { dB = sB; } |
| 820 | 234 |
| 235 #define BLEND_MAX(sR, sG, sB, sA, dR, dG, dB, dA) \ | |
| 236 if(sR > dR) { dR = sR; } \ | |
| 237 if(sG > dG) { dG = sG; } \ | |
| 1034 | 238 if(sB > dB) { dB = sB; } |
| 820 | 239 |
|
1141
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
240 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
241 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
242 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
243 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
244 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
245 #define BLEND_RGBA_ADD(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
246 tmp = dR + sR; dR = (tmp <= 255 ? tmp : 255); \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
247 tmp = dG + sG; dG = (tmp <= 255 ? tmp : 255); \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
248 tmp = dB + sB; dB = (tmp <= 255 ? tmp : 255); \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
249 tmp = dA + sA; dA = (tmp <= 255 ? tmp : 255); |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
250 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
251 #define BLEND_RGBA_SUB(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
252 tmp = dR - sR; dR = (tmp >= 0 ? tmp : 0); \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
253 tmp = dG - sG; dG = (tmp >= 0 ? tmp : 0); \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
254 tmp = dB - sB; dB = (tmp >= 0 ? tmp : 0); \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
255 tmp = dA - sA; dA = (tmp >= 0 ? tmp : 0); |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
256 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
257 #define BLEND_RGBA_MULT(sR, sG, sB, sA, dR, dG, dB, dA) \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
258 dR = (dR && sR) ? (dR * sR) >> 8 : 0; \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
259 dG = (dG && sG) ? (dG * sG) >> 8 : 0; \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
260 dB = (dB && sB) ? (dB * sB) >> 8 : 0; \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
261 dA = (dA && sA) ? (dA * sA) >> 8 : 0; |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
262 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
263 #define BLEND_RGBA_MIN(sR, sG, sB, sA, dR, dG, dB, dA) \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
264 if(sR < dR) { dR = sR; } \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
265 if(sG < dG) { dG = sG; } \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
266 if(sB < dB) { dB = sB; } \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
267 if(sA < dA) { dA = sA; } |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
268 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
269 #define BLEND_RGBA_MAX(sR, sG, sB, sA, dR, dG, dB, dA) \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
270 if(sR > dR) { dR = sR; } \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
271 if(sG > dG) { dG = sG; } \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
272 if(sB > dB) { dB = sB; } \ |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
273 if(sA > dA) { dA = sA; } |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
274 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
275 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
276 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
277 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
278 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
279 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
280 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
281 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
282 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
283 |
|
99a96e8e563d
Added BLEND_RGBA_* special flags for blit, and fill.
Rene Dudfield <renesd@gmail.com>
parents:
1034
diff
changeset
|
284 |
| 820 | 285 #if 1 |
|
1296
2ef1988f57d3
alpha blit bug where source elements are decremented by 1
Lenard Lindstrom <len-l@telus.net>
parents:
1142
diff
changeset
|
286 /* Choose an alpha blend equation. If the sign is preserved on a right shift |
|
2ef1988f57d3
alpha blit bug where source elements are decremented by 1
Lenard Lindstrom <len-l@telus.net>
parents:
1142
diff
changeset
|
287 * then use a specialized, faster, equation. Otherwise a more general form, |
|
2ef1988f57d3
alpha blit bug where source elements are decremented by 1
Lenard Lindstrom <len-l@telus.net>
parents:
1142
diff
changeset
|
288 * where all additions are done before the shift, is needed. |
|
2ef1988f57d3
alpha blit bug where source elements are decremented by 1
Lenard Lindstrom <len-l@telus.net>
parents:
1142
diff
changeset
|
289 */ |
|
2ef1988f57d3
alpha blit bug where source elements are decremented by 1
Lenard Lindstrom <len-l@telus.net>
parents:
1142
diff
changeset
|
290 #if (-1 >> 1) < 0 |
|
1511
1403c372c528
fix erroneous ALPHA_BLEND macro argument
Lenard Lindstrom <len-l@telus.net>
parents:
1505
diff
changeset
|
291 #define ALPHA_BLEND_COMP(sC, dC, sA) ((((sC - dC) * sA + sC) >> 8) + dC) |
|
1296
2ef1988f57d3
alpha blit bug where source elements are decremented by 1
Lenard Lindstrom <len-l@telus.net>
parents:
1142
diff
changeset
|
292 #else |
|
1511
1403c372c528
fix erroneous ALPHA_BLEND macro argument
Lenard Lindstrom <len-l@telus.net>
parents:
1505
diff
changeset
|
293 #define ALPHA_BLEND_COMP(sC, dC, sA) (((dC << 8) + (sC - dC) * sA + sC) >> 8) |
|
1296
2ef1988f57d3
alpha blit bug where source elements are decremented by 1
Lenard Lindstrom <len-l@telus.net>
parents:
1142
diff
changeset
|
294 #endif |
|
2ef1988f57d3
alpha blit bug where source elements are decremented by 1
Lenard Lindstrom <len-l@telus.net>
parents:
1142
diff
changeset
|
295 |
| 820 | 296 #define ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB, dA) \ |
| 297 do { \ | |
| 298 if (dA) \ | |
| 299 { \ | |
|
1511
1403c372c528
fix erroneous ALPHA_BLEND macro argument
Lenard Lindstrom <len-l@telus.net>
parents:
1505
diff
changeset
|
300 dR = ALPHA_BLEND_COMP(sR, dR, sA); \ |
|
1403c372c528
fix erroneous ALPHA_BLEND macro argument
Lenard Lindstrom <len-l@telus.net>
parents:
1505
diff
changeset
|
301 dG = ALPHA_BLEND_COMP(sG, dG, sA); \ |
|
1403c372c528
fix erroneous ALPHA_BLEND macro argument
Lenard Lindstrom <len-l@telus.net>
parents:
1505
diff
changeset
|
302 dB = ALPHA_BLEND_COMP(sB, dB, sA); \ |
| 820 | 303 dA = sA + dA - ((sA * dA) / 255); \ |
| 304 } \ | |
| 305 else \ | |
| 306 { \ | |
| 307 dR = sR; \ | |
| 308 dG = sG; \ | |
| 309 dB = sB; \ | |
| 310 dA = sA; \ | |
| 311 } \ | |
| 312 } while(0) | |
|
3095
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
313 |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
314 #define ALPHA_BLEND_PREMULTIPLIED_COMP(sC, dC, sA) (sC + dC - ((dC * sA) >> 8)) |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
315 |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
316 #define ALPHA_BLEND_PREMULTIPLIED(tmp, sR, sG, sB, sA, dR, dG, dB, dA) \ |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
317 do { \ |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
318 tmp = ALPHA_BLEND_PREMULTIPLIED_COMP(sR, dR, sA); dR = (tmp > 255 ? 255 : tmp); \ |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
319 tmp = ALPHA_BLEND_PREMULTIPLIED_COMP(sG, dG, sA); dG = (tmp > 255 ? 255 : tmp); \ |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
320 tmp = ALPHA_BLEND_PREMULTIPLIED_COMP(sB, dB, sA); dB = (tmp > 255 ? 255 : tmp); \ |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
321 dA = sA + dA - ((sA * dA) / 255); \ |
|
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
322 } while(0) |
| 820 | 323 #elif 0 |
|
3095
549f3fb44e55
Add support for premultiplied alpha, necessary for integration with Cairo.
David Turner <novalis@novalis.org>
parents:
2075
diff
changeset
|
324 |
| 820 | 325 #define ALPHA_BLEND(sR, sG, sB, sA, dR, dG, dB, dA) \ |
| 326 do { \ | |
| 327 if(sA){ \ | |
| 328 if(dA && sA < 255){ \ | |
| 329 int dContrib = dA*(255 - sA)/255; \ | |
| 330 dA = sA+dA - ((sA*dA)/255); \ | |
| 331 dR = (dR*dContrib + sR*sA)/dA; \ | |
| 332 dG = (dG*dContrib + sG*sA)/dA; \ | |
| 333 dB = (dB*dContrib + sB*sA)/dA; \ | |
| 334 }else{ \ | |
| 335 dR = sR; \ | |
| 336 dG = sG; \ | |
| 337 dB = sB; \ | |
| 338 dA = sA; \ | |
| 339 } \ | |
| 340 } \ | |
| 341 } while(0) | |
| 342 #endif | |
| 343 | |
| 344 int | |
| 345 surface_fill_blend (SDL_Surface *surface, SDL_Rect *rect, Uint32 color, | |
| 346 int blendargs); | |
|
3122
55d7ab7a344f
Surface.fill() respects clipping rect or surface bounds with special flags.
Rene Dudfield <renesd@gmail.com>
parents:
3095
diff
changeset
|
347 |
|
55d7ab7a344f
Surface.fill() respects clipping rect or surface bounds with special flags.
Rene Dudfield <renesd@gmail.com>
parents:
3095
diff
changeset
|
348 void |
|
55d7ab7a344f
Surface.fill() respects clipping rect or surface bounds with special flags.
Rene Dudfield <renesd@gmail.com>
parents:
3095
diff
changeset
|
349 surface_respect_clip_rect (SDL_Surface *surface, SDL_Rect *rect); |
| 820 | 350 |
| 351 int | |
| 352 pygame_AlphaBlit (SDL_Surface * src, SDL_Rect * srcrect, | |
|
1142
befac1186c08
some fixes for BLEND_RGBA_*
Rene Dudfield <renesd@gmail.com>
parents:
1141
diff
changeset
|
353 SDL_Surface * dst, SDL_Rect * dstrect, int the_args); |
| 820 | 354 |
| 355 int | |
| 356 pygame_Blit (SDL_Surface * src, SDL_Rect * srcrect, | |
| 357 SDL_Surface * dst, SDL_Rect * dstrect, int the_args); | |
| 358 | |
| 359 #endif /* SURFACE_H */ |
