- Timestamp:
- Jan 21, 2018, 10:01:14 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r14 r17 5 5 Width = 932 6 6 Caption = 'Screen 1 - ChronOS' 7 ClientHeight = 65 67 ClientHeight = 653 8 8 ClientWidth = 932 9 9 Menu = MainMenu1 … … 16 16 object PaintBox1: TPaintBox 17 17 Left = 0 18 Height = 65 618 Height = 653 19 19 Top = 0 20 20 Width = 932 -
trunk/Forms/UFormMain.pas
r15 r17 92 92 VideoDevice.OnRedraw := VideoDeviceRedraw; 93 93 VideoDevice.DPI := Screen.PixelsPerInch; 94 VideoDevice.VideoMemorySize := TPoint.Create(PaintBox1.Width, PaintBox1.Height);95 94 VideoDevice.OnModeChanged := VideoDeviceRedraw; 95 PaintBox1Resize(Self); 96 96 Kernel.Devices.Add(VideoDevice); 97 97 … … 215 215 216 216 procedure TFormMain.PaintBox1Resize(Sender: TObject); 217 begin 217 var 218 VideoMode: TVideoMode; 219 begin 220 VideoMode := TVideoMode.Create; 221 VideoMode.Assign(VideoDevice.VideoMode); 222 VideoMode.Size := TPoint.Create(Width, Height); 223 VideoDevice.VideoMode := VideoMode; 218 224 end; 219 225 -
trunk/Packages/Kernel/UDevice.pas
r13 r17 24 24 function GetBytesPerLine: Integer; 25 25 function GetBytesPerImage: Integer; 26 procedure Assign(Source: TVideoMode); 26 27 end; 27 28 … … 29 30 30 31 TDeviceVideo = class(TDevice) 32 private 33 FVideoMode: TVideoMode; 34 protected 35 procedure SetVideoMode(Mode: TVideoMode); virtual; 36 function GetVideoMemory: PByte; virtual; 37 public 31 38 constructor Create; override; 32 procedure SetMode(Mode: TVideoMode); virtual;33 39 procedure GetSupportedModes(Modes: TObjectList); virtual; 34 function GetVideoMemory: PByte; virtual;35 40 procedure VideoMemoryChange; virtual; 41 property VideoMode: TVideoMode read FVideoMode write SetVideoMode; 42 property VideoMemory: PByte read GetVideoMemory; 36 43 end; 37 44 … … 64 71 end; 65 72 73 procedure TVideoMode.Assign(Source: TVideoMode); 74 begin 75 Size := Source.Size; 76 ColorFormat := ColorFormat; 77 end; 78 66 79 { TDeviceSerial } 67 80 … … 90 103 inherited Create; 91 104 ClassName := 'Video device'; 105 FVideoMode := TVideoMode.Create; 92 106 end; 93 107 94 procedure TDeviceVideo.Set Mode(Mode: TVideoMode);108 procedure TDeviceVideo.SetVideoMode(Mode: TVideoMode); 95 109 begin 96 110 end; -
trunk/Packages/Kernel/UKernel.pas
r15 r17 74 74 if Assigned(VideoDevice) then begin 75 75 NewScreen := TScreen.Create; 76 NewScreen.VideoMemory := nil;77 76 Modes := TObjectList.Create; 78 77 VideoDevice.GetSupportedModes(Modes); 79 78 if Modes.Count > 0 then begin 80 79 VideoMode := TVideoMode(Modes.Last); 81 VideoDevice. SetMode(VideoMode);80 VideoDevice.VideoMode := VideoMode; 82 81 NewScreen.Size := VideoMode.Size; 83 82 NewScreen.ColorFormat := VideoMode.ColorFormat; 84 NewScreen.VideoMemory := VideoDevice.GetVideoMemory;85 NewScreen.BytesPerPixel := VideoMode.GetBytesPerPixel;86 NewScreen.BytesPerLine := VideoMode.GetBytesPerLine;87 83 NewScreen.Device := VideoDevice; 88 84 NewScreen.Canvas := TScreenCanvas.Create; -
trunk/Packages/Kernel/UScreen.pas
r16 r17 25 25 26 26 TScreen = class 27 private 28 function GetBytesPerLine: Integer; 29 function GetBytesPerPixel: Integer; 30 function GetVideoMemory: PByte; 31 public 27 32 Device: TObject; // TDeviceVideo; 28 33 Size: TPoint; 29 34 DPI: Integer; 30 35 ColorFormat: TColorFormat; 31 BytesPerPixel: Integer;32 BytesPerLine: Integer;33 VideoMemory: PByte;34 36 Canvas: TCanvas; 35 37 procedure VideoMemoryUpdated; 38 property BytesPerPixel: Integer read GetBytesPerPixel; 39 property BytesPerLine: Integer read GetBytesPerLine; 40 property VideoMemory: PByte read GetVideoMemory; 36 41 end; 37 42 … … 99 104 { TScreen } 100 105 106 function TScreen.GetBytesPerLine: Integer; 107 begin 108 Result := TDeviceVideo(Device).VideoMode.GetBytesPerLine; 109 end; 110 111 function TScreen.GetBytesPerPixel: Integer; 112 begin 113 Result := TDeviceVideo(Device).VideoMode.GetBytesPerPixel; 114 end; 115 116 function TScreen.GetVideoMemory: PByte; 117 begin 118 Result := TDeviceVideo(Device).VideoMemory; 119 end; 120 101 121 procedure TScreen.VideoMemoryUpdated; 102 122 begin -
trunk/Platform/Base/UPlatformBase.pas
r14 r17 64 64 FOnRedraw: TNotifyEvent; 65 65 procedure DoRedraw; 66 protected 67 procedure SetVideoMode(Mode: TVideoMode); override; 66 68 public 67 69 VideoMemory: PByte; 68 VideoMemorySize: TPoint;69 70 DPI: Integer; 70 71 Canvas: TCanvas; 71 VideoMode: TVideoMode;72 procedure SetMode(Mode: TVideoMode); override;73 72 procedure GetSupportedModes(Modes: TObjectList); override; 74 73 function GetVideoMemory: PByte; override; … … 89 88 end; 90 89 91 procedure TDeviceVideoBase.Set Mode(Mode: TVideoMode);90 procedure TDeviceVideoBase.SetVideoMode(Mode: TVideoMode); 92 91 begin 93 92 if (VideoMode.Size.X <> Mode.Size.X) or … … 96 95 VideoMode.Size := Mode.Size; 97 96 VideoMode.ColorFormat := Mode.ColorFormat; 97 ReAllocMem(VideoMemory, VideoMode.GetBytesPerImage); 98 FillDWord(VideoMemory^, VideoMode.GetBytesPerImage div 4, $ffffff); 98 99 if Assigned(FOnModeChanged) then 99 100 FOnModeChanged(Self); … … 135 136 function TDeviceVideoBase.GetVideoMemory: PByte; 136 137 begin 137 VideoMemory := GetMem(VideoMode.GetBytesPerImage);138 FillDWord(VideoMemory^, VideoMode.GetBytesPerImage div 4, $ffffff);139 138 Result := VideoMemory; 140 139 end; … … 148 147 begin 149 148 inherited Create; 150 VideoMode := TVideoMode.Create;151 149 end; 152 150
Note:
See TracChangeset
for help on using the changeset viewer.