Changeset 17 for trunk/Packages


Ignore:
Timestamp:
Jan 21, 2018, 10:01:14 PM (7 years ago)
Author:
chronos
Message:
  • Added: Resize virtual screen according form size.
Location:
trunk/Packages/Kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Kernel/UDevice.pas

    r13 r17  
    2424    function GetBytesPerLine: Integer;
    2525    function GetBytesPerImage: Integer;
     26    procedure Assign(Source: TVideoMode);
    2627  end;
    2728
     
    2930
    3031  TDeviceVideo = class(TDevice)
     32  private
     33    FVideoMode: TVideoMode;
     34  protected
     35    procedure SetVideoMode(Mode: TVideoMode); virtual;
     36    function GetVideoMemory: PByte; virtual;
     37  public
    3138    constructor Create; override;
    32     procedure SetMode(Mode: TVideoMode); virtual;
    3339    procedure GetSupportedModes(Modes: TObjectList); virtual;
    34     function GetVideoMemory: PByte; virtual;
    3540    procedure VideoMemoryChange; virtual;
     41    property VideoMode: TVideoMode read FVideoMode write SetVideoMode;
     42    property VideoMemory: PByte read GetVideoMemory;
    3643  end;
    3744
     
    6471end;
    6572
     73procedure TVideoMode.Assign(Source: TVideoMode);
     74begin
     75  Size := Source.Size;
     76  ColorFormat := ColorFormat;
     77end;
     78
    6679{ TDeviceSerial }
    6780
     
    90103  inherited Create;
    91104  ClassName := 'Video device';
     105  FVideoMode := TVideoMode.Create;
    92106end;
    93107
    94 procedure TDeviceVideo.SetMode(Mode: TVideoMode);
     108procedure TDeviceVideo.SetVideoMode(Mode: TVideoMode);
    95109begin
    96110end;
  • trunk/Packages/Kernel/UKernel.pas

    r15 r17  
    7474  if Assigned(VideoDevice) then begin
    7575    NewScreen := TScreen.Create;
    76     NewScreen.VideoMemory := nil;
    7776    Modes := TObjectList.Create;
    7877    VideoDevice.GetSupportedModes(Modes);
    7978    if Modes.Count > 0 then begin
    8079      VideoMode := TVideoMode(Modes.Last);
    81       VideoDevice.SetMode(VideoMode);
     80      VideoDevice.VideoMode := VideoMode;
    8281      NewScreen.Size := VideoMode.Size;
    8382      NewScreen.ColorFormat := VideoMode.ColorFormat;
    84       NewScreen.VideoMemory := VideoDevice.GetVideoMemory;
    85       NewScreen.BytesPerPixel := VideoMode.GetBytesPerPixel;
    86       NewScreen.BytesPerLine := VideoMode.GetBytesPerLine;
    8783      NewScreen.Device := VideoDevice;
    8884      NewScreen.Canvas := TScreenCanvas.Create;
  • trunk/Packages/Kernel/UScreen.pas

    r16 r17  
    2525
    2626  TScreen = class
     27  private
     28    function GetBytesPerLine: Integer;
     29    function GetBytesPerPixel: Integer;
     30    function GetVideoMemory: PByte;
     31  public
    2732    Device: TObject; // TDeviceVideo;
    2833    Size: TPoint;
    2934    DPI: Integer;
    3035    ColorFormat: TColorFormat;
    31     BytesPerPixel: Integer;
    32     BytesPerLine: Integer;
    33     VideoMemory: PByte;
    3436    Canvas: TCanvas;
    3537    procedure VideoMemoryUpdated;
     38    property BytesPerPixel: Integer read GetBytesPerPixel;
     39    property BytesPerLine: Integer read GetBytesPerLine;
     40    property VideoMemory: PByte read GetVideoMemory;
    3641  end;
    3742
     
    99104{ TScreen }
    100105
     106function TScreen.GetBytesPerLine: Integer;
     107begin
     108  Result := TDeviceVideo(Device).VideoMode.GetBytesPerLine;
     109end;
     110
     111function TScreen.GetBytesPerPixel: Integer;
     112begin
     113  Result := TDeviceVideo(Device).VideoMode.GetBytesPerPixel;
     114end;
     115
     116function TScreen.GetVideoMemory: PByte;
     117begin
     118  Result := TDeviceVideo(Device).VideoMemory;
     119end;
     120
    101121procedure TScreen.VideoMemoryUpdated;
    102122begin
Note: See TracChangeset for help on using the changeset viewer.