--- oup/current/Global/OniImgClass.pas 2007/03/23 01:41:15 122 +++ oup/current/Global/OniImgClass.pas 2007/03/28 00:57:53 128 @@ -588,30 +588,32 @@ function TOniImage.GetImageDataSize(fadi var size: Integer; x, y: Word; - bpp: Byte; -begin - case Self.FStoreType of - 9: - bpp := 8; - 0, 1, 2: - bpp := 16; - 8: - bpp := 32; + + function GetImgSize(w,h, storetype: Integer): Integer; + begin + case storetype of + 0, 1, 2: + Result := w*h*2; + 8: + Result := w*h*4; + 9: + Result := Max(1, w div 4) * Max(1, h div 4) * 8; else - Result := 0; - Exit; + Result := -1; + end; end; +begin x := Self.FWidth; y := Self.FHeight; - size := (x * y * bpp) div 8; + size := GetImgSize(x, y, FStoreType); if fading then begin repeat - x := x div 2; - y := y div 2; - size := size + (x * y * bpp) div 8; - until (x = 1) or (y = 1); + x := Max(x div 2, 1); + y := Max(y div 2, 1); + size := size + GetImgSize(x, y, FStoreType); + until (x = 1) and (y = 1); end; Result := size; end;