Refactor ThreePatch.