fix linear gradients

transform of the gradients were not taken into account before.
memory leak fix