comparison src/video/SDL_blendrect.c @ 2900:3a9636c83849

Make it possible to switch algorithms in the future
author Sam Lantinga <slouken@libsdl.org>
date Sun, 21 Dec 2008 08:59:56 +0000
parents a0c837a16e4c
children 0267b8b1595c
comparison
equal deleted inserted replaced
2899:a0c837a16e4c 2900:3a9636c83849
30 { 30 {
31 unsigned inva = 0xff - a; 31 unsigned inva = 0xff - a;
32 32
33 switch (blendMode) { 33 switch (blendMode) {
34 case SDL_BLENDMODE_BLEND: 34 case SDL_BLENDMODE_BLEND:
35 BLENDRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB555); 35 FILLRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB555);
36 break; 36 break;
37 case SDL_BLENDMODE_ADD: 37 case SDL_BLENDMODE_ADD:
38 BLENDRECT(Uint16, DRAW_SETPIXEL_ADD_RGB555); 38 FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB555);
39 break; 39 break;
40 case SDL_BLENDMODE_MOD: 40 case SDL_BLENDMODE_MOD:
41 BLENDRECT(Uint16, DRAW_SETPIXEL_MOD_RGB555); 41 FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB555);
42 break; 42 break;
43 default: 43 default:
44 BLENDRECT(Uint16, DRAW_SETPIXEL_RGB555); 44 FILLRECT(Uint16, DRAW_SETPIXEL_RGB555);
45 break; 45 break;
46 } 46 }
47 return 0; 47 return 0;
48 } 48 }
49 49
53 { 53 {
54 unsigned inva = 0xff - a; 54 unsigned inva = 0xff - a;
55 55
56 switch (blendMode) { 56 switch (blendMode) {
57 case SDL_BLENDMODE_BLEND: 57 case SDL_BLENDMODE_BLEND:
58 BLENDRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB565); 58 FILLRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB565);
59 break; 59 break;
60 case SDL_BLENDMODE_ADD: 60 case SDL_BLENDMODE_ADD:
61 BLENDRECT(Uint16, DRAW_SETPIXEL_ADD_RGB565); 61 FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB565);
62 break; 62 break;
63 case SDL_BLENDMODE_MOD: 63 case SDL_BLENDMODE_MOD:
64 BLENDRECT(Uint16, DRAW_SETPIXEL_MOD_RGB565); 64 FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB565);
65 break; 65 break;
66 default: 66 default:
67 BLENDRECT(Uint16, DRAW_SETPIXEL_RGB565); 67 FILLRECT(Uint16, DRAW_SETPIXEL_RGB565);
68 break; 68 break;
69 } 69 }
70 return 0; 70 return 0;
71 } 71 }
72 72
76 { 76 {
77 unsigned inva = 0xff - a; 77 unsigned inva = 0xff - a;
78 78
79 switch (blendMode) { 79 switch (blendMode) {
80 case SDL_BLENDMODE_BLEND: 80 case SDL_BLENDMODE_BLEND:
81 BLENDRECT(Uint32, DRAW_SETPIXEL_BLEND_RGB888); 81 FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_RGB888);
82 break; 82 break;
83 case SDL_BLENDMODE_ADD: 83 case SDL_BLENDMODE_ADD:
84 BLENDRECT(Uint32, DRAW_SETPIXEL_ADD_RGB888); 84 FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGB888);
85 break; 85 break;
86 case SDL_BLENDMODE_MOD: 86 case SDL_BLENDMODE_MOD:
87 BLENDRECT(Uint32, DRAW_SETPIXEL_MOD_RGB888); 87 FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGB888);
88 break; 88 break;
89 default: 89 default:
90 BLENDRECT(Uint32, DRAW_SETPIXEL_RGB888); 90 FILLRECT(Uint32, DRAW_SETPIXEL_RGB888);
91 break; 91 break;
92 } 92 }
93 return 0; 93 return 0;
94 } 94 }
95 95
99 { 99 {
100 unsigned inva = 0xff - a; 100 unsigned inva = 0xff - a;
101 101
102 switch (blendMode) { 102 switch (blendMode) {
103 case SDL_BLENDMODE_BLEND: 103 case SDL_BLENDMODE_BLEND:
104 BLENDRECT(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888); 104 FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_ARGB8888);
105 break; 105 break;
106 case SDL_BLENDMODE_ADD: 106 case SDL_BLENDMODE_ADD:
107 BLENDRECT(Uint32, DRAW_SETPIXEL_ADD_ARGB8888); 107 FILLRECT(Uint32, DRAW_SETPIXEL_ADD_ARGB8888);
108 break; 108 break;
109 case SDL_BLENDMODE_MOD: 109 case SDL_BLENDMODE_MOD:
110 BLENDRECT(Uint32, DRAW_SETPIXEL_MOD_ARGB8888); 110 FILLRECT(Uint32, DRAW_SETPIXEL_MOD_ARGB8888);
111 break; 111 break;
112 default: 112 default:
113 BLENDRECT(Uint32, DRAW_SETPIXEL_ARGB8888); 113 FILLRECT(Uint32, DRAW_SETPIXEL_ARGB8888);
114 break; 114 break;
115 } 115 }
116 return 0; 116 return 0;
117 } 117 }
118 118
125 125
126 switch (fmt->BytesPerPixel) { 126 switch (fmt->BytesPerPixel) {
127 case 2: 127 case 2:
128 switch (blendMode) { 128 switch (blendMode) {
129 case SDL_BLENDMODE_BLEND: 129 case SDL_BLENDMODE_BLEND:
130 BLENDRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB); 130 FILLRECT(Uint16, DRAW_SETPIXEL_BLEND_RGB);
131 break; 131 break;
132 case SDL_BLENDMODE_ADD: 132 case SDL_BLENDMODE_ADD:
133 BLENDRECT(Uint16, DRAW_SETPIXEL_ADD_RGB); 133 FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB);
134 break; 134 break;
135 case SDL_BLENDMODE_MOD: 135 case SDL_BLENDMODE_MOD:
136 BLENDRECT(Uint16, DRAW_SETPIXEL_MOD_RGB); 136 FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB);
137 break; 137 break;
138 default: 138 default:
139 BLENDRECT(Uint16, DRAW_SETPIXEL_RGB); 139 FILLRECT(Uint16, DRAW_SETPIXEL_RGB);
140 break; 140 break;
141 } 141 }
142 return 0; 142 return 0;
143 case 4: 143 case 4:
144 switch (blendMode) { 144 switch (blendMode) {
145 case SDL_BLENDMODE_BLEND: 145 case SDL_BLENDMODE_BLEND:
146 BLENDRECT(Uint32, DRAW_SETPIXEL_BLEND_RGB); 146 FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_RGB);
147 break; 147 break;
148 case SDL_BLENDMODE_ADD: 148 case SDL_BLENDMODE_ADD:
149 BLENDRECT(Uint32, DRAW_SETPIXEL_ADD_RGB); 149 FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGB);
150 break; 150 break;
151 case SDL_BLENDMODE_MOD: 151 case SDL_BLENDMODE_MOD:
152 BLENDRECT(Uint32, DRAW_SETPIXEL_MOD_RGB); 152 FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGB);
153 break; 153 break;
154 default: 154 default:
155 BLENDRECT(Uint32, DRAW_SETPIXEL_RGB); 155 FILLRECT(Uint32, DRAW_SETPIXEL_RGB);
156 break; 156 break;
157 } 157 }
158 return 0; 158 return 0;
159 default: 159 default:
160 SDL_Unsupported(); 160 SDL_Unsupported();
171 171
172 switch (fmt->BytesPerPixel) { 172 switch (fmt->BytesPerPixel) {
173 case 4: 173 case 4:
174 switch (blendMode) { 174 switch (blendMode) {
175 case SDL_BLENDMODE_BLEND: 175 case SDL_BLENDMODE_BLEND:
176 BLENDRECT(Uint32, DRAW_SETPIXEL_BLEND_RGBA); 176 FILLRECT(Uint32, DRAW_SETPIXEL_BLEND_RGBA);
177 break; 177 break;
178 case SDL_BLENDMODE_ADD: 178 case SDL_BLENDMODE_ADD:
179 BLENDRECT(Uint32, DRAW_SETPIXEL_ADD_RGBA); 179 FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGBA);
180 break; 180 break;
181 case SDL_BLENDMODE_MOD: 181 case SDL_BLENDMODE_MOD:
182 BLENDRECT(Uint32, DRAW_SETPIXEL_MOD_RGBA); 182 FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGBA);
183 break; 183 break;
184 default: 184 default:
185 BLENDRECT(Uint32, DRAW_SETPIXEL_RGBA); 185 FILLRECT(Uint32, DRAW_SETPIXEL_RGBA);
186 break; 186 break;
187 } 187 }
188 return 0; 188 return 0;
189 default: 189 default:
190 SDL_Unsupported(); 190 SDL_Unsupported();