Optimization of pupil design for point-scanning and line-scanning confocal microscopy