Not just income. Deductions, nondeductible items and distributions all reduce basis. Just as contributions of capital, other income and notaxable income increase basis.
And it MUST be done year by year, because at the end of any year, if losses, deductions and/or distributions decrease basis to zero, and excess losses and deductions are carried forward, and any distributions in excess of basis are long-term capital gains (after the stock is held for at least 1 year).