feat: TCustomOpenGLControl.PixelScale — devicePixelRatio для HiDPI

LOpenGLPixelScale в Qt-бэкенде (QLCLGLWidget_devicePixelRatioF),
на прочих бэкендах возвращает 1.0. Нужен коду с явными glViewport
и текстурами в физических пикселях.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 16:12:11 +03:00
co-authored by Claude Fable 5
parent ac46e3d13a
commit dd9717b982
2 changed files with 26 additions and 5 deletions
+12
View File
@@ -166,6 +166,9 @@ type
procedure SwapBuffers; virtual;
function MakeCurrent(SaveOldToStack: boolean = false): boolean; virtual;
function ReleaseContext: boolean; virtual;
// devicePixelRatio фреймбуфера (HiDPI). 1.0 на бэкендах без поддержки.
// Явные glViewport/текстуры в пользовательском коде должны умножать на него.
function PixelScale: Double;
function RestoreOldOpenGLControl: boolean;
function SharingControlCount: integer;
property SharingControls[Index: integer]: TCustomOpenGLControl read GetSharingControls;
@@ -643,6 +646,15 @@ begin
Result:=LOpenGLReleaseContext(Handle);
end;
function TCustomOpenGLControl.PixelScale: Double;
begin
Result:=1.0;
{$IFDEF UseQtNative}
if HandleAllocated then
Result:=LOpenGLPixelScale(Handle);
{$ENDIF}
end;
function TCustomOpenGLControl.RestoreOldOpenGLControl: boolean;
var
RestoredControl: TCustomOpenGLControl;