Go to the source code of this file.
◆ DEFINE_COPY_ROW
Value:
{ \
int pos, inc; \
type pixel = 0; \
\
pos = 0x10000; \
inc = (src_w << 16) / dst_w; \
for (
i=dst_w;
i>0; --
i ) { \
while ( pos >= 0x10000L ) { \
pos -= 0x10000L; \
} \
pos += inc; \
} \
}
Definition at line 151 of file SDL_stretch.c.
◆ copy_row3()
static void copy_row3 |
( |
Uint8 * |
src, |
|
|
int |
src_w, |
|
|
Uint8 * |
dst, |
|
|
int |
dst_w |
|
) |
| |
|
static |
Definition at line 177 of file SDL_stretch.c.
181 Uint8 pixel[3] = { 0, 0, 0 };
184 inc = (src_w << 16) / dst_w;
185 for (
i = dst_w;
i > 0; --
i) {
186 while (pos >= 0x10000L) {
References i.
Referenced by SDL_SoftStretch().
◆ SDL_SoftStretch()
Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
- Note
- This function uses a static buffer, and is not thread-safe.
Definition at line 203 of file SDL_stretch.c.
210 int src_row, dst_row;
215 #ifdef USE_ASM_STRETCH
221 const int bpp =
dst->format->BytesPerPixel;
223 if (
src->format->format !=
dst->format->format) {
224 return SDL_SetError(
"Only works with same format surfaces");
229 if ((srcrect->
x < 0) || (srcrect->
y < 0) ||
230 ((srcrect->
x + srcrect->
w) >
src->w) ||
231 ((srcrect->
y + srcrect->
h) >
src->h)) {
242 if ((dstrect->
x < 0) || (dstrect->
y < 0) ||
243 ((dstrect->
x + dstrect->
w) >
dst->w) ||
244 ((dstrect->
y + dstrect->
h) >
dst->h)) {
245 return SDL_SetError(
"Invalid destination blit rectangle");
259 return SDL_SetError(
"Unable to lock destination surface");
277 inc = (srcrect->
h << 16) / dstrect->
h;
278 src_row = srcrect->
y;
279 dst_row = dstrect->
y;
281 #ifdef USE_ASM_STRETCH
283 if ((bpp == 3) || (generate_rowbytes(srcrect->
w, dstrect->
w, bpp) < 0)) {
289 for (dst_maxrow = dst_row + dstrect->
h; dst_row < dst_maxrow; ++dst_row) {
290 dstp = (
Uint8 *)
dst->pixels + (dst_row *
dst->pitch)
291 + (dstrect->
x * bpp);
292 while (pos >= 0x10000L) {
293 srcp = (
Uint8 *)
src->pixels + (src_row *
src->pitch)
294 + (srcrect->
x * bpp);
298 #ifdef USE_ASM_STRETCH
301 __asm__ __volatile__(
"call *%4":
"=&D"(
u1),
"=&S"(
u2)
302 :
"0"(dstp),
"1"(srcp),
"r"(copy_row)
304 #elif defined(_MSC_VER) || defined(__WATCOMC__)
307 void *code = copy_row;
320 #error Need inline assembly for this compiler
326 copy_row1(srcp, srcrect->
w, dstp, dstrect->
w);
329 copy_row2((
Uint16 *) srcp, srcrect->
w,
336 copy_row4((
Uint32 *) srcp, srcrect->
w,
References copy_row3(), SDL_Rect::h, NULL, pop, SDL_FALSE, SDL_LockSurface, SDL_MUSTLOCK, SDL_SetError, SDL_TRUE, SDL_UnlockSurface, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.