Move code that sets compositing paint phases into a single function