Browse Source

Linear Progress Indicator: minor code optimization

Felix Paul Kühne 12 years ago
parent
commit
55a4b222e2
1 changed files with 5 additions and 3 deletions
  1. 5 3
      AspenProject/VLCLinearProgressIndicator.m

+ 5 - 3
AspenProject/VLCLinearProgressIndicator.m

@@ -19,11 +19,13 @@
 
     UIBezierPath* bezierPath = [UIBezierPath bezierPath];
 
-    [bezierPath moveToPoint:CGPointMake((self.progress * rect.size.width) - rect.size.height + 3., 2.)];
+    float progress_width = self.progress * rect.size.width;
+
+    [bezierPath moveToPoint:CGPointMake(progress_width - rect.size.height + 3., 2.)];
 
     // Create our triangle
-    [bezierPath addLineToPoint:CGPointMake((self.progress * rect.size.width) - (rect.size.height/2), rect.size.height - 5.)];
-    [bezierPath addLineToPoint:CGPointMake((self.progress * rect.size.width) - 3., 2.)];
+    [bezierPath addLineToPoint:CGPointMake(progress_width - (rect.size.height/2), rect.size.height - 5.)];
+    [bezierPath addLineToPoint:CGPointMake(progress_width - 3., 2.)];
     [bezierPath closePath];
 
     // Set the display for the path, and stroke it