Fixed typo with indexes in getGradient(x/y) functions.
Merge pull request #2375 from akarsakov:fix_getGradient