Changeset 5


Ignore:
Timestamp:
Nov 21, 2012, 12:16:25 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Optimizations in maze painter.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        22Lazes.exe
        33Lazes.lps
         4Lazes.dbg
  • trunk/Lazes.lpi

    r4 r5  
    8686      <Item1>
    8787        <PackageName Value="MazePackage"/>
     88        <DefaultFilename Value="class\MazePackage.lpk" Prefer="True"/>
    8889      </Item1>
    8990      <Item2>
  • trunk/class/mazepainter.pas

    r1 r5  
    124124    FreeAndNil(bmp);
    125125    bmp := TBitMap.Create;
    126     bmp.Width := Width+1;
    127     bmp.Height := Height+1;
     126    bmp.SetSize(Width + 1, Height + 1);
    128127    Canvas := bmp.Canvas;
    129 
     128    try
     129      Bmp.BeginUpdate(True);
    130130    for row := 0 to Maze.Height-1 do
    131131      for col := 0 to Maze.Width-1 do
     
    179179      end;
    180180
     181    finally
     182      Bmp.EndUpdate;
     183    end;
    181184    // Fully refreshed
    182185    isDirty := false;
     
    184187
    185188  // Draw bitmap
    186   FCanvas.CopyRect(Rect(pOffsetX,pOffsetY,pOffsetX+Width+1,pOffsetY+Height+1), bmp.Canvas, Rect(0,0,Width+1,Height+1));
     189  FCanvas.Draw(pOffsetX, pOffsetY, Bmp); // Stretch draw should be faster
     190  //FCanvas.CopyRect(Rect(pOffsetX,pOffsetY,pOffsetX+Width+1,pOffsetY+Height+1), bmp.Canvas, Rect(0,0,Width+1,Height+1));
    187191end;
    188192
Note: See TracChangeset for help on using the changeset viewer.