- for( int y=0; y<h; ++y ) {
- uint8_t *bp = picon_rows[y], *rp = rows[y];
- for( int x=0; x<w; ++x ) {
- rp[0] = bp[0]; rp[1] = bp[1];
- rp[2] = bp[2]; bp += bpp;
- rp[3] = alpha; rp += 4;
+ if( BC_CModels::has_alpha(color_model) && // fast path
+ BC_CModels::calculate_pixelsize(color_model) == sizeof(unsigned) ) {
+ unsigned a = alpha << 24;
+ for( int y=0; y<ph; ++y ) {
+ unsigned *bp = (unsigned *)picon_rows[y];
+ unsigned *rp = (unsigned *)rows[y];
+ for( int i=pw; --i>=0; ++bp,++rp ) *rp = (*bp & 0xffffff) | a;
+ }
+ }
+ else {
+ for( int y=0; y<ph; ++y ) {
+ uint8_t *bp = picon_rows[y], *rp = rows[y];
+ for( int x=0; x<pw; ++x ) {
+ rp[0] = bp[0]; rp[1] = bp[1];
+ rp[2] = bp[2]; bp += bpp;
+ rp[3] = alpha; rp += 4;
+ }