Created
February 24, 2014 12:36
-
-
Save 0xPr0xy/9187610 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Change the following piece of code | |
// | |
CGContextSaveGState(context); | |
CGContextClip(context); | |
if (_privateGradientBool == YES) { | |
CGGradientRef gradient; // Gradient for the fill. | |
CGColorSpaceRef colorSpace; | |
size_t num_locations = 2; | |
CGFloat locations[2] = {0.0f, 1.0f}; | |
CGFloat components[8] = GRADIENT_FILL; | |
colorSpace = CGColorSpaceCreateDeviceRGB(); | |
gradient = CGGradientCreateWithColorComponents(colorSpace, components, locations, num_locations); | |
CGPoint startPoint, endPoint; | |
startPoint.x = OFFSET_X; | |
startPoint.y = GRAPH_HEIGHT - OFFSET_Y; | |
endPoint.x = OFFSET_X; | |
endPoint.y = OFFSET_Y; | |
CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0); | |
CGContextRestoreGState(context); | |
CGColorSpaceRelease(colorSpace); | |
CGGradientRelease(gradient); | |
} | |
// | |
// To this | |
// | |
if (_privateGradientBool == YES) { | |
CGContextSaveGState(context); | |
CGContextClip(context); | |
CGGradientRef gradient; // Gradient for the fill. | |
CGColorSpaceRef colorSpace; | |
size_t num_locations = 2; | |
CGFloat locations[2] = {0.0f, 1.0f}; | |
CGFloat components[8] = GRADIENT_FILL; | |
colorSpace = CGColorSpaceCreateDeviceRGB(); | |
gradient = CGGradientCreateWithColorComponents(colorSpace, components, locations, num_locations); | |
CGPoint startPoint, endPoint; | |
startPoint.x = OFFSET_X; | |
startPoint.y = GRAPH_HEIGHT - OFFSET_Y; | |
endPoint.x = OFFSET_X; | |
endPoint.y = OFFSET_Y; | |
CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0); | |
CGContextRestoreGState(context); | |
CGColorSpaceRelease(colorSpace); | |
CGGradientRelease(gradient); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment