Surface and volume contributions to real and imaginary parts of the heavy-ion optical potential