* Apply the Scale4x effect on a bitmap. * The destination bitmap is filled with the scaled version of the source bitmap. * The source bitmap isn't modified. * The destination bitmap must be manually allocated before calling the function, * note that the resulting size is exactly 4x4 times the size of the source bitmap. * \note This function operates like ::scale4x_buf() but the intermediate b
| 399 | * \param height Vertical size in pixels of the source bitmap. |
| 400 | */ |
| 401 | static void scale4x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) |
| 402 | { |
| 403 | unsigned mid_slice; |
| 404 | void* mid; |
| 405 | |
| 406 | mid_slice = 2 * pixel * width; /* required space for 1 row buffer */ |
| 407 | |
| 408 | mid_slice = (mid_slice + 0x7) & ~0x7; /* align to 8 bytes */ |
| 409 | |
| 410 | #if HAVE_ALLOCA |
| 411 | mid = alloca(6 * mid_slice); /* allocate space for 6 row buffers */ |
| 412 | |
| 413 | assert(mid != 0); /* alloca should never fails */ |
| 414 | #else |
| 415 | mid = malloc(6 * mid_slice); /* allocate space for 6 row buffers */ |
| 416 | |
| 417 | if (!mid) |
| 418 | return; |
| 419 | #endif |
| 420 | |
| 421 | scale4x_buf(void_dst, dst_slice, mid, mid_slice, void_src, src_slice, pixel, width, height); |
| 422 | |
| 423 | #if !HAVE_ALLOCA |
| 424 | free(mid); |
| 425 | #endif |
| 426 | } |
| 427 | |
| 428 | /** |
| 429 | * Check if the scale implementation is applicable at the given arguments. |