Don't write outside of the picture buffer in planarCopy in the gray case