diff --git a/tim2view.lps b/tim2view.lps deleted file mode 100644 index 681215a..0000000 --- a/tim2view.lps +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/udrawtim.pas b/udrawtim.pas index 3c391a2..7cc86f0 100644 --- a/udrawtim.pas +++ b/udrawtim.pas @@ -76,9 +76,9 @@ var R, G, B, A: Byte; FC: TFPColor; begin - if (TIM^.HEAD^.bBPP in [cTIM16NC, cTIM24NC]) then Exit; + if (TIM^.OverBpp in [cTIM16NC, cTIM24NC]) then Exit; - if (TIM^.HEAD^.bBPP in [cTIM4NC, cTIM8NC]) then + if (TIM^.OverBpp in [cTIM4NC, cTIM8NC]) then begin Randomize; COUNT := 256; @@ -130,7 +130,7 @@ begin RW := GetTimRealWidth(TIM); WH := TIM^.IMAGE^.wWidth * TIM^.IMAGE^.wHeight; - case TIM^.HEAD^.bBPP of + case TIM^.OverBpp of cTIM4C, cTIM4NC: for I := 1 to WH * 2 do begin @@ -198,7 +198,7 @@ begin if (Image^ <> nil) then Image^.Free; Image^ := TBGRABitmap.Create(RW, RH); - Image^.UsePalette := not(TIM^.HEAD^.bBPP in [cTIM16NC, cTIM24NC]); + Image^.UsePalette := not(TIM^.OverBpp in [cTIM16NC, cTIM24NC]); PAL := @(Image^.Palette); @@ -216,7 +216,7 @@ begin for Y := 1 to RH do for X := 1 to RW do begin - case TIM^.HEAD^.bBPP of + case TIM^.OverBpp of cTIM4C, cTIM4NC, cTIM8C, cTIM8NC: Image^.Pixels[X - 1, Y - 1] := INDEXES^[IDX] mod COLORS; cTIM16C, cTIM16NC, cTIMMixC, cTIMMixNC: diff --git a/umain.pas b/umain.pas index 75b2120..7e9b7a3 100644 --- a/umain.pas +++ b/umain.pas @@ -280,7 +280,7 @@ begin 5: cbbBitMode.Tag := NativeInt(cTIM16NC); 6: cbbBitMode.Tag := NativeInt(cTIM24NC); else - cbbBitMode.Tag := NativeInt($FF); + cbbBitMode.Tag := NativeInt(-1); end; UpdateTim(True, False, False); @@ -555,7 +555,7 @@ procedure TfrmMain.FormCreate(Sender: TObject); begin Settings := TSettings.Create(ExtractFilePath(ParamStr(0))); - cbbBitMode.Tag := NativeInt($FF); + cbbBitMode.Tag := NativeInt(-1); {$IFDEF windows}actAddToSendto.Checked := Settings.SendToShortcutExists;{$ENDIF} actStretch.Checked := Settings.StretchMode; @@ -755,8 +755,10 @@ begin P := SelectedTimInfo.Position; Result := LoadTimFromFile(SelectedScanResult.ScanFile, P, SelectedScanResult.IsImage, SelectedTimInfo.Size); - if Integer(cbbBitMode.Tag) = $FF then Exit; - Result^.HEAD^.bBPP := Integer(cbbBitMode.Tag); + if Integer(cbbBitMode.Tag) = -1 then + Result^.OverBpp := Result^.HEAD^.bBPP + else + Result^.OverBpp := Integer(cbbBitMode.Tag); end; procedure TfrmMain.ScanPath(const Path: string); diff --git a/utim.pas b/utim.pas index 78f67cf..4577ea4 100644 --- a/utim.pas +++ b/utim.pas @@ -105,10 +105,7 @@ type IMAGE: PIMAGEHeader; dwSize: Integer; DATA: PTIMDataArray; - - UseExtClut: Boolean; - ExtCLUT: PCLUTHeader; - ExtCLUT_DATA: PCLUT_COLORS; + OverBpp: Integer; end; PTIM = ^TTIM; @@ -168,7 +165,7 @@ var CLUT_OFFSET: Integer; COLOR: word; begin - if (TIM^.HEAD^.bBPP in [cTIM4NC, cTIM8NC]) then + if (TIM^.OverBpp in [cTIM4NC, cTIM8NC]) then begin Result.R := random($20) shl 3; Result.G := random($20) shl 3; @@ -272,8 +269,15 @@ begin end; function IWidthToRWidth(TIM: PTIM): word; +var + bpp: Integer; begin - case TIM^.HEAD^.bBPP of + if (TIM^.HEAD^.bBPP <> TIM^.OverBpp) then + bpp := TIM^.OverBpp + else + bpp := TIM^.HEAD^.bBPP; + + case bpp of cTIM4C, cTIM4NC: Result := (TIM^.IMAGE^.wWidth * 4) and $FFFF; cTIM8C, cTIM8NC: Result := (TIM^.IMAGE^.wWidth * 2) and $FFFF; cTIM16C, cTIM16NC, cTIMMixC, cTIMMixNC: Result := TIM^.IMAGE^.wWidth; @@ -410,10 +414,7 @@ begin Move(PBytesArray(BUFFER)^[TIM_POS], TIM^.DATA^[0], TIM^.dwSize); - TIM^.UseExtClut := False; - TIM^.ExtCLUT := nil; - TIM^.ExtCLUT_DATA := nil; - + TIM^.OverBpp := TIM^.HEAD^.bBPP; Result := True; end; @@ -473,6 +474,7 @@ begin P := 0; Result := nil; + LoadTimFromBuf(TIM_BUF, Result, P); sImageStream.Free; Dispose(TIM_BUF); @@ -536,9 +538,7 @@ begin Result^.dwSize := 0; Result^.dwTimPosition := 0; Result^.dwTimNumber := 0; - Result^.UseExtClut := False; - Result^.ExtCLUT := nil; - Result^.ExtCLUT_DATA := nil; + Result^.OverBpp := -1; New(Result^.DATA); ClearTIM(Result); end;