Changeset 11 for trunk


Ignore:
Timestamp:
Aug 29, 2016, 6:09:30 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Slightly optimizied screen drawing.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Apps/UClock.pas

    r10 r11  
    4343    Angle := Frac(Now / (10 * OneSecond)) * 2 * Pi;
    4444    API.DrawLine(Point(120, 120), Point(Trunc(120 + Cos(Angle) * 60), Trunc(120 + Sin(Angle) * 60)), 0);
    45     API.Sleep(OneMillisecond * 50);
     45    API.Sleep(OneMillisecond * 10);
    4646    //API.ReadMessage(Message);
    4747  end;
  • trunk/Forms/UFormMain.lfm

    r10 r11  
    5656  end
    5757  object Timer1: TTimer
    58     Interval = 50
     58    Interval = 10
    5959    OnTimer = Timer1Timer
    6060    left = 180
  • trunk/Forms/UFormMain.pas

    r10 r11  
    178178var
    179179  X, Y: Integer;
     180  DX, DY: Integer;
    180181  Bitmap: TBitmap;
     182  P, PR: PByte;
    181183begin
    182184  try
     
    186188
    187189    if Assigned(VideoDevice.VideoMemory) then begin
    188       for Y := 0 to VideoDevice.VideoMode.Size.Y - 1 do
    189       for X := 0 to VideoDevice.VideoMode.Size.X - 1 do begin
    190         Bitmap.Canvas.Pixels[X, Y] := PInteger(VideoDevice.VideoMemory + X * VideoDevice.VideoMode.GetBytesPerPixel +
    191         Y * VideoDevice.VideoMode.GetBytesPerLine)^ and $ffffff;
     190      DX := VideoDevice.VideoMode.GetBytesPerPixel;
     191      DY := VideoDevice.VideoMode.GetBytesPerLine;
     192      P := VideoDevice.VideoMemory;
     193      for Y := 0 to VideoDevice.VideoMode.Size.Y - 1 do begin
     194        PR := P;
     195        for X := 0 to VideoDevice.VideoMode.Size.X - 1 do begin
     196          Bitmap.Canvas.Pixels[X, Y] := PInteger(PR)^ and $ffffff;
     197          Inc(PR, DX);
     198        end;
     199        Inc(P, DY);
    192200      end;
    193201    end;
  • trunk/Packages/Kernel/UGraphics.pas

    r8 r11  
    66
    77uses
    8   Classes, SysUtils, Contnrs;
     8  Classes, SysUtils, fgl;
    99
    1010type
     
    4343
    4444  TDesktop = class
    45     Objects: TObjectList; // TList<TGraphicObject>
     45    Objects: TFPGObjectList<TGraphicObject>;
    4646    procedure Paint;
    4747    constructor Create;
     
    8888constructor TDesktop.Create;
    8989begin
    90   Objects := TObjectList.Create;
     90  Objects := TFPGObjectList<TGraphicObject>.Create;
    9191end;
    9292
Note: See TracChangeset for help on using the changeset viewer.