Changeset 23814


Ignore:
Timestamp:
09/21/13 14:57:18 (10 years ago)
Author:
nit
Message:

optimize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/skin.h

    r23812 r23814  
    26832683void drawgradient(int posx, int posy, int width, int height, long col1, long col2, int transparent, int flag)
    26842684{
    2685         int p, i, x, y, steps, xstep, ystep, tmp = 0;
     2685        int p, i, x, y, steps, xstep, ystep, tmp = 0, r = 0;
    26862686        int xcount = 0, ycount = 0, owidth = width, oheight = height;
    26872687        unsigned char r3, g3, b3;
     
    26922692        if(flag == LEFTRIGHT || flag == LEFTMIDDLE)
    26932693        {
    2694                 if(flag == LEFTMIDDLE) width = (width >> 1);
     2694                if(flag == LEFTMIDDLE) width = width / 2;
    26952695                if(width < 10)
    26962696                        steps = width;
    26972697                if(width < 100)
    2698                         steps = (width >> 1);
     2698                        steps = width / 2;
    26992699                else
    27002700                        steps = width / 5;
     
    27042704        else
    27052705        {
    2706                 if(flag == TOPMIDDLE) height = (height >> 1);
     2706                if(flag == TOPMIDDLE) height = height / 2;
    27072707                if(height < 10)
    27082708                        steps = height;
    27092709                else if(height < 100)
    2710                         steps = (height >> 1);
     2710                        steps = height / 2;
    27112711                else
    27122712                        steps = height / 5;
     
    27352735                col = (transparent << 24) | (r3 << 16) | (g3 << 8) | b3;
    27362736               
     2737                r = 0;
    27372738                for(y = posy; y < yend; y += skinfb->width)
    2738                         for(x = posx; x < xend; x++)
    2739                                 drawpixelfast(x, y, col);
     2739                {
     2740                        if(r == 0)
     2741                        {
     2742                                r = 1;
     2743                                for(x = posx; x < xend; x++)
     2744                                        drawpixelfast(x, y, col);
     2745                        }
     2746                        else
     2747                                memcpy(skinfb->fb + (y + posx) * skinfb->colbytes, skinfb->fb + (posy + posx) * skinfb->colbytes, (xend - posx) * skinfb->colbytes);
     2748                }
    27402749
    27412750                if(flag == LEFTRIGHT || flag == LEFTMIDDLE)
     
    27642773                        col = (transparent << 24) | (r3 << 16) | (g3 << 8) | b3;
    27652774               
     2775                        r = 0;
    27662776                        for(y = posy; y < yend; y += skinfb->width)
    2767                                 for(x = posx; x < xend; x++)
    2768                                         drawpixelfast(x, y, col);
     2777                        {
     2778                                if(r == 0)
     2779                                {
     2780                                        r = 1;
     2781                                        for(x = posx; x < xend; x++)
     2782                                                drawpixelfast(x, y, col);
     2783                                }
     2784                                else
     2785                                        memcpy(skinfb->fb + (y + posx) * skinfb->colbytes, skinfb->fb + (posy + posx) * skinfb->colbytes, (xend - posx) * skinfb->colbytes);
     2786                        }
    27692787                       
    27702788                        if(flag == LEFTMIDDLE)
Note: See TracChangeset for help on using the changeset viewer.