* 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 requires also a small buffer bitmap used internally
| 319 | * \param height Vertical size in pixels of the source bitmap. |
| 320 | */ |
| 321 | static void scale4x_buf(void* void_dst, unsigned dst_slice, void* void_mid, unsigned mid_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) |
| 322 | { |
| 323 | unsigned char* dst = (unsigned char*)void_dst; |
| 324 | const unsigned char* src = (const unsigned char*)void_src; |
| 325 | unsigned count; |
| 326 | unsigned char* mid[6]; |
| 327 | |
| 328 | assert(height >= 4); |
| 329 | |
| 330 | count = height; |
| 331 | |
| 332 | /* set the 6 buffer pointers */ |
| 333 | mid[0] = (unsigned char*)void_mid; |
| 334 | mid[1] = mid[0] + mid_slice; |
| 335 | mid[2] = mid[1] + mid_slice; |
| 336 | mid[3] = mid[2] + mid_slice; |
| 337 | mid[4] = mid[3] + mid_slice; |
| 338 | mid[5] = mid[4] + mid_slice; |
| 339 | |
| 340 | stage_scale2x(SCMID(-2+6), SCMID(-1+6), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width); |
| 341 | stage_scale2x(SCMID(0), SCMID(1), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width); |
| 342 | stage_scale2x(SCMID(2), SCMID(3), SCSRC(1), SCSRC(2), SCSRC(3), pixel, width); |
| 343 | stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(-2+6), SCMID(-2+6), SCMID(-1+6), SCMID(0), pixel, width); |
| 344 | |
| 345 | dst = SCDST(4); |
| 346 | |
| 347 | stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(-1+6), SCMID(0), SCMID(1), SCMID(2), pixel, width); |
| 348 | |
| 349 | dst = SCDST(4); |
| 350 | |
| 351 | count -= 4; |
| 352 | while (count) { |
| 353 | unsigned char* tmp; |
| 354 | |
| 355 | stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(4), pixel, width); |
| 356 | stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width); |
| 357 | |
| 358 | dst = SCDST(4); |
| 359 | src = SCSRC(1); |
| 360 | |
| 361 | tmp = SCMID(0); /* shift by 2 position */ |
| 362 | SCMID(0) = SCMID(2); |
| 363 | SCMID(2) = SCMID(4); |
| 364 | SCMID(4) = tmp; |
| 365 | tmp = SCMID(1); |
| 366 | SCMID(1) = SCMID(3); |
| 367 | SCMID(3) = SCMID(5); |
| 368 | SCMID(5) = tmp; |
| 369 | |
| 370 | --count; |
| 371 | } |
| 372 | |
| 373 | stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(3), pixel, width); |
| 374 | stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width); |
| 375 | |
| 376 | dst = SCDST(4); |
| 377 | |
| 378 | stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(3), SCMID(4), SCMID(5), SCMID(5), pixel, width); |
no test coverage detected