Bug 313211 [CSS] Optimizing Linear Gradients
bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/GradientBackgroundListener.java
rgb.green, rgb.blue);
				colors.add(color);
			}
			fillGradient(gc, new Rectangle(0, 0, size.x, size.y), colors,
					CSSSWTColorHelper.getPercents(grad), true);
			gc.dispose();
			for (Iterator<Color> iterator = colors.iterator(); iterator
					.hasNext();) {
				Color c = iterator.next();
				c.dispose(); 
			}
		}
		/*
		 * Set the new background.
		 */
		control.setBackgroundImage(newImage);
	}
	/*
	 * Fills a gradient rectangle in the specified gc with the specified colors
	 * and percentages.
	 * 
	 * @param gc @param rect @param gradientColors @param gradientPercents
	 * 
	 * @param gradientVertical
	 */
	private static void fillGradient(GC gc, Rectangle rect,
			List<Color> gradientColors, int[] gradientPercents,
			boolean gradientVertical) {
		Color background = gradientColors.get(gradientColors.size() - 1);
		if (gradientColors.size() == 1) {