Xorg: Xv, minor optimize for strech

This commit is contained in:
Jay Sorg 2014-10-04 17:17:45 -07:00
parent 39e51cad8c
commit 62481510f7

View File

@ -385,32 +385,51 @@ stretch_RGB32_RGB32(int *src, int src_width, int src_height,
{ {
int index; int index;
int jndex; int jndex;
int kndex;
int lndex; int lndex;
int oh = (src_w << 16) / dst_w; int last_lndex;
int oh;
int ih; int ih;
int ov = (src_h << 16) / dst_h; int ov;
int iv; int iv;
int pix; int pix;
int *src32;
int *dst32;
LLOGLN(10, ("stretch_RGB32_RGB32: oh 0x%8.8x ov 0x%8.8x", oh, ov)); LLOGLN(10, ("stretch_RGB32_RGB32: oh 0x%8.8x ov 0x%8.8x", oh, ov));
oh = (src_w << 16) / dst_w;
ov = (src_h << 16) / dst_h;
iv = ov; iv = ov;
lndex = src_y; lndex = src_y;
last_lndex = -1;
for (index = 0; index < dst_h; index++) for (index = 0; index < dst_h; index++)
{ {
ih = oh; if (lndex == last_lndex)
kndex = src_x;
for (jndex = 0; jndex < dst_w; jndex++)
{ {
pix = src[lndex * src_width + kndex]; /* repeat line */
dst[index * dst_w + jndex] = pix; dst32 = dst + index * dst_w;
while (ih > (1 << 16) - 1) src32 = dst32 - dst_w;
{ g_memcpy(dst32, src32, dst_w * 4);
ih -= 1 << 16;
kndex++;
}
ih += oh;
} }
else
{
ih = oh;
src32 = src + lndex * src_width + src_x;
pix = *src32;
dst32 = dst + index * dst_w;
for (jndex = 0; jndex < dst_w; jndex++)
{
*dst32 = pix;
while (ih > (1 << 16) - 1)
{
ih -= 1 << 16;
src32++;
pix = *src32;
}
ih += oh;
dst32++;
}
}
last_lndex = lndex;
while (iv > (1 << 16) - 1) while (iv > (1 << 16) - 1)
{ {
iv -= 1 << 16; iv -= 1 << 16;