minX1 should be max(-maxD,0) not max(maxD,0), avoid black band at left