Fix handling of RGBA buffers in CalRGB colorspace (issue 5270)

Fixes #5270.