Merge pull request #6066 from Cacodemon345/opengl-3

Port remaining PCem OpenGL renderer features
This commit is contained in:
Miran Grča
2025-08-27 09:28:51 +02:00
committed by GitHub
31 changed files with 481 additions and 12 deletions

View File

@@ -234,6 +234,9 @@ int portable_mode = 0; /* We are runn
int monitor_edid = 0; /* (C) Which EDID to use. 0=default, 1=custom. */
char monitor_edid_path[1024] = { 0 }; /* (C) Path to custom EDID */
double video_gl_input_scale = 1.0; /* (C) OpenGL 3.x input scale */
int video_gl_input_scale_mode = FULLSCR_SCALE_FULL; /* (C) OpenGL 3.x input stretch mode */
// Accelerator key array
struct accelKey acc_keys[NUM_ACCELS];

View File

@@ -227,6 +227,9 @@ load_general(void)
video_framerate = ini_section_get_int(cat, "video_gl_framerate", -1);
video_vsync = ini_section_get_int(cat, "video_gl_vsync", 0);
video_gl_input_scale = ini_section_get_double(cat, "video_gl_input_scale", 1.0);
video_gl_input_scale_mode = ini_section_get_int(cat, "video_gl_input_scale_mode", FULLSCR_SCALE_FULL);
window_remember = ini_section_get_int(cat, "window_remember", 0);
if (window_remember) {
p = ini_section_get_string(cat, "window_coordinates", NULL);
@@ -2398,6 +2401,18 @@ save_general(void)
else
ini_section_delete_var(cat, "do_auto_pause");
if (video_gl_input_scale != 1.0) {
ini_section_set_double(cat, "video_gl_input_scale", video_gl_input_scale);
} else {
ini_section_delete_var(cat, "video_gl_input_scale");
}
if (video_gl_input_scale_mode != FULLSCR_SCALE_FULL) {
ini_section_set_int(cat, "video_gl_input_scale_mode", video_gl_input_scale_mode);
} else {
ini_section_delete_var(cat, "video_gl_input_scale_mode");
}
if (force_constant_mouse)
ini_section_set_int(cat, "force_constant_mouse", force_constant_mouse);
else

View File

@@ -140,6 +140,8 @@ extern int force_43; /* (C) video */
extern int video_filter_method; /* (C) video */
extern int video_vsync; /* (C) video */
extern int video_framerate; /* (C) video */
extern double video_gl_input_scale; /* (C) OpenGL 3.x input scale */
extern int video_gl_input_scale_mode; /* (C) OpenGL 3.x input stretch mode */
extern int gfxcard[GFXCARD_MAX]; /* (C) graphics/video card */
extern int bugger_enabled; /* (C) enable ISAbugger */
extern int novell_keycard_enabled; /* (C) enable Novell NetWare 2.x key card emulation. */

View File

@@ -2966,3 +2966,9 @@ msgstr ""
msgid "EDID file \"%ls\" is too large."
msgstr ""
msgid "OpenGL input scale"
msgstr ""
msgid "OpenGL input stretch mode"
msgstr ""

View File

@@ -2966,3 +2966,9 @@ msgstr "Exportovat EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Soubor EDID \"%ls\" je příliš velký."
msgid "OpenGL input scale"
msgstr "Vstupní měřítko OpenGL"
msgid "OpenGL input stretch mode"
msgstr "režim roztažení vstupu OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "EDID exportieren"
msgid "EDID file \"%ls\" is too large."
msgstr "Die EDID-Datei \"%ls\" ist zu groß."
msgid "OpenGL input scale"
msgstr "Eingabeskala von OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Eingabestreckungsmodus von OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "EDID exportieren"
msgid "EDID file \"%ls\" is too large."
msgstr "El archivo EDID \"%ls\" es demasiado grande."
msgid "OpenGL input scale"
msgstr "Escala de entrada de OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Modo de estiramiento de entrada de OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Vie EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "EDID-tiedosto \"%ls\" on liian suuri."
msgid "OpenGL input scale"
msgstr "OpenGL:n syöttöasteikko"
msgid "OpenGL input stretch mode"
msgstr "OpenGL:n syötteen venytystila"

View File

@@ -2966,3 +2966,9 @@ msgstr "Exporter l'EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Le fichier EDID \"%ls\" est trop volumineux."
msgid "OpenGL input scale"
msgstr "Échelle d'entrée d'OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Mode d'étirement des données d'entrée d'OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Izvoz EDID-a"
msgid "EDID file \"%ls\" is too large."
msgstr "EDID datoteka \"%ls\" je prevelika."
msgid "OpenGL input scale"
msgstr "Ulazna skala OpenGL-a"
msgid "OpenGL input stretch mode"
msgstr "Način rastezanja ulaza u OpenGL-u"

View File

@@ -2966,3 +2966,9 @@ msgstr "Esporta EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Il file EDID \"%ls\" è troppo grande."
msgid "OpenGL input scale"
msgstr "Scala di input di OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Modalità di allungamento dell'input di OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "EDIDのエクスポート"
msgid "EDID file \"%ls\" is too large."
msgstr "EDIDファイル \"%ls\" が大きすぎます。"
msgid "OpenGL input scale"
msgstr "OpenGLの入力スケール"
msgid "OpenGL input stretch mode"
msgstr "OpenGLの入力ストレッチモード"

View File

@@ -2966,3 +2966,9 @@ msgstr "EDID 내보내기"
msgid "EDID file \"%ls\" is too large."
msgstr "EDID 파일 \"%ls\"가 너무 큽니다."
msgid "OpenGL input scale"
msgstr "OpenGL 입력 스케일"
msgid "OpenGL input stretch mode"
msgstr "OpenGL 입력 스트레치 모드"

View File

@@ -2966,3 +2966,9 @@ msgstr "Eksporter EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "EDID-filen \"%ls\" er for stor."
msgid "OpenGL input scale"
msgstr "Inngangsskala for OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Inngangsstrekkmodus for OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "EDID exporteren"
msgid "EDID file \"%ls\" is too large."
msgstr "Het EDID-bestand \"%ls\" is te groot."
msgid "OpenGL input scale"
msgstr "Invoerschaal van OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Input stretch-modus van OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Eksportuj EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Plik EDID \"%ls\" jest zbyt duży."
msgid "OpenGL input scale"
msgstr "Skala wejściowa OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Tryb rozciągania wejściowego OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Exportar EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "O arquivo EDID \"%ls\" é muito grande."
msgid "OpenGL input scale"
msgstr "Escala de entrada do OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Modo de expansão de entrada do OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Exportar EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "O ficheiro EDID \"%ls\" é demasiado grande."
msgid "OpenGL input scale"
msgstr "Escala de entrada do OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Modo de expansão de entrada do OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Экспорт EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Файл EDID \"%ls\" слишком велик."
msgid "OpenGL input scale"
msgstr "Масштаб ввода OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Режим растяжения ввода OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Exportovať EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Súbor EDID \"%ls\" je príliš veľký."
msgid "OpenGL input scale"
msgstr "Vstupná stupnica OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Režim rozťahovania vstupu OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Izvoz EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Datoteka EDID \"%ls\" je prevelika."
msgid "OpenGL input scale"
msgstr "Vhodna lestvica OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Način raztezanja vhoda OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Exportera EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "EDID-filen \"%ls\" är för stor."
msgid "OpenGL input scale"
msgstr "Inmatningsskala för OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Inmatningssträckningsläge för OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "EDID'i dışa aktar"
msgid "EDID file \"%ls\" is too large."
msgstr "EDID dosyası \"%ls\" çok büyük."
msgid "OpenGL input scale"
msgstr "OpenGL'nin giriş ölçeği"
msgid "OpenGL input stretch mode"
msgstr "OpenGL'nin giriş germe modu"

View File

@@ -2966,3 +2966,9 @@ msgstr "Експорт EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Файл EDID \"%ls\" занадто великий."
msgid "OpenGL input scale"
msgstr "Шкала введення OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Режим розтягування вхідних даних OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "Xuất khẩu EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "Tệp EDID \"%ls\" quá lớn."
msgid "OpenGL input scale"
msgstr "Độ phân giải đầu vào của OpenGL"
msgid "OpenGL input stretch mode"
msgstr "Chế độ kéo giãn đầu vào của OpenGL"

View File

@@ -2966,3 +2966,9 @@ msgstr "导出EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "EDID文件 \"%ls\" 过大。"
msgid "OpenGL input scale"
msgstr "OpenGL的输入比例"
msgid "OpenGL input stretch mode"
msgstr "OpenGL的输入拉伸模式"

View File

@@ -2966,3 +2966,9 @@ msgstr "匯出 EDID"
msgid "EDID file \"%ls\" is too large."
msgstr "EDID 檔案 \"%ls\" 太大。"
msgid "OpenGL input scale"
msgstr "OpenGL 的輸入比例"
msgid "OpenGL input stretch mode"
msgstr "OpenGL 的輸入拉伸模式"

View File

@@ -530,6 +530,8 @@ MainWindow::MainWindow(QWidget *parent)
#endif
}
ui->stackedWidget->switchRenderer(newVidApi);
ui->menuOpenGL_input_scale->setEnabled(newVidApi == RendererStack::Renderer::OpenGL3);
ui->menuOpenGL_input_stretch_mode->setEnabled(newVidApi == RendererStack::Renderer::OpenGL3);
if (!show_second_monitors)
return;
for (int i = 1; i < MONITORS_NUM; i++) {
@@ -550,6 +552,41 @@ MainWindow::MainWindow(QWidget *parent)
break;
}
ui->action_0_5x_2->setChecked(video_gl_input_scale < 1.0);
ui->action_1x_2->setChecked(video_gl_input_scale >= 1.0 && video_gl_input_scale < 1.5);
ui->action1_5x_2->setChecked(video_gl_input_scale >= 1.5 && video_gl_input_scale < 2.0);
ui->action_2x_2->setChecked(video_gl_input_scale >= 2.0 && video_gl_input_scale < 3.0);
ui->action_3x_2->setChecked(video_gl_input_scale >= 3.0 && video_gl_input_scale < 4.0);
ui->action_4x_2->setChecked(video_gl_input_scale >= 4.0 && video_gl_input_scale < 5.0);
ui->action_5x_2->setChecked(video_gl_input_scale >= 5.0 && video_gl_input_scale < 6.0);
ui->action_6x_2->setChecked(video_gl_input_scale >= 6.0 && video_gl_input_scale < 7.0);
ui->action_7x_2->setChecked(video_gl_input_scale >= 7.0 && video_gl_input_scale < 8.0);
ui->action_8x_2->setChecked(video_gl_input_scale >= 8.0);
actGroup = new QActionGroup(this);
actGroup->addAction(ui->action_0_5x_2);
actGroup->addAction(ui->action_1x_2);
actGroup->addAction(ui->action1_5x_2);
actGroup->addAction(ui->action_2x_2);
actGroup->addAction(ui->action_3x_2);
actGroup->addAction(ui->action_4x_2);
actGroup->addAction(ui->action_5x_2);
actGroup->addAction(ui->action_6x_2);
actGroup->addAction(ui->action_7x_2);
actGroup->addAction(ui->action_8x_2);
connect(actGroup, &QActionGroup::triggered, this, [this](QAction* action) {
if (action == ui->action_0_5x_2) video_gl_input_scale = 0.5;
if (action == ui->action_1x_2) video_gl_input_scale = 1;
if (action == ui->action1_5x_2) video_gl_input_scale = 1.5;
if (action == ui->action_2x_2) video_gl_input_scale = 2;
if (action == ui->action_3x_2) video_gl_input_scale = 3;
if (action == ui->action_4x_2) video_gl_input_scale = 4;
if (action == ui->action_5x_2) video_gl_input_scale = 5;
if (action == ui->action_6x_2) video_gl_input_scale = 6;
if (action == ui->action_7x_2) video_gl_input_scale = 7;
if (action == ui->action_8x_2) video_gl_input_scale = 8;
});
switch (scale) {
default:
break;
@@ -633,6 +670,38 @@ MainWindow::MainWindow(QWidget *parent)
actGroup->addAction(ui->actionFullScreen_keepRatio);
actGroup->addAction(ui->actionFullScreen_int);
actGroup->addAction(ui->actionFullScreen_int43);
switch (video_gl_input_scale_mode) {
default:
break;
case FULLSCR_SCALE_FULL:
ui->action_Full_screen_stretch_gl->setChecked(true);
break;
case FULLSCR_SCALE_43:
ui->action_4_3_gl->setChecked(true);
break;
case FULLSCR_SCALE_KEEPRATIO:
ui->action_Square_pixels_keep_ratio_gl->setChecked(true);
break;
case FULLSCR_SCALE_INT:
ui->action_Integer_scale_gl->setChecked(true);
break;
case FULLSCR_SCALE_INT43:
ui->action4_3_Integer_scale_gl->setChecked(true);
break;
}
actGroup = new QActionGroup(this);
actGroup->addAction(ui->action_Full_screen_stretch_gl);
actGroup->addAction(ui->action_4_3_gl);
actGroup->addAction(ui->action_Square_pixels_keep_ratio_gl);
actGroup->addAction(ui->action_Integer_scale_gl);
actGroup->addAction(ui->action4_3_Integer_scale_gl);
connect(actGroup, &QActionGroup::triggered, this, [this](QAction* action) {
if (action == ui->action_Full_screen_stretch_gl) video_gl_input_scale_mode = FULLSCR_SCALE_FULL;
if (action == ui->action_4_3_gl) video_gl_input_scale_mode = FULLSCR_SCALE_43;
if (action == ui->action_Square_pixels_keep_ratio_gl) video_gl_input_scale_mode = FULLSCR_SCALE_KEEPRATIO;
if (action == ui->action_Integer_scale_gl) video_gl_input_scale_mode = FULLSCR_SCALE_INT;
if (action == ui->action4_3_Integer_scale_gl) video_gl_input_scale_mode = FULLSCR_SCALE_INT43;
});
switch (video_grayscale) {
default:
break;
@@ -1714,6 +1783,21 @@ MainWindow::on_actionInverted_VGA_monitor_triggered()
video_toggle_option(ui->actionInverted_VGA_monitor, &invert_display);
}
static void
update_scaled_checkboxes_gl(Ui::MainWindow *ui, QAction *selected)
{
ui->action_0_5x_2->setChecked(ui->action_0_5x_2 == selected);
ui->action_1x_2->setChecked(ui->action_1x_2 == selected);
ui->action1_5x_2->setChecked(ui->action1_5x_2 == selected);
ui->action_2x_2->setChecked(ui->action_2x_2 == selected);
ui->action_3x_2->setChecked(ui->action_3x_2 == selected);
ui->action_4x_2->setChecked(ui->action_4x_2 == selected);
ui->action_5x_2->setChecked(ui->action_5x_2 == selected);
ui->action_6x_2->setChecked(ui->action_6x_2 == selected);
ui->action_7x_2->setChecked(ui->action_7x_2 == selected);
ui->action_8x_2->setChecked(ui->action_8x_2 == selected);
}
static void
update_scaled_checkboxes(Ui::MainWindow *ui, QAction *selected)
{

View File

@@ -186,6 +186,31 @@
<addaction name="menuVGA_screen_type"/>
<addaction name="menuGrayscale_conversion_type"/>
</widget>
<widget class="QMenu" name="menuOpenGL_input_stretch_mode">
<property name="title">
<string>OpenGL input stretch mode</string>
</property>
<addaction name="action_Full_screen_stretch_gl"/>
<addaction name="action_4_3_gl"/>
<addaction name="action_Square_pixels_keep_ratio_gl"/>
<addaction name="action_Integer_scale_gl"/>
<addaction name="action4_3_Integer_scale_gl"/>
</widget>
<widget class="QMenu" name="menuOpenGL_input_scale">
<property name="title">
<string>OpenGL input scale</string>
</property>
<addaction name="action_0_5x_2"/>
<addaction name="action_1x_2"/>
<addaction name="action1_5x_2"/>
<addaction name="action_2x_2"/>
<addaction name="action_3x_2"/>
<addaction name="action_4x_2"/>
<addaction name="action_5x_2"/>
<addaction name="action_6x_2"/>
<addaction name="action_7x_2"/>
<addaction name="action_8x_2"/>
</widget>
<addaction name="actionHide_tool_bar"/>
<addaction name="actionHide_status_bar"/>
<addaction name="separator"/>
@@ -195,6 +220,8 @@
<addaction name="separator"/>
<addaction name="menuRenderer"/>
<addaction name="actionRenderer_options"/>
<addaction name="menuOpenGL_input_stretch_mode"/>
<addaction name="menuOpenGL_input_scale"/>
<addaction name="separator"/>
<addaction name="actionSpecify_dimensions"/>
<addaction name="actionForce_4_3_display_ratio"/>
@@ -894,6 +921,134 @@
<string>&amp;CGA composite settings...</string>
</property>
</action>
<action name="action_Full_screen_stretch_gl">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Full screen stretch</string>
</property>
</action>
<action name="action_4_3_gl">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;4:3</string>
</property>
</action>
<action name="action_Square_pixels_keep_ratio_gl">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Square pixels (keep ratio)</string>
</property>
</action>
<action name="action_Integer_scale_gl">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Integer scale</string>
</property>
</action>
<action name="action4_3_Integer_scale_gl">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>4:&amp;3 Integer scale</string>
</property>
</action>
<action name="action_1x">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;1x</string>
</property>
</action>
<action name="action_0_5x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;0.5x</string>
</property>
</action>
<action name="action_1x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;1x</string>
</property>
</action>
<action name="action1_5x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>1.&amp;5x</string>
</property>
</action>
<action name="action_2x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;2x</string>
</property>
</action>
<action name="action_3x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;3x</string>
</property>
</action>
<action name="action_4x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;4x</string>
</property>
</action>
<action name="action_5x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;5x</string>
</property>
</action>
<action name="action_6x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;6x</string>
</property>
</action>
<action name="action_7x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;7x</string>
</property>
</action>
<action name="action_8x_2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;8x</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@@ -1386,6 +1386,8 @@ OpenGLRenderer::getOptions(QWidget *parent)
return new OpenGLShaderManagerDialog(parent);
}
extern void standalone_scale(QRect &destination, int width, int height, QRect source, int scalemode);
void
OpenGLRenderer::render()
{
@@ -1428,19 +1430,16 @@ OpenGLRenderer::render()
{
struct shader_pass *pass = &active_shader->scene;
struct {
uint32_t x;
uint32_t y;
uint32_t w;
uint32_t h;
} rect;
rect.x = 0;
rect.y = 0;
rect.w = source.width();
rect.h = source.height();
QRect rect;
rect.setX(0);
rect.setY(0);
rect.setWidth(source.width() * video_gl_input_scale);
rect.setHeight(source.height() * video_gl_input_scale);
pass->state.input_size[0] = pass->state.output_size[0] = rect.w;
pass->state.input_size[1] = pass->state.output_size[1] = rect.h;
standalone_scale(rect, source.width(), source.height(), rect, video_gl_input_scale_mode);
pass->state.input_size[0] = pass->state.output_size[0] = rect.width();
pass->state.input_size[1] = pass->state.output_size[1] = rect.height();
pass->state.input_texture_size[0] = pass->state.output_texture_size[0] = next_pow2(pass->state.output_size[0]);
pass->state.input_texture_size[1] = pass->state.output_texture_size[1] = next_pow2(pass->state.output_size[1]);

View File

@@ -49,6 +49,73 @@ integer_scale(double *d, double *g)
}
}
void
standalone_scale(QRect &destination, int width, int height, QRect source, int scalemode)
{
double dx;
double dy;
double dw;
double dh;
double gsr;
double hw = width;
double hh = height;
double gw = source.width();
double gh = source.height();
double hsr = hw / hh;
double r43 = 4.0 / 3.0;
switch (scalemode) {
case FULLSCR_SCALE_INT:
case FULLSCR_SCALE_INT43:
gsr = gw / gh;
if (scalemode == FULLSCR_SCALE_INT43) {
gh = gw / r43;
gsr = r43;
}
if (gsr <= hsr) {
dw = hh * gsr;
dh = hh;
} else {
dw = hw;
dh = hw / gsr;
}
integer_scale(&dw, &gw);
integer_scale(&dh, &gh);
dx = (hw - dw) / 2.0;
dy = (hh - dh) / 2.0;
destination.setRect((int) dx, (int) dy, (int) dw, (int) dh);
break;
case FULLSCR_SCALE_43:
case FULLSCR_SCALE_KEEPRATIO:
if (scalemode == FULLSCR_SCALE_43)
gsr = r43;
else
gsr = gw / gh;
if (gsr <= hsr) {
dw = hh * gsr;
dh = hh;
} else {
dw = hw;
dh = hw / gsr;
}
dx = (hw - dw) / 2.0;
dy = (hh - dh) / 2.0;
destination.setRect((int) dx, (int) dy, (int) dw, (int) dh);
break;
case FULLSCR_SCALE_FULL:
default:
destination.setRect(0, 0, (int) hw, (int) hh);
break;
}
}
void
RendererCommon::onResize(int width, int height)
{