Simplify Shape#hitTest() code.