Mercurial > sdl-ios-xcode
annotate src/video/sdlgenblit.pl @ 5246:189b1bdb7baf
Surfaces aren't in hardware memory anymore!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 10 Feb 2011 05:10:05 -0800 |
parents | d976b67150c5 |
children |
rev | line source |
---|---|
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 #!/usr/bin/perl -w |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 # |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 # A script to generate optimized C blitters for Simple DirectMedia Layer |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 # http://www.libsdl.org/ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 use warnings; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 use strict; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 my %file; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 # The formats potentially supported by this script: |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 # SDL_PIXELFORMAT_RGB332 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 # SDL_PIXELFORMAT_RGB444 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 # SDL_PIXELFORMAT_RGB555 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 # SDL_PIXELFORMAT_ARGB4444 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 # SDL_PIXELFORMAT_ARGB1555 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 # SDL_PIXELFORMAT_RGB565 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 # SDL_PIXELFORMAT_RGB24 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 # SDL_PIXELFORMAT_BGR24 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 # SDL_PIXELFORMAT_RGB888 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 # SDL_PIXELFORMAT_BGR888 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 # SDL_PIXELFORMAT_ARGB8888 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 # SDL_PIXELFORMAT_RGBA8888 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 # SDL_PIXELFORMAT_ABGR8888 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 # SDL_PIXELFORMAT_BGRA8888 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 # SDL_PIXELFORMAT_ARGB2101010 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 # The formats we're actually creating blitters for: |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 my @src_formats = ( |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 "RGB888", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 "BGR888", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 "ARGB8888", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 "RGBA8888", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 "ABGR8888", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 "BGRA8888", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 ); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 my @dst_formats = ( |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 "RGB888", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 "BGR888", |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
40 "ARGB8888", |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 ); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 my %format_size = ( |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 "RGB888" => 4, |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 "BGR888" => 4, |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 "ARGB8888" => 4, |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 "RGBA8888" => 4, |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 "ABGR8888" => 4, |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 "BGRA8888" => 4, |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 ); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 my %format_type = ( |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 "RGB888" => "Uint32", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 "BGR888" => "Uint32", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 "ARGB8888" => "Uint32", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 "RGBA8888" => "Uint32", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 "ABGR8888" => "Uint32", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 "BGRA8888" => "Uint32", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 ); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 my %get_rgba_string = ( |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 "RGB888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel; _A = 0xFF;", |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
63 "BGR888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel; _A = 0xFF;", "ARGB8888" => "_A = (Uint8)(_pixel >> 24); _R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;", |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 "RGBA8888" => "_R = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _B = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 "ABGR8888" => "_A = (Uint8)(_pixel >> 24); _B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 "BGRA8888" => "_B = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _R = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 ); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 my %set_rgba_string = ( |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 "RGB888" => "_pixel = ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;", |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 "BGR888" => "_pixel = ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;", |
2800
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
72 "ARGB8888" => "_pixel = ((Uint32)_A << 24) | ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;", |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
73 "RGBA8888" => "_pixel = ((Uint32)_R << 24) | ((Uint32)_G << 16) | ((Uint32)_B << 8) | _A;", |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
74 "ABGR8888" => "_pixel = ((Uint32)_A << 24) | ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;", |
8969da2ef606
Added ARGB8888 destination format (used on Mac OS X)
Sam Lantinga <slouken@libsdl.org>
parents:
2267
diff
changeset
|
75 "BGRA8888" => "_pixel = ((Uint32)_B << 24) | ((Uint32)_G << 16) | ((Uint32)_R << 8) | _A;", |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 ); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 sub open_file { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 my $name = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 open(FILE, ">$name.new") || die "Cant' open $name.new: $!"; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 /* |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 SDL - Simple DirectMedia Layer |
5143
e743b9c3f6d6
Making the API simpler, the blend modes are "none, blend, add" and are supported by all renderers.
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
85 Copyright (C) 1997-2011 Sam Lantinga |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 This library is free software; you can redistribute it and/or |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 modify it under the terms of the GNU Lesser General Public |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 License as published by the Free Software Foundation; either |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 version 2.1 of the License, or (at your option) any later version. |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 This library is distributed in the hope that it will be useful, |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 but WITHOUT ANY WARRANTY; without even the implied warranty of |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 Lesser General Public License for more details. |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 You should have received a copy of the GNU Lesser General Public |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 License along with this library; if not, write to the Free Software |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 Sam Lantinga |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 slouken\@libsdl.org |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 */ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 #include "SDL_config.h" |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 /* *INDENT-OFF* */ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 sub close_file { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 my $name = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 /* *INDENT-ON* */ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 /* vi: set ts=4 sw=4 expandtab: */ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 close FILE; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 if ( ! -f $name || system("cmp -s $name $name.new") != 0 ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 rename("$name.new", "$name"); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 } else { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 unlink("$name.new"); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 sub output_copydefs |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 print FILE <<__EOF__; |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
129 extern SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[]; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 sub output_copyfuncname |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 my $prefix = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 my $src = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 my $dst = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 my $modulate = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 my $blend = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 my $scale = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 my $args = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 my $suffix = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
144 print FILE "$prefix SDL_Blit_${src}_${dst}"; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 if ( $modulate ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 print FILE "_Modulate"; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 if ( $blend ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 print FILE "_Blend"; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 if ( $scale ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 print FILE "_Scale"; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 if ( $args ) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
155 print FILE "(SDL_BlitInfo *info)"; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 print FILE "$suffix"; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 sub get_rgba |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 my $prefix = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 my $format = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 my $string = $get_rgba_string{$format}; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 $string =~ s/_/$prefix/g; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 if ( $prefix ne "" ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 ${prefix}pixel = *$prefix; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 } else { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 pixel = *src; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 $string |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 sub set_rgba |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 my $prefix = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 my $format = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 my $string = $set_rgba_string{$format}; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 $string =~ s/_/$prefix/g; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 $string |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 *dst = ${prefix}pixel; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 sub output_copycore |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 my $src = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 my $dst = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 my $modulate = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 my $blend = shift; |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
198 my $s = ""; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
199 my $d = ""; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
200 |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
201 # Nice and easy... |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
202 if ( $src eq $dst && !$modulate && !$blend ) { |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
203 print FILE <<__EOF__; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
204 *dst = *src; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
205 __EOF__ |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
206 return; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
207 } |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
208 |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
209 if ( $blend ) { |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
210 get_rgba("src", $src); |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
211 get_rgba("dst", $dst); |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
212 $s = "src"; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
213 $d = "dst"; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
214 } else { |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
215 get_rgba("", $src); |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
216 } |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
217 |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 if ( $modulate ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 print FILE <<__EOF__; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
220 if (flags & SDL_COPY_MODULATE_COLOR) { |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
221 ${s}R = (${s}R * modulateR) / 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
222 ${s}G = (${s}G * modulateG) / 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
223 ${s}B = (${s}B * modulateB) / 255; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 } |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
225 if (flags & SDL_COPY_MODULATE_ALPHA) { |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
226 ${s}A = (${s}A * modulateA) / 255; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 if ( $blend ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 print FILE <<__EOF__; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
232 if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 /* This goes away if we ever use premultiplied alpha */ |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
234 if (${s}A < 255) { |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
235 ${s}R = (${s}R * ${s}A) / 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
236 ${s}G = (${s}G * ${s}A) / 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
237 ${s}B = (${s}B * ${s}A) / 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
238 } |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 } |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5152
diff
changeset
|
240 switch (flags & (SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
241 case SDL_COPY_BLEND: |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
242 ${d}R = ${s}R + ((255 - ${s}A) * ${d}R) / 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
243 ${d}G = ${s}G + ((255 - ${s}A) * ${d}G) / 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
244 ${d}B = ${s}B + ((255 - ${s}A) * ${d}B) / 255; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 break; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
246 case SDL_COPY_ADD: |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
247 ${d}R = ${s}R + ${d}R; if (${d}R > 255) ${d}R = 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
248 ${d}G = ${s}G + ${d}G; if (${d}G > 255) ${d}G = 255; |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
249 ${d}B = ${s}B + ${d}B; if (${d}B > 255) ${d}B = 255; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 break; |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5152
diff
changeset
|
251 case SDL_COPY_MOD: |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5152
diff
changeset
|
252 ${d}R = (${s}R * ${d}R) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5152
diff
changeset
|
253 ${d}G = (${s}G * ${d}G) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5152
diff
changeset
|
254 ${d}B = (${s}B * ${d}B) / 255; |
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5152
diff
changeset
|
255 break; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 } |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
259 if ( $blend ) { |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
260 set_rgba("dst", $dst); |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
261 } else { |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
262 set_rgba("", $dst); |
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
263 } |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 sub output_copyfunc |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 my $src = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 my $dst = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 my $modulate = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 my $blend = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 my $scale = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
274 output_copyfuncname("static void", $src, $dst, $modulate, $blend, $scale, 1, "\n"); |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
277 const int flags = info->flags; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 if ( $modulate ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 print FILE <<__EOF__; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
281 const Uint32 modulateR = info->r; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
282 const Uint32 modulateG = info->g; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
283 const Uint32 modulateB = info->b; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
284 const Uint32 modulateA = info->a; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 if ( $blend ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 Uint32 srcpixel; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 Uint32 srcR, srcG, srcB, srcA; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 Uint32 dstpixel; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 Uint32 dstR, dstG, dstB, dstA; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 } elsif ( $modulate || $src ne $dst ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 Uint32 pixel; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 Uint32 R, G, B, A; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 if ( $scale ) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 int srcy, srcx; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 int posy, posx; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 int incy, incx; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 srcy = 0; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 posy = 0; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
308 incy = (info->src_h << 16) / info->dst_h; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
309 incx = (info->src_w << 16) / info->dst_w; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
311 while (info->dst_h--) { |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 $format_type{$src} *src; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
313 $format_type{$dst} *dst = ($format_type{$dst} *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
314 int n = info->dst_w; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 srcx = -1; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 posx = 0x10000L; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 while (posy >= 0x10000L) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 ++srcy; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 posy -= 0x10000L; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 while (n--) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 if (posx >= 0x10000L) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 while (posx >= 0x10000L) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 ++srcx; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 posx -= 0x10000L; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 } |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
327 src = ($format_type{$src} *)(info->src + (srcy * info->src_pitch) + (srcx * $format_size{$src})); |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 __EOF__ |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
332 output_copycore($src, $dst, $modulate, $blend); |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 posx += incx; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 ++dst; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 posy += incy; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
338 info->dst += info->dst_pitch; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 } else { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
344 while (info->dst_h--) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
345 $format_type{$src} *src = ($format_type{$src} *)info->src; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
346 $format_type{$dst} *dst = ($format_type{$dst} *)info->dst; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
347 int n = info->dst_w; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 while (n--) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 __EOF__ |
1989
5b5f5de5433f
Optimized the copy blitters a little bit
Sam Lantinga <slouken@libsdl.org>
parents:
1985
diff
changeset
|
350 output_copycore($src, $dst, $modulate, $blend); |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 ++src; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 ++dst; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 } |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
355 info->src += info->src_pitch; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
356 info->dst += info->dst_pitch; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 sub output_copyfunc_h |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 sub output_copyinc |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 print FILE <<__EOF__; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 #include "SDL_video.h" |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
374 #include "SDL_blit.h" |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
375 #include "SDL_blit_auto.h" |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 sub output_copyfunctable |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 print FILE <<__EOF__; |
2267
c785543d1843
Okay, still some bugs, but everything builds again...
Sam Lantinga <slouken@libsdl.org>
parents:
2263
diff
changeset
|
383 SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 for (my $i = 0; $i <= $#src_formats; ++$i) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 my $src = $src_formats[$i]; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 for (my $j = 0; $j <= $#dst_formats; ++$j) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 my $dst = $dst_formats[$j]; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 for (my $modulate = 0; $modulate <= 1; ++$modulate) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 for (my $blend = 0; $blend <= 1; ++$blend) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 for (my $scale = 0; $scale <= 1; ++$scale) { |
1992
7387e0514595
Take advantage of the existing SDL blitters for normal copy blits.
Sam Lantinga <slouken@libsdl.org>
parents:
1989
diff
changeset
|
392 if ( $modulate || $blend || $scale ) { |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 print FILE " { SDL_PIXELFORMAT_$src, SDL_PIXELFORMAT_$dst, "; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
394 my $flags = ""; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
395 my $flag = ""; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 if ( $modulate ) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
397 $flag = "SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA"; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
398 if ( $flags eq "" ) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
399 $flags = $flag; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
400 } else { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
401 $flags = "$flags | $flag"; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
402 } |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 if ( $blend ) { |
5187
d976b67150c5
Restored SDL_BLENDMODE_MOD for MAME
Sam Lantinga <slouken@libsdl.org>
parents:
5152
diff
changeset
|
405 $flag = "SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD"; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
406 if ( $flags eq "" ) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
407 $flags = $flag; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
408 } else { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
409 $flags = "$flags | $flag"; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
410 } |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 if ( $scale ) { |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
413 $flag = "SDL_COPY_NEAREST"; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
414 if ( $flags eq "" ) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
415 $flags = $flag; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
416 } else { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
417 $flags = "$flags | $flag"; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
418 } |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 } |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
420 if ( $flags eq "" ) { |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
421 $flags = "0"; |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
422 } |
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
423 print FILE "($flags), SDL_CPU_ANY,"; |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 output_copyfuncname("", $src_formats[$i], $dst_formats[$j], $modulate, $blend, $scale, 0, " },\n"); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 print FILE <<__EOF__; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
432 { 0, 0, 0, 0, NULL } |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 }; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 __EOF__ |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 sub output_copyfunc_c |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 my $src = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 my $dst = shift; |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 for (my $modulate = 0; $modulate <= 1; ++$modulate) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 for (my $blend = 0; $blend <= 1; ++$blend) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 for (my $scale = 0; $scale <= 1; ++$scale) { |
1992
7387e0514595
Take advantage of the existing SDL blitters for normal copy blits.
Sam Lantinga <slouken@libsdl.org>
parents:
1989
diff
changeset
|
446 if ( $modulate || $blend || $scale ) { |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 output_copyfunc($src, $dst, $modulate, $blend, $scale); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
454 open_file("SDL_blit_auto.h"); |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 output_copydefs(); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 for (my $i = 0; $i <= $#src_formats; ++$i) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 for (my $j = 0; $j <= $#dst_formats; ++$j) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 output_copyfunc_h($src_formats[$i], $dst_formats[$j]); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 print FILE "\n"; |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
462 close_file("SDL_blit_auto.h"); |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
464 open_file("SDL_blit_auto.c"); |
1985
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 output_copyinc(); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 for (my $i = 0; $i <= $#src_formats; ++$i) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
467 for (my $j = 0; $j <= $#dst_formats; ++$j) { |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 output_copyfunc_c($src_formats[$i], $dst_formats[$j]); |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 } |
8055185ae4ed
Added source color and alpha modulation support.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 } |
2263
900c35d8e8fd
More work in progress, still doesn't compile...
Sam Lantinga <slouken@libsdl.org>
parents:
2262
diff
changeset
|
471 output_copyfunctable(); |
2262
bee005ace1bf
Work in progress: merging new texture features into SDL blit system
Sam Lantinga <slouken@libsdl.org>
parents:
1992
diff
changeset
|
472 close_file("SDL_blit_auto.c"); |