From aa3cdb4e055977e3a1496d8677439ef236b1a098 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 17 Apr 2014 13:39:06 +0200 Subject: [PATCH] (SoftFilters) Cleanup scale2x.c --- gfx/filters/scale2x.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/gfx/filters/scale2x.c b/gfx/filters/scale2x.c index 4725ca73ba..91b8c8a31d 100644 --- a/gfx/filters/scale2x.c +++ b/gfx/filters/scale2x.c @@ -24,10 +24,10 @@ #define SCALE2X_SCALE 2 -#define SCALE2X_GENERIC(width, height, first, last, src, src_stride, dst, dst_stride) \ +#define SCALE2X_GENERIC(typename_t, width, height, first, last, src, src_stride, dst, dst_stride) \ unsigned x, y; \ - TYPENAME *out0 = (TYPENAME*)dst; \ - TYPENAME *out1 = (TYPENAME*)(dst + dst_stride); \ + typename_t *out0 = (typename_t*)dst; \ + typename_t *out1 = (typename_t*)(dst + dst_stride); \ \ for (y = 0; y < height; ++y) \ { \ @@ -36,11 +36,11 @@ \ for (x = 0; x < width; ++x) \ { \ - const TYPENAME A = *(src - prevline); \ - const TYPENAME B = (x > 0) ? *(src - 1) : *src; \ - const TYPENAME C = *src; \ - const TYPENAME D = (x < width - 1) ? *(src + 1) : *src; \ - const TYPENAME E = *(src++ + nextline); \ + const typename_t A = *(src - prevline); \ + const typename_t B = (x > 0) ? *(src - 1) : *src; \ + const typename_t C = *src; \ + const typename_t D = (x < width - 1) ? *(src + 1) : *src; \ + const typename_t E = *(src++ + nextline); \ \ if (A != E && B != D) \ { \ @@ -68,9 +68,7 @@ static void scale2x_generic_rgb565(unsigned width, unsigned height, const uint16_t *src, unsigned src_stride, uint16_t *dst, unsigned dst_stride) { -#define TYPENAME uint16_t - SCALE2X_GENERIC(width, height, first, last, src, src_stride, dst, dst_stride); -#undef TYPENAME + SCALE2X_GENERIC(uint16_t, width, height, first, last, src, src_stride, dst, dst_stride); } static void scale2x_generic_xrgb8888(unsigned width, unsigned height, @@ -78,9 +76,7 @@ static void scale2x_generic_xrgb8888(unsigned width, unsigned height, const uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride) { -#define TYPENAME uint32_t - SCALE2X_GENERIC(width, height, first, last, src, src_stride, dst, dst_stride); -#undef TYPENAME + SCALE2X_GENERIC(uint32_t, width, height, first, last, src, src_stride, dst, dst_stride); } static unsigned scale2x_generic_input_fmts(void)