Modified the "invalidateLines" method to check both the first and last pixel of each scan line.
Made it more efficient, ta-boot
Assumption is still that there are no invalid data in the middle, but this should be OK.