optimize svg rendering by moving bbox calc only needed by gradient rendering into gradient code