cleanup of function for creating opaque surface from masked surface