MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / scale4x

Function scale4x

src/Engine/Scalers/scalebit.cpp:401–426  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

399 * \param height Vertical size in pixels of the source bitmap.
400 */
401static 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.

Callers 1

scaleFunction · 0.85

Calls 1

scale4x_bufFunction · 0.85

Tested by

no test coverage detected