Revert "replace viewport check by clamping"

This reverts commit 00d9ef799639fcd906a845cfaf55b2efb3e5bc8a.
What was intended as a fix introduced new bugs.
fix bug in viewport dimension check

actually, two bugs:
- upper limit was checked with bad math.
- the rectangle wasn't properly stored to self.viewport
fix calculation when calculation is not actually needed
Merge pull request #280 from hwhw/master

Viewport related fixes (affecting Kobos)