Fix flip/rotation for cells when yUp = false

Also applied formatter, and moved the cell creation into its own method to
avoid duplication of the flip/rotate logic for each encoding.