Use the same algorithm for conversions

Make sure that the routines that convert between buffer
and rgb representations follow the same algorithm so it's
easier to compare them.
1 file changed