Changeset 23808
- Timestamp:
- 09/20/13 22:28:03 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/skin.h
r23807 r23808 2675 2675 void drawgradient(int posx, int posy, int width, int height, long col1, long col2, int transparent, int flag) 2676 2676 { 2677 int p = 0, i = 0, x = 0, y = 0, steps = 0, xstep = 0, ystep = 0;2677 int p, i, x, y, steps, xstep, ystep, tmp = 0; 2678 2678 int xcount = 0, ycount = 0, owidth = width, oheight = height; 2679 2679 unsigned char r3, g3, b3; … … 2685 2685 { 2686 2686 if(flag == LEFTMIDDLE) width = width / 2; 2687 if(width < 10) 2688 steps = width; 2687 2689 if(width < 100) 2688 steps = width ;2690 steps = width / 2; 2689 2691 else 2690 2692 steps = width / 5; … … 2695 2697 { 2696 2698 if(flag == TOPMIDDLE) height = height / 2; 2697 if(height < 10 0)2699 if(height < 10) 2698 2700 steps = height; 2701 else if(height < 100) 2702 steps = height / 2; 2699 2703 else 2700 2704 steps = height / 5; … … 2710 2714 unsigned char g2 = (col2 >> 8) & 0xff; 2711 2715 unsigned char b2 = col2 & 0xff; 2716 2717 int yend = (posy + ystep) * skinfb->width; 2718 int xend = posx + xstep; 2719 posy *= skinfb->width; 2712 2720 2713 2721 for(i = 0; i < steps; i++) … … 2718 2726 b3 = (b1 * p + b2 * i) / steps; 2719 2727 col = (transparent << 24) | (r3 << 16) | (g3 << 8) | b3; 2720 2721 for(y = 0; y < ystep; y++)2722 for(x = 0; x < xstep; x++)2723 drawpixel (posx + x, posy +y, col);2728 2729 for(y = posy; y < yend; y += skinfb->width) 2730 for(x = posx; x < xend; x++) 2731 drawpixelfast(x, y, col); 2724 2732 2725 2733 if(flag == LEFTRIGHT || flag == LEFTMIDDLE) … … 2727 2735 posx += xstep; 2728 2736 xcount += xstep; 2737 xend = posx + xstep; 2729 2738 } 2730 2739 else 2731 2740 { 2732 posy += ystep; 2741 tmp = ystep * skinfb->width; 2742 posy += tmp; 2733 2743 ycount += ystep; 2744 yend = posy + tmp; 2734 2745 } 2735 2746 } … … 2745 2756 col = (transparent << 24) | (r3 << 16) | (g3 << 8) | b3; 2746 2757 2747 for(y = 0; y < ystep; y++)2748 for(x = 0; x < xstep; x++)2749 drawpixel (posx + x, posy +y, col);2758 for(y = posy; y < yend; y += skinfb->width) 2759 for(x = posx; x < xend; x++) 2760 drawpixelfast(x, y, col); 2750 2761 2751 2762 if(flag == LEFTMIDDLE) … … 2753 2764 posx += xstep; 2754 2765 xcount += xstep; 2766 xend = posx + xstep; 2755 2767 } 2756 2768 else 2757 2769 { 2758 posy += ystep; 2770 tmp = ystep * skinfb->width; 2771 posy += tmp; 2759 2772 ycount += ystep; 2773 yend = posy + tmp; 2760 2774 } 2761 2775 } … … 2766 2780 if(owidth > xcount) 2767 2781 { 2768 int tmp = owidth - xcount;2769 for(y = 0; y < ystep; y++)2770 for(x = 0; x < tmp; x++)2771 drawpixel (posx + x, posy +y, col);2782 int tmp = posx + (owidth - xcount); 2783 for(y = posy; y < yend; y += skinfb->width) 2784 for(x = posx; x < tmp; x++) 2785 drawpixelfast(x, y, col); 2772 2786 } 2773 2787 } … … 2776 2790 if(oheight > ycount) 2777 2791 { 2778 int tmp = oheight - ycount;2779 for(y = 0; y < tmp; y++)2780 for(x = 0; x < xstep; x++)2781 drawpixel (posx + x, posy +y, col);2792 int tmp = posy + ((oheight - ycount) * skinfb->width); 2793 for(y = posy; y < tmp; y += skinfb->width) 2794 for(x = posx; x < xend; x++) 2795 drawpixelfast(x, y, col); 2782 2796 } 2783 2797 }
Note: See TracChangeset
for help on using the changeset viewer.