/* * scale.c : Bitmap scaling module */ #include void StretchCopy16( br_uint_16 *out_pixels, br_uint_32 out_width, br_uint_32 out_height, br_uint_32 out_row_bytes, br_uint_16 *in_pixels, br_uint_32 in_width, br_uint_32 in_height, br_uint_32 in_row_bytes, br_uint_32 key) { br_uint_32 xfracinc, yfracinc, yfrac, skip; br_uint_32 i, j, h, w, xfrac; br_uint_16 *ipx, *ipy, *opx, *opx2, *opy, v; opy = out_pixels; ipy = in_pixels; xfracinc = (in_width << 16) / out_width; yfracinc = (in_height << 16) / out_height; in_row_bytes /= 2; out_row_bytes /= 2; w = out_width; h = out_height; if ((xfracinc == 32768) && (yfracinc == 32768)) { /* Special case for 2x2 magnification */ w /= 2; h /= 2; for(i=0; i>16; xfrac = xfrac & 0xffff; } yfrac += yfracinc; skip = yfrac>>16; yfrac = yfrac & 0xffff; ipy += skip*in_row_bytes; opy += out_row_bytes; } } }