calgray: fix getRgbBuffer problem

This fixes issue 3903.
Merge pull request #4062 from kkujala/calgray

calgray: fix getRgbBuffer problem