[Fixes bug #1064283 and #1181929] Fix off-by-one error for the
invalidation rectangle when zoomed in.

The original code did not take into account that one
pixel in the image can correspond to multiple pixels on the canvas when
zoomed in. This resulted in the invalidation rectangle being slightly
too small. However, the invalidation rectangle is usually too large, so
it was hard to notice this bug in most cases.