Fix bug in resize calculation.

Change-Id: I82b6013f3acae426dd50538ee3cb7b70e3301a03