vf_rotate: fix for some obscure pixel formats

Repurpose the 3 byte case for any unhandled pixel width. Fixes rotation
with e.g. rgb48. Very inefficient, but works.
This commit is contained in:
wm4 2013-05-01 21:13:13 +02:00
parent f8c13d6b66
commit 71cc8c1581
1 changed files with 6 additions and 7 deletions

View File

@ -52,15 +52,14 @@ static void rotate(unsigned char* dst,unsigned char* src,int dststride,int srcst
case 2: case 2:
for(x=0;x<w;x++) *((short*)(dst+x*2))=*((short*)(src+y*2+x*srcstride)); for(x=0;x<w;x++) *((short*)(dst+x*2))=*((short*)(src+y*2+x*srcstride));
break; break;
case 3:
for(x=0;x<w;x++){
dst[x*3+0]=src[0+y*3+x*srcstride];
dst[x*3+1]=src[1+y*3+x*srcstride];
dst[x*3+2]=src[2+y*3+x*srcstride];
}
break;
case 4: case 4:
for(x=0;x<w;x++) *((int*)(dst+x*4))=*((int*)(src+y*4+x*srcstride)); for(x=0;x<w;x++) *((int*)(dst+x*4))=*((int*)(src+y*4+x*srcstride));
default:
for(x=0;x<w;x++){
for (int b=0;b<bpp;b++)
dst[x*bpp+b]=src[b+y*bpp+x*srcstride];
}
break;
} }
dst+=dststride; dst+=dststride;
} }