minX1 should be max(-maxD,0) not max(maxD,0), avoid black band at left
Merge pull request #1787 from hs3180:2.4