Made shape drawing not leak state.