/** * Apply the Scale2x effect on a group of rows. Used internally. */ static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) { switch (pixel) { #if defined(__GNUC__) && defined(__i386__) case 1 : scale2x_8_mmx(dst0, dst1, src0, src1, src2, pixel_per_row); break; case 2 : scale2x_16_mmx(dst0, dst1, src0, src1, src2, pixel_per_row); break; case 4 : scale2x_32_mmx(dst0, dst1, src0, src1, src2, pixel_per_row); break; #else case 1 : scale2x_8_def(dst0, dst1, src0, src1, src2, pixel_per_row); break; case 2 : scale2x_16_def(dst0, dst1, src0, src1, src2, pixel_per_row); break; case 4 : scale2x_32_def(dst0, dst1, src0, src1, src2, pixel_per_row); break; #endif } }
static bool Scale2x_16MMX( Texture *tex , sint32 sx, sint32 sy, sint32 sw, sint32 sh, uint8* pixel, sint32 dw, sint32 dh, sint32 pitch, bool clamp_src) { // Must be at least 3 high if (sh<3 && (clamp_src || tex->height<3)) return false; // Source buffer pointers uint16 *texel = reinterpret_cast<uint16*>(tex->buffer) + (sy * tex->width + sx); int tpitch = tex->width; // uint16 *tline_end = texel + sw; uint16 *tex_end = texel + (sh-1)*tex->width; bool clip_y = true; if (sh+sy < tex->height && clamp_src == false) { clip_y = false; tex_end = texel + sh*tex->width; } if (sy == 0) { scale2x_16_mmx(reinterpret_cast<uint16*>(pixel), reinterpret_cast<uint16*>(pixel+pitch), texel, texel, texel+tpitch, sw); pixel += pitch*2; texel += tpitch; } // Src Loop Y if (texel != tex_end) do { scale2x_16_mmx(reinterpret_cast<uint16*>(pixel), reinterpret_cast<uint16*>(pixel+pitch), texel-tpitch, texel, texel+tpitch, sw); pixel += pitch*2; texel += tpitch; } while (texel != tex_end); if (clip_y) { scale2x_16_mmx(reinterpret_cast<uint16*>(pixel), reinterpret_cast<uint16*>(pixel+pitch), texel-tpitch, texel, texel, sw); } scale2x_mmx_emms(); return true; }
/** * Apply the Scale2x effect on a group of rows. Used internally. */ static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) { switch (pixel) { #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) case 1 : scale2x_8_mmx(SSDST(8,0), SSDST(8,1), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; case 2 : scale2x_16_mmx(SSDST(16,0), SSDST(16,1), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; case 4 : scale2x_32_mmx(SSDST(32,0), SSDST(32,1), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; #else case 1 : scale2x_8_def(SSDST(8,0), SSDST(8,1), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; case 2 : scale2x_16_def(SSDST(16,0), SSDST(16,1), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; case 4 : scale2x_32_def(SSDST(32,0), SSDST(32,1), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; #endif } }