From 23a654d57a95d822f4a0bb86cdb072f086184c85 Mon Sep 17 00:00:00 2001 From: Brian Donovan Date: Tue, 28 Sep 2010 08:22:09 -0700 Subject: [PATCH] Allow null locations per Quartz 2D documentation. See http://developer.apple.com/library/ios/#DOCUMENTATION/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_shadings/dq_shadings.html%23//apple_ref/doc/uid/TP30001066-CH207-TPXREF101 --- AppKit/CoreGraphics/CGGradient.j | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/AppKit/CoreGraphics/CGGradient.j b/AppKit/CoreGraphics/CGGradient.j index a97d23103..29b5d149f 100644 --- a/AppKit/CoreGraphics/CGGradient.j +++ b/AppKit/CoreGraphics/CGGradient.j @@ -29,17 +29,20 @@ kCGGradientDrawsAfterEndLocation = 1 << 1; function CGGradientCreateWithColorComponents(aColorSpace, components, locations, count) { + if (arguments["locations"] == NULL) + var locations = [0.0, 1.0]; + if (arguments["count"] == NULL) var count = locations.length; var colors = []; - + while (count--) { var offset = count * 4; colors[count] = CGColorCreate(aColorSpace, components.slice(offset, offset + 4)); } - + return CGGradientCreateWithColors(aColorSpace, colors, locations); }