SDL  2.0
SDL_blit_0.c File Reference
#include "../SDL_internal.h"
#include "SDL_video.h"
#include "SDL_blit.h"
+ Include dependency graph for SDL_blit_0.c:

Go to the source code of this file.

Functions

static void BlitBto1 (SDL_BlitInfo *info)
 
static void BlitBto2 (SDL_BlitInfo *info)
 
static void BlitBto3 (SDL_BlitInfo *info)
 
static void BlitBto4 (SDL_BlitInfo *info)
 
static void BlitBto1Key (SDL_BlitInfo *info)
 
static void BlitBto2Key (SDL_BlitInfo *info)
 
static void BlitBto3Key (SDL_BlitInfo *info)
 
static void BlitBto4Key (SDL_BlitInfo *info)
 
static void BlitBtoNAlpha (SDL_BlitInfo *info)
 
static void BlitBtoNAlphaKey (SDL_BlitInfo *info)
 
SDL_BlitFunc SDL_CalculateBlit0 (SDL_Surface *surface)
 

Variables

static const SDL_BlitFunc bitmap_blit []
 
static const SDL_BlitFunc colorkey_blit []
 

Function Documentation

◆ BlitBto1()

static void BlitBto1 ( SDL_BlitInfo info)
static

Definition at line 29 of file SDL_blit_0.c.

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, map, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

30 {
31  int c;
32  int width, height;
33  Uint8 *src, *map, *dst;
34  int srcskip, dstskip;
35 
36  /* Set up some basic variables */
37  width = info->dst_w;
38  height = info->dst_h;
39  src = info->src;
40  srcskip = info->src_skip;
41  dst = info->dst;
42  dstskip = info->dst_skip;
43  map = info->table;
44  srcskip += width - (width + 7) / 8;
45 
46  if (map) {
47  while (height--) {
48  Uint8 byte = 0, bit;
49  for (c = 0; c < width; ++c) {
50  if ((c & 7) == 0) {
51  byte = *src++;
52  }
53  bit = (byte & 0x80) >> 7;
54  if (1) {
55  *dst = map[bit];
56  }
57  dst++;
58  byte <<= 1;
59  }
60  src += srcskip;
61  dst += dstskip;
62  }
63  } else {
64  while (height--) {
65  Uint8 byte = 0, bit;
66  for (c = 0; c < width; ++c) {
67  if ((c & 7) == 0) {
68  byte = *src++;
69  }
70  bit = (byte & 0x80) >> 7;
71  if (1) {
72  *dst = bit;
73  }
74  dst++;
75  byte <<= 1;
76  }
77  src += srcskip;
78  dst += dstskip;
79  }
80  }
81 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:290

◆ BlitBto1Key()

static void BlitBto1Key ( SDL_BlitInfo info)
static

Definition at line 197 of file SDL_blit_0.c.

References SDL_BlitInfo::colorkey, SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

198 {
199  int width = info->dst_w;
200  int height = info->dst_h;
201  Uint8 *src = info->src;
202  Uint8 *dst = info->dst;
203  int srcskip = info->src_skip;
204  int dstskip = info->dst_skip;
205  Uint32 ckey = info->colorkey;
206  Uint8 *palmap = info->table;
207  int c;
208 
209  /* Set up some basic variables */
210  srcskip += width - (width + 7) / 8;
211 
212  if (palmap) {
213  while (height--) {
214  Uint8 byte = 0, bit;
215  for (c = 0; c < width; ++c) {
216  if ((c & 7) == 0) {
217  byte = *src++;
218  }
219  bit = (byte & 0x80) >> 7;
220  if (bit != ckey) {
221  *dst = palmap[bit];
222  }
223  dst++;
224  byte <<= 1;
225  }
226  src += srcskip;
227  dst += dstskip;
228  }
229  } else {
230  while (height--) {
231  Uint8 byte = 0, bit;
232  for (c = 0; c < width; ++c) {
233  if ((c & 7) == 0) {
234  byte = *src++;
235  }
236  bit = (byte & 0x80) >> 7;
237  if (bit != ckey) {
238  *dst = bit;
239  }
240  dst++;
241  byte <<= 1;
242  }
243  src += srcskip;
244  dst += dstskip;
245  }
246  }
247 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

◆ BlitBto2()

static void BlitBto2 ( SDL_BlitInfo info)
static

Definition at line 84 of file SDL_blit_0.c.

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, map, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

85 {
86  int c;
87  int width, height;
88  Uint8 *src;
89  Uint16 *map, *dst;
90  int srcskip, dstskip;
91 
92  /* Set up some basic variables */
93  width = info->dst_w;
94  height = info->dst_h;
95  src = info->src;
96  srcskip = info->src_skip;
97  dst = (Uint16 *) info->dst;
98  dstskip = info->dst_skip / 2;
99  map = (Uint16 *) info->table;
100  srcskip += width - (width + 7) / 8;
101 
102  while (height--) {
103  Uint8 byte = 0, bit;
104  for (c = 0; c < width; ++c) {
105  if ((c & 7) == 0) {
106  byte = *src++;
107  }
108  bit = (byte & 0x80) >> 7;
109  if (1) {
110  *dst = map[bit];
111  }
112  byte <<= 1;
113  dst++;
114  }
115  src += srcskip;
116  dst += dstskip;
117  }
118 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
uint16_t Uint16
Definition: SDL_stdinc.h:169
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:290

◆ BlitBto2Key()

static void BlitBto2Key ( SDL_BlitInfo info)
static

Definition at line 250 of file SDL_blit_0.c.

References SDL_BlitInfo::colorkey, SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

251 {
252  int width = info->dst_w;
253  int height = info->dst_h;
254  Uint8 *src = info->src;
255  Uint16 *dstp = (Uint16 *) info->dst;
256  int srcskip = info->src_skip;
257  int dstskip = info->dst_skip;
258  Uint32 ckey = info->colorkey;
259  Uint8 *palmap = info->table;
260  int c;
261 
262  /* Set up some basic variables */
263  srcskip += width - (width + 7) / 8;
264  dstskip /= 2;
265 
266  while (height--) {
267  Uint8 byte = 0, bit;
268  for (c = 0; c < width; ++c) {
269  if ((c & 7) == 0) {
270  byte = *src++;
271  }
272  bit = (byte & 0x80) >> 7;
273  if (bit != ckey) {
274  *dstp = ((Uint16 *) palmap)[bit];
275  }
276  byte <<= 1;
277  dstp++;
278  }
279  src += srcskip;
280  dstp += dstskip;
281  }
282 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
uint16_t Uint16
Definition: SDL_stdinc.h:169

◆ BlitBto3()

static void BlitBto3 ( SDL_BlitInfo info)
static

Definition at line 121 of file SDL_blit_0.c.

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, map, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

122 {
123  int c, o;
124  int width, height;
125  Uint8 *src, *map, *dst;
126  int srcskip, dstskip;
127 
128  /* Set up some basic variables */
129  width = info->dst_w;
130  height = info->dst_h;
131  src = info->src;
132  srcskip = info->src_skip;
133  dst = info->dst;
134  dstskip = info->dst_skip;
135  map = info->table;
136  srcskip += width - (width + 7) / 8;
137 
138  while (height--) {
139  Uint8 byte = 0, bit;
140  for (c = 0; c < width; ++c) {
141  if ((c & 7) == 0) {
142  byte = *src++;
143  }
144  bit = (byte & 0x80) >> 7;
145  if (1) {
146  o = bit * 4;
147  dst[0] = map[o++];
148  dst[1] = map[o++];
149  dst[2] = map[o++];
150  }
151  byte <<= 1;
152  dst += 3;
153  }
154  src += srcskip;
155  dst += dstskip;
156  }
157 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:290

◆ BlitBto3Key()

static void BlitBto3Key ( SDL_BlitInfo info)
static

Definition at line 285 of file SDL_blit_0.c.

References SDL_BlitInfo::colorkey, SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, SDL_memcpy, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

286 {
287  int width = info->dst_w;
288  int height = info->dst_h;
289  Uint8 *src = info->src;
290  Uint8 *dst = info->dst;
291  int srcskip = info->src_skip;
292  int dstskip = info->dst_skip;
293  Uint32 ckey = info->colorkey;
294  Uint8 *palmap = info->table;
295  int c;
296 
297  /* Set up some basic variables */
298  srcskip += width - (width + 7) / 8;
299 
300  while (height--) {
301  Uint8 byte = 0, bit;
302  for (c = 0; c < width; ++c) {
303  if ((c & 7) == 0) {
304  byte = *src++;
305  }
306  bit = (byte & 0x80) >> 7;
307  if (bit != ckey) {
308  SDL_memcpy(dst, &palmap[bit * 4], 3);
309  }
310  byte <<= 1;
311  dst += 3;
312  }
313  src += srcskip;
314  dst += dstskip;
315  }
316 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
#define SDL_memcpy
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

◆ BlitBto4()

static void BlitBto4 ( SDL_BlitInfo info)
static

Definition at line 160 of file SDL_blit_0.c.

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, map, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

161 {
162  int width, height;
163  Uint8 *src;
164  Uint32 *map, *dst;
165  int srcskip, dstskip;
166  int c;
167 
168  /* Set up some basic variables */
169  width = info->dst_w;
170  height = info->dst_h;
171  src = info->src;
172  srcskip = info->src_skip;
173  dst = (Uint32 *) info->dst;
174  dstskip = info->dst_skip / 4;
175  map = (Uint32 *) info->table;
176  srcskip += width - (width + 7) / 8;
177 
178  while (height--) {
179  Uint8 byte = 0, bit;
180  for (c = 0; c < width; ++c) {
181  if ((c & 7) == 0) {
182  byte = *src++;
183  }
184  bit = (byte & 0x80) >> 7;
185  if (1) {
186  *dst = map[bit];
187  }
188  byte <<= 1;
189  dst++;
190  }
191  src += srcskip;
192  dst += dstskip;
193  }
194 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:290

◆ BlitBto4Key()

static void BlitBto4Key ( SDL_BlitInfo info)
static

Definition at line 319 of file SDL_blit_0.c.

References SDL_BlitInfo::colorkey, SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

320 {
321  int width = info->dst_w;
322  int height = info->dst_h;
323  Uint8 *src = info->src;
324  Uint32 *dstp = (Uint32 *) info->dst;
325  int srcskip = info->src_skip;
326  int dstskip = info->dst_skip;
327  Uint32 ckey = info->colorkey;
328  Uint8 *palmap = info->table;
329  int c;
330 
331  /* Set up some basic variables */
332  srcskip += width - (width + 7) / 8;
333  dstskip /= 4;
334 
335  while (height--) {
336  Uint8 byte = 0, bit;
337  for (c = 0; c < width; ++c) {
338  if ((c & 7) == 0) {
339  byte = *src++;
340  }
341  bit = (byte & 0x80) >> 7;
342  if (bit != ckey) {
343  *dstp = ((Uint32 *) palmap)[bit];
344  }
345  byte <<= 1;
346  dstp++;
347  }
348  src += srcskip;
349  dstp += dstskip;
350  }
351 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

◆ BlitBtoNAlpha()

static void BlitBtoNAlpha ( SDL_BlitInfo info)
static

Definition at line 354 of file SDL_blit_0.c.

References SDL_BlitInfo::a, ALPHA_BLEND_RGBA, ASSEMBLE_RGBA, SDL_Color::b, SDL_PixelFormat::BytesPerPixel, SDL_Palette::colors, DISEMBLE_RGBA, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, SDL_Color::g, SDL_PixelFormat::palette, SDL_Color::r, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlit0().

355 {
356  int width = info->dst_w;
357  int height = info->dst_h;
358  Uint8 *src = info->src;
359  Uint8 *dst = info->dst;
360  int srcskip = info->src_skip;
361  int dstskip = info->dst_skip;
362  const SDL_Color *srcpal = info->src_fmt->palette->colors;
363  SDL_PixelFormat *dstfmt = info->dst_fmt;
364  int dstbpp;
365  int c;
366  Uint32 pixel;
367  unsigned sR, sG, sB;
368  unsigned dR, dG, dB, dA;
369  const unsigned A = info->a;
370 
371  /* Set up some basic variables */
372  dstbpp = dstfmt->BytesPerPixel;
373  srcskip += width - (width + 7) / 8;
374 
375  while (height--) {
376  Uint8 byte = 0, bit;
377  for (c = 0; c < width; ++c) {
378  if ((c & 7) == 0) {
379  byte = *src++;
380  }
381  bit = (byte & 0x80) >> 7;
382  if (1) {
383  sR = srcpal[bit].r;
384  sG = srcpal[bit].g;
385  sB = srcpal[bit].b;
386  DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
387  ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
388  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
389  }
390  byte <<= 1;
391  dst += dstbpp;
392  }
393  src += srcskip;
394  dst += dstskip;
395  }
396 }
int src_skip
Definition: SDL_blit.h:60
Uint8 g
Definition: SDL_pixels.h:298
GLenum GLenum dst
#define ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA)
Definition: SDL_blit.h:454
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
Uint8 b
Definition: SDL_pixels.h:299
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:353
Uint8 r
Definition: SDL_pixels.h:297
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
SDL_Color * colors
Definition: SDL_pixels.h:307
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_Palette * palette
Definition: SDL_pixels.h:318
Uint8 a
Definition: SDL_blit.h:70

◆ BlitBtoNAlphaKey()

static void BlitBtoNAlphaKey ( SDL_BlitInfo info)
static

Definition at line 399 of file SDL_blit_0.c.

References SDL_BlitInfo::a, ALPHA_BLEND_RGBA, ASSEMBLE_RGBA, SDL_Color::b, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::colorkey, SDL_Palette::colors, DISEMBLE_RGBA, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, SDL_Color::g, SDL_PixelFormat::palette, SDL_Color::r, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlit0().

400 {
401  int width = info->dst_w;
402  int height = info->dst_h;
403  Uint8 *src = info->src;
404  Uint8 *dst = info->dst;
405  int srcskip = info->src_skip;
406  int dstskip = info->dst_skip;
407  SDL_PixelFormat *srcfmt = info->src_fmt;
408  SDL_PixelFormat *dstfmt = info->dst_fmt;
409  const SDL_Color *srcpal = srcfmt->palette->colors;
410  int dstbpp;
411  int c;
412  Uint32 pixel;
413  unsigned sR, sG, sB;
414  unsigned dR, dG, dB, dA;
415  const unsigned A = info->a;
416  Uint32 ckey = info->colorkey;
417 
418  /* Set up some basic variables */
419  dstbpp = dstfmt->BytesPerPixel;
420  srcskip += width - (width + 7) / 8;
421 
422  while (height--) {
423  Uint8 byte = 0, bit;
424  for (c = 0; c < width; ++c) {
425  if ((c & 7) == 0) {
426  byte = *src++;
427  }
428  bit = (byte & 0x80) >> 7;
429  if (bit != ckey) {
430  sR = srcpal[bit].r;
431  sG = srcpal[bit].g;
432  sB = srcpal[bit].b;
433  DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
434  ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
435  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
436  }
437  byte <<= 1;
438  dst += dstbpp;
439  }
440  src += srcskip;
441  dst += dstskip;
442  }
443 }
int src_skip
Definition: SDL_blit.h:60
Uint8 g
Definition: SDL_pixels.h:298
GLenum GLenum dst
#define ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA)
Definition: SDL_blit.h:454
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
Uint8 b
Definition: SDL_pixels.h:299
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:353
Uint8 r
Definition: SDL_pixels.h:297
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
SDL_Color * colors
Definition: SDL_pixels.h:307
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_Palette * palette
Definition: SDL_pixels.h:318
Uint8 a
Definition: SDL_blit.h:70

◆ SDL_CalculateBlit0()

SDL_BlitFunc SDL_CalculateBlit0 ( SDL_Surface surface)

Definition at line 454 of file SDL_blit_0.c.

References bitmap_blit, SDL_PixelFormat::BitsPerPixel, BlitBtoNAlpha(), BlitBtoNAlphaKey(), SDL_PixelFormat::BytesPerPixel, colorkey_blit, SDL_BlitMap::dst, SDL_BlitInfo::flags, SDL_Surface::format, SDL_BlitMap::info, SDL_Surface::map, NULL, SDL_COPY_BLEND, SDL_COPY_COLORKEY, SDL_COPY_MODULATE_ALPHA, and SDL_COPY_RLE_MASK.

Referenced by SDL_CalculateBlit().

455 {
456  int which;
457 
458  if (surface->format->BitsPerPixel != 1) {
459  /* We don't support sub 8-bit packed pixel modes */
460  return (SDL_BlitFunc) NULL;
461  }
462  if (surface->map->dst->format->BitsPerPixel < 8) {
463  which = 0;
464  } else {
465  which = surface->map->dst->format->BytesPerPixel;
466  }
467  switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
468  case 0:
469  return bitmap_blit[which];
470 
471  case SDL_COPY_COLORKEY:
472  return colorkey_blit[which];
473 
475  return which >= 2 ? BlitBtoNAlpha : (SDL_BlitFunc) NULL;
476 
478  return which >= 2 ? BlitBtoNAlphaKey : (SDL_BlitFunc) NULL;
479  }
480  return (SDL_BlitFunc) NULL;
481 }
#define SDL_COPY_COLORKEY
Definition: SDL_blit.h:39
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
#define SDL_COPY_RLE_MASK
Definition: SDL_blit.h:44
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
Uint8 BitsPerPixel
Definition: SDL_pixels.h:319
static void BlitBtoNAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:354
static void BlitBtoNAlphaKey(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:399
SDL_Surface * dst
Definition: SDL_blit.h:88
#define NULL
Definition: begin_code.h:164
SDL_PixelFormat * format
Definition: SDL_surface.h:72
#define SDL_COPY_MODULATE_ALPHA
Definition: SDL_blit.h:35
static const SDL_BlitFunc bitmap_blit[]
Definition: SDL_blit_0.c:445
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:73
static const SDL_BlitFunc colorkey_blit[]
Definition: SDL_blit_0.c:449
#define SDL_COPY_BLEND
Definition: SDL_blit.h:36
SDL_BlitInfo info
Definition: SDL_blit.h:92

Variable Documentation

◆ bitmap_blit

const SDL_BlitFunc bitmap_blit[]
static
Initial value:
= {
}
static void BlitBto2(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:84
static void BlitBto4(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:160
static void BlitBto1(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:29
#define NULL
Definition: begin_code.h:164
static void BlitBto3(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:121
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:73

Definition at line 445 of file SDL_blit_0.c.

Referenced by SDL_CalculateBlit0().

◆ colorkey_blit

const SDL_BlitFunc colorkey_blit[]
static
Initial value:
= {
}
static void BlitBto2Key(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:250
static void BlitBto1Key(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:197
static void BlitBto3Key(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:285
static void BlitBto4Key(SDL_BlitInfo *info)
Definition: SDL_blit_0.c:319
#define NULL
Definition: begin_code.h:164
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:73

Definition at line 449 of file SDL_blit_0.c.

Referenced by SDL_CalculateBlit0().