Changeset 6248


Ignore:
Timestamp:
Jun 24, 2008, 4:16:46 AM (13 years ago)
Author:
livings124
Message:

avoid some unnecessary calculations when drawing the progress bar gradients by flipping it

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/CTGradient/CTGradientAdditions.m

    r6246 r6248  
    2929+ (CTGradient *) progressGradientForColor: (NSColor *) color
    3030{
    31     float redComponent = [color redComponent],
    32         greenComponent = [color greenComponent],
    33         blueComponent = [color blueComponent];
     31    float redComponent = [color redComponent], greenComponent = [color greenComponent], blueComponent = [color blueComponent];
    3432   
    3533    CTGradientElement color1;
    36     color1.red = redComponent;
    37     color1.green = greenComponent;
    38     color1.blue = blueComponent;
     34    color1.red = redComponent * 0.9684;
     35    color1.green = greenComponent * 0.9684;
     36    color1.blue = blueComponent * 0.9684;
    3937    color1.alpha = 1.0;
    4038    color1.position = 0.0;
    4139   
    4240    CTGradientElement color2;
    43     color2.red = redComponent * 0.8736;
    44     color2.green = greenComponent * 0.8736;
    45     color2.blue = blueComponent * 0.8736;
     41    color2.red = redComponent;
     42    color2.green = greenComponent;
     43    color2.blue = blueComponent;
    4644    color2.alpha = 1.0;
    4745    color2.position = 0.5;
    4846   
    4947    CTGradientElement color3;
    50     color3.red = redComponent;
    51     color3.green = greenComponent;
    52     color3.blue = blueComponent;
     48    color3.red = redComponent * 0.8736;
     49    color3.green = greenComponent * 0.8736;
     50    color3.blue = blueComponent * 0.8736;
    5351    color3.alpha = 1.0;
    5452    color3.position = 0.5;
    5553   
    5654    CTGradientElement color4;
    57     color4.red = redComponent * 0.9684;
    58     color4.green = greenComponent * 0.9684;
    59     color4.blue = blueComponent * 0.9684;
     55    color4.red = redComponent;
     56    color4.green = greenComponent;
     57    color4.blue = blueComponent;
    6058    color4.alpha = 1.0;
    6159    color4.position = 1.0;
  • trunk/macosx/TorrentCell.m

    r6141 r6248  
    623623            if (!fLightGrayGradient)
    624624                fLightGrayGradient = [[CTGradient progressLightGrayGradient] retain];
    625             [fLightGrayGradient fillRect: noIncludeRect angle: -90];
     625            [fLightGrayGradient fillRect: noIncludeRect angle: 90];
    626626        }
    627627       
     
    642642                    if (!fRedGradient)
    643643                        fRedGradient = [[CTGradient progressRedGradient] retain];
    644                     [fRedGradient fillRect: notAvailableRect angle: -90];
     644                    [fRedGradient fillRect: notAvailableRect angle: 90];
    645645                }
    646646            }
     
    654654                if (!fWhiteGradient)
    655655                    fWhiteGradient = [[CTGradient progressWhiteGradient] retain];
    656                 [fWhiteGradient fillRect: includeRect angle: -90];
     656                [fWhiteGradient fillRect: includeRect angle: 90];
    657657            }
    658658        }
     
    670670                if (!fYellowGradient)
    671671                    fYellowGradient = [[CTGradient progressYellowGradient] retain];
    672                 [fYellowGradient fillRect: completeRect angle: -90];
     672                [fYellowGradient fillRect: completeRect angle: 90];
    673673            }
    674674            else if ([torrent isSeeding])
     
    685685                    if (!fLightGreenGradient)
    686686                        fLightGreenGradient = [[CTGradient progressLightGreenGradient] retain];
    687                     [fLightGreenGradient fillRect: ratioLeftRect angle: -90];
     687                    [fLightGreenGradient fillRect: ratioLeftRect angle: 90];
    688688                }
    689689               
     
    694694                    if (!fGreenGradient)
    695695                        fGreenGradient = [[CTGradient progressGreenGradient] retain];
    696                     [fGreenGradient fillRect: completeRect angle: -90];
     696                    [fGreenGradient fillRect: completeRect angle: 90];
    697697                }
    698698            }
     
    701701                if (!fBlueGradient)
    702702                    fBlueGradient = [[CTGradient progressBlueGradient] retain];
    703                 [fBlueGradient fillRect: completeRect angle: -90];
     703                [fBlueGradient fillRect: completeRect angle: 90];
    704704            }
    705705        }
     
    712712                    if (!fDarkGreenGradient)
    713713                        fDarkGreenGradient = [[CTGradient progressDarkGreenGradient] retain];
    714                     [fDarkGreenGradient fillRect: completeRect angle: -90];
     714                    [fDarkGreenGradient fillRect: completeRect angle: 90];
    715715                }
    716716                else
     
    718718                    if (!fDarkBlueGradient)
    719719                        fDarkBlueGradient = [[CTGradient progressDarkBlueGradient] retain];
    720                     [fDarkBlueGradient fillRect: completeRect angle: -90];
     720                    [fDarkBlueGradient fillRect: completeRect angle: 90];
    721721                }
    722722            }
     
    725725                if (!fGrayGradient)
    726726                    fGrayGradient = [[CTGradient progressGrayGradient] retain];
    727                 [fGrayGradient fillRect: completeRect angle: -90];
     727                [fGrayGradient fillRect: completeRect angle: 90];
    728728            }
    729729        }
Note: See TracChangeset for help on using the changeset viewer.