Fix centring algorithm for bitmap viewer