Assorted cleanups in gfx and layout

@pcwalton r?
Oh that is nicer. Should I rebase, or will that mess things up?