Optimized Array Processing

Instead of calculating for every point, the algorithm skips any
calculating if the left and top pixels are greater than the columns and
rows requested.