Optimize linear gradient