Changeset 15 for trunk/Forms


Ignore:
Timestamp:
Dec 27, 2017, 8:28:45 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: Drawing of TWindow background.
  • Fixed: Initialize TGraphicObject canvas only once.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r14 r15  
    3939    procedure Timer1Timer(Sender: TObject);
    4040  private
     41    TempBitmap: TBitmap;
    4142    RedrawPending: Boolean;
    4243    VideoDevice: TDeviceVideoBase;
     
    7374  NewApp2: TApp;
    7475begin
     76  TempBitmap := TBitmap.Create;
    7577  PaintBox1.ControlStyle := PaintBox1.ControlStyle + [csOpaque];
    7678
     
    164166begin
    165167  FreeAndNil(Kernel);
     168  FreeAndNil(TempBitmap);
    166169end;
    167170
     
    186189  X, Y: Integer;
    187190  DX, DY: Integer;
    188   Bitmap: TBitmap;
    189191  P, PR: PByte;
    190192begin
    191193  try
    192     Bitmap := TBitmap.Create;
    193     Bitmap.BeginUpdate;
    194     Bitmap.SetSize(PaintBox1.Width, PaintBox1.Height);
     194    TempBitmap.BeginUpdate;
     195    TempBitmap.SetSize(PaintBox1.Width, PaintBox1.Height);
    195196
    196197    if Assigned(VideoDevice.VideoMemory) then begin
     
    201202        PR := P;
    202203        for X := 0 to VideoDevice.VideoMode.Size.X - 1 do begin
    203           Bitmap.Canvas.Pixels[X, Y] := PInteger(PR)^ and $ffffff;
     204          TempBitmap.Canvas.Pixels[X, Y] := PInteger(PR)^ and $ffffff;
    204205          Inc(PR, DX);
    205206        end;
     
    208209    end;
    209210  finally
    210     PaintBox1.Canvas.Draw(0, 0, Bitmap);
    211     Bitmap.EndUpdate;
    212     Bitmap.Free;
     211    PaintBox1.Canvas.Draw(0, 0, TempBitmap);
     212    TempBitmap.EndUpdate;
    213213  end;
    214214end;
Note: See TracChangeset for help on using the changeset viewer.