ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Global/OniImgClass.pas
(Generate patch)

Comparing oup/current/Global/OniImgClass.pas (file contents):
Revision 127 by alloc, Fri Mar 23 17:14:40 2007 UTC vs.
Revision 128 by alloc, Wed Mar 28 00:57:53 2007 UTC

# Line 588 | Line 588 | function TOniImage.GetImageDataSize(fadi
588   var
589    size: Integer;
590    x, y: Word;
591 <  bpp:  Byte;
592 <  minside: Byte;
593 < begin
594 <  minside := 1;
595 <  case Self.FStoreType of
596 <    9:
597 <    begin
598 <      bpp := 4;
599 <      minside := 4;
600 <    end;
601 <    0, 1, 2:
602 <      bpp := 16;
603 <    8:
604 <      bpp := 32;
591 >
592 >  function GetImgSize(w,h, storetype: Integer): Integer;
593 >  begin
594 >    case storetype of
595 >      0, 1, 2:
596 >        Result := w*h*2;
597 >      8:
598 >        Result := w*h*4;
599 >      9:
600 >        Result :=  Max(1, w div 4) * Max(1, h div 4) * 8;
601      else
602 <      Result := 0;
603 <      Exit;
602 >      Result := -1;
603 >    end;
604    end;
605  
606 + begin
607    x    := Self.FWidth;
608    y    := Self.FHeight;
609 <  size := (x * y * bpp) div 8;
609 >  size := GetImgSize(x, y, FStoreType);
610    if fading then
611    begin
612      repeat
613 <      x    := x div 2;
614 <      y    := y div 2;
615 <      size := size + (x * y * bpp) div 8;
616 <    until (x = minside) or (y = minside);
620 <    if FStoreType = 9 then
621 <    begin
622 <      repeat
623 <        x    := x div 2;
624 <        y    := y div 2;
625 <        size := size + (x * y * 16) div 8;
626 <      until (x = 1) or (y = 1);
627 <    end;
613 >      x    := Max(x div 2, 1);
614 >      y    := Max(y div 2, 1);
615 >      size := size + GetImgSize(x, y, FStoreType);
616 >    until (x = 1) and (y = 1);
617    end;
618    Result := size;
619   end;

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)