Changeset 52 for trunk/Start.pas


Ignore:
Timestamp:
Jan 11, 2017, 10:14:11 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: More Bitmap.ScanLine replaced by direct access to RAWImage data.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Start.pas

    r46 r52  
    10341034
    10351035  procedure PaintFileMini;
    1036   type
    1037     TLine = array [0 .. 99999999, 0 .. 2] of Byte;
    10381036  var
    10391037    i, x, y, xm, cm, Tile, OwnColor, EnemyColor: integer;
    1040     MiniLine, PrevMiniLine: ^TLine;
     1038    MiniPixel, PrevMiniPixel: PPixel32;
    10411039  begin
    10421040    OwnColor := GrExt[HGrSystem].Data.Canvas.Pixels[95, 67];
     
    10471045    if MiniMode = mmPicture then
    10481046    begin
    1049       MiniLine := nil;
    10501047      Mini.BeginUpdate;
    1051       for y := 0 to MiniHeight - 1 do
    1052       begin
    1053         PrevMiniLine := MiniLine;
    1054         MiniLine := Mini.ScanLine[y];
    1055         for x := 0 to MiniWidth - 1 do
    1056           for i := 0 to 1 do
    1057           begin
     1048      for y := 0 to MiniHeight - 1 do begin
     1049        for x := 0 to MiniWidth - 1 do begin
     1050          for i := 0 to 1 do begin
    10581051            xm := (x * 2 + i + y and 1) mod (MiniWidth * 2);
     1052            MiniPixel := GetBitmapPixelPtr(Mini, xm, y);
    10591053            Tile := SaveMap[x + MiniWidth * y];
    10601054            if Tile and fTerrain = fUNKNOWN then
     
    10661060              else
    10671061                cm := EnemyColor;
    1068               if PrevMiniLine <> nil then
    1069               begin // 2x2 city dot covers two scanlines
    1070                 PrevMiniLine[xm, 0] := cm shr 16;
    1071                 PrevMiniLine[xm, 1] := cm shr 8 and $FF;
    1072                 PrevMiniLine[xm, 2] := cm and $FF;
     1062              if y > 0 then begin
     1063                // 2x2 city dot covers two lines
     1064                PrevMiniPixel := GetBitmapPixelPtr(Mini, xm, y - 1);
     1065                PrevMiniPixel^.B := cm shr 16;
     1066                PrevMiniPixel^.G:= cm shr 8 and $FF;
     1067                PrevMiniPixel^.R := cm and $FF;
    10731068              end
    10741069            end
     
    10801075            else
    10811076              cm := MiniColors[Tile and fTerrain, i];
    1082             MiniLine[xm, 0] := cm shr 16;
    1083             MiniLine[xm, 1] := cm shr 8 and $FF;
    1084             MiniLine[xm, 2] := cm and $FF;
     1077            MiniPixel^.B := cm shr 16;
     1078            MiniPixel^.G:= cm shr 8 and $FF;
     1079            MiniPixel^.R := cm and $FF;
    10851080          end;
     1081        end;
    10861082      end;
    10871083      Mini.EndUpdate;
Note: See TracChangeset for help on using the changeset viewer.