Refactor rounded rectangle drawing.