Changeset 23805


Ignore:
Timestamp:
09/20/13 18:29:19 (10 years ago)
Author:
nit
Message:

[titan] optimize

Location:
titan/titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/skin.h

    r23286 r23805  
    19241924        int pictype = 0; //0 = png, 1 = jpg HW, 2 = jpg SW
    19251925        unsigned long tmpcol = 0;
    1926         unsigned char r = 0, g = 0, b = 0;
     1926        unsigned char r = 0, g = 0, b = 0, ralpha = 0;
    19271927
    19281928        length = strlen(filename);
     
    20532053                                                {
    20542054                                                        tmpcol = skinfb->fblong[x];
    2055                                                         alpha_composite(r, src[0], src[3], (tmpcol & 0xff0000) >> 16);
    2056                                                         alpha_composite(g, src[1], src[3], (tmpcol & 0x00ff00) >> 8);
    2057                                                         alpha_composite(b, src[2], src[3], tmpcol & 0xff);
     2055                                                        ralpha = 255 - src[3];
     2056                                                        alpha_composite(r, src[0], src[3], ralpha, (tmpcol & 0xff0000) >> 16);
     2057                                                        alpha_composite(g, src[1], src[3], ralpha, (tmpcol & 0x00ff00) >> 8);
     2058                                                        alpha_composite(b, src[2], src[3], ralpha, tmpcol & 0xff);
    20582059                                                        skinfb->fblong[x] = (255 << 24) | r << 16 | g << 8 | b;
    20592060                                                }
     
    22252226        FTC_SBit sbit;
    22262227        unsigned long tmpcol = 0, tmpcol1 = 0;
    2227         long buffercol = 0;
    22282228        unsigned char red, green, blue, r, g, b;
    22292229        unsigned char* src = NULL;
     2230        unsigned char ralpha = 0;
    22302231
    22312232        if(currentchar == 32) space = 1;
     
    22852286                for(x = y; x < pxw; x++)
    22862287                {
    2287                         buffercol = src[0];
    2288                         src++;
    2289                         if(buffercol > min)
     2288                        if(src[0] > min)
    22902289                        {
    22912290                                //renderquality 255-0 = best
    2292                                 if(buffercol > max)
     2291                                if(src[0] > max)
    22932292                                        skinfb->fblong[x] = tmpcol;
    22942293                                else
    22952294                                {
    22962295                                        tmpcol1 = skinfb->fblong[x];
    2297                                         alpha_composite(r, red, buffercol, (tmpcol1 & 0xff0000) >> 16);
    2298                                         alpha_composite(g, green, buffercol, (tmpcol1 & 0x00ff00) >> 8);
    2299                                         alpha_composite(b, blue, buffercol, tmpcol1 & 0xff);
     2296                                        ralpha = 255 - src[0];
     2297                                        alpha_composite(r, red, src[0], ralpha, (tmpcol1 & 0xff0000) >> 16);
     2298                                        alpha_composite(g, green, src[0], ralpha, (tmpcol1 & 0x00ff00) >> 8);
     2299                                        alpha_composite(b, blue, src[0], ralpha, tmpcol1 & 0xff);
    23002300                                        skinfb->fblong[x] = transparent << 24 | r << 16 | g << 8 | b;
    23012301                                }
    23022302                        }
     2303                        src++;
    23032304                }
    23042305        }
  • titan/titan/struct.h

    r23781 r23805  
    175175#define bcdtoint(i) ((((i & 0xf0) >> 4) * 10) + (i & 0x0f))
    176176
    177 #define alpha_composite(composite, fg, alpha, bg) { \
     177#define alpha_composite(composite, fg, alpha, ralpha, bg) { \
    178178unsigned short temp = ((unsigned short)(fg)*(unsigned short)(alpha) +   \
    179 (unsigned short)(bg)*(unsigned short)(255 - (unsigned short)(alpha)) +  \
     179(unsigned short)(bg)*(unsigned short)(ralpha) +  \
    180180(unsigned short)128);  \
    181181(composite) = (unsigned char)((temp + (temp >> 8)) >> 8); }
Note: See TracChangeset for help on using the changeset viewer.