mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 18:43:51 +00:00
Revert "fix(opengl): use Lazarus OpenGLContext"
This reverts commit 004c363df8.
This commit is contained in:
+14
-6
@@ -15,7 +15,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Graphics, Controls, Math,
|
||||
OpenGLContext, GL,
|
||||
OpenGLContextEx, GL,
|
||||
AppTheme, WaterfallView;
|
||||
|
||||
type
|
||||
@@ -322,8 +322,10 @@ end;
|
||||
procedure TWaterfallViewOpenGL.SetWaterfallBitmapSize(W, H: Integer);
|
||||
begin
|
||||
if (W <= 0) or (H <= 0) then Exit;
|
||||
// Ширина текстуры — в физических пикселях (HiDPI): строка водопада должна
|
||||
// ложиться 1:1 на пиксели фреймбуфера, иначе GL размажет её при увеличении.
|
||||
if Assigned(FGLControl) and FGLControl.MakeCurrent then
|
||||
EnsureTexture(W, H);
|
||||
EnsureTexture(Round(W * FGLControl.PixelScale), H);
|
||||
FWaterfallDirty := True;
|
||||
end;
|
||||
|
||||
@@ -334,7 +336,8 @@ end;
|
||||
|
||||
procedure TWaterfallViewOpenGL.PaintWaterfall(Sender: TObject);
|
||||
var
|
||||
W, H: Integer;
|
||||
W, H, TexW: Integer;
|
||||
Scale: Double;
|
||||
R, G, B: GLFloat;
|
||||
begin
|
||||
if Sender is TOpenGLControl then FGLControl := TOpenGLControl(Sender);
|
||||
@@ -342,7 +345,12 @@ begin
|
||||
W := FGLControl.Width;
|
||||
H := FGLControl.Height;
|
||||
if (W <= 0) or (H <= 0) then Exit;
|
||||
glViewport(0, 0, W, H);
|
||||
// HiDPI: viewport покрывает весь FBO (физические пиксели), координаты
|
||||
// остаются логическими; строка водопада строится в физической ширине.
|
||||
Scale := FGLControl.PixelScale;
|
||||
TexW := Round(W * Scale);
|
||||
|
||||
glViewport(0, 0, TexW, Round(H * Scale));
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity;
|
||||
glOrtho(0, W, H, 0, -1, 1);
|
||||
@@ -357,10 +365,10 @@ begin
|
||||
glClearColor(R, G, B, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
EnsureTexture(W, H);
|
||||
EnsureTexture(TexW, H);
|
||||
if FWaterfallDirty then
|
||||
begin
|
||||
UploadCurrentRow(W);
|
||||
UploadCurrentRow(TexW);
|
||||
FWaterfallDirty := False;
|
||||
end;
|
||||
DrawTextureWrapped(W, H);
|
||||
|
||||
Reference in New Issue
Block a user