avoid some unnecessary shifts

This commit is contained in:
Benjamin Gilbert 2015-01-27 03:33:59 -05:00
parent 3f6f3bd3c1
commit 6444a52582
1 changed files with 3 additions and 9 deletions

View File

@ -46,7 +46,7 @@
* 9/8/14
* - do argb -> rgba for associated as well
* 27/1/15
* - improve unpremultiplication performance for opaque pixels
* - unpremultiplication speedups for fully opaque/transparent pixels
*/
/*
@ -417,18 +417,12 @@ argb2rgba( uint32_t *buf, int n, uint32_t bg )
VipsPel *out = (VipsPel *) p;
if( a == 255 ) {
out[0] = (x >> 16) & 255;
out[1] = (x >> 8) & 255;
out[2] = x & 255;
out[3] = 255;
*p = GUINT32_TO_BE((x << 8) | 255);
}
else if( a == 0 ) {
/* Use background color.
*/
out[0] = (bg >> 16) & 255;
out[1] = (bg >> 8) & 255;
out[2] = bg & 255;
out[3] = 255;
*p = GUINT32_TO_BE((bg << 8) | 255);
}
else {
/* Undo premultiplication.