• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revisiond2f8d2bf84c5864a7b5a2bcd3076d98e0ed96fad (tree)
Zeit2017-08-11 13:39:56
AutorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[Qt][Draw][GL] Fix screen aspect problem(s).

Ändern Zusammenfassung

Diff

--- a/source/src/qt/CMakeLists.txt
+++ b/source/src/qt/CMakeLists.txt
@@ -1,5 +1,5 @@
11 message("* qt/osd")
2-SET(THIS_LIB_VERSION 2.9.8)
2+SET(THIS_LIB_VERSION 2.9.9)
33
44 set(s_qt_osd_headers
55 osd_base.h
--- a/source/src/qt/common/menu_flags.cpp
+++ b/source/src/qt/common/menu_flags.cpp
@@ -104,7 +104,12 @@ USING_FLAGS_EXT::USING_FLAGS_EXT(config_t *cfg) : USING_FLAGS(cfg)
104104 #else
105105 screen_height = SCREEN_HEIGHT;
106106 #endif
107-
107+#if defined(SCREEN_X_ZOOM)
108+ screen_x_zoom = SCREEN_X_ZOOM;
109+#endif
110+#if defined(SCREEN_Y_ZOOM)
111+ screen_y_zoom = SCREEN_Y_ZOOM;
112+#endif
108113 screen_width_aspect = WINDOW_WIDTH_ASPECT;
109114 screen_height_aspect = WINDOW_HEIGHT_ASPECT;
110115 max_button = 0;
--- a/source/src/qt/gui/CMakeLists.txt
+++ b/source/src/qt/gui/CMakeLists.txt
@@ -1,6 +1,6 @@
11 message("* qt/gui")
22
3-set(THIS_LIB_VERSION 2.10.2)
3+set(THIS_LIB_VERSION 2.10.3)
44 set(s_qt_gui_headers
55 csp_logger.h
66
--- a/source/src/qt/gui/mainwindow_utils.cpp
+++ b/source/src/qt/gui/mainwindow_utils.cpp
@@ -162,26 +162,41 @@ void Ui_MainWindowBase::set_screen_aspect(int num)
162162
163163 if(using_flags->get_emu()) {
164164 int w, h, n;
165- double nd, ww, hh;
165+ float nd, ww, hh;
166+ float xzoom = using_flags->get_screen_x_zoom();
167+ float yzoom = using_flags->get_screen_y_zoom();
166168 n = using_flags->get_config_ptr()->window_mode;
167169 if(n < 0) n = 1;
168170 nd = actionScreenSize[n]->binds->getDoubleValue();
169- ww = nd * (double)using_flags->get_screen_width();
170- hh = nd * (double)using_flags->get_screen_height();
171+ ww = (float)using_flags->get_screen_width();
172+ hh = (float)using_flags->get_screen_height();
171173
172174 if((using_flags->get_screen_height_aspect() != using_flags->get_screen_height()) ||
173175 (using_flags->get_screen_width_aspect() != using_flags->get_screen_width())) {
174- double par_w = (double)using_flags->get_screen_width_aspect() / (double)using_flags->get_screen_width();
175- double par_h = (double)using_flags->get_screen_height_aspect() / (double)using_flags->get_screen_height();
176+ float par_w = (float)using_flags->get_screen_width_aspect() / ww;
177+ float par_h = (float)using_flags->get_screen_height_aspect() / hh;
176178 //double par = par_h / par_w;
177- if(using_flags->get_config_ptr()->window_stretch_type == 1) { // refer to X, scale Y.
178- hh = hh * par_h;
179- } else if(using_flags->get_config_ptr()->window_stretch_type == 2) { // refer to Y, scale X only
180- ww = ww / par_h;
181- } else if(using_flags->get_config_ptr()->window_stretch_type == 3) { // Scale both X, Y
182- ww = ww * par_w;
183- hh = hh * par_h;
179+ switch(using_flags->get_config_ptr()->window_stretch_type) {
180+ case 0: // refer to X and Y.
181+ ww = ww * nd * xzoom;
182+ hh = hh * nd * yzoom;
183+ break;
184+ case 1: // refer to X, scale Y only
185+ ww = ww * nd * xzoom;
186+ hh = hh * nd * par_h;
187+ break;
188+ case 2: // refer to Y, scale X only
189+ ww = (ww * nd) / par_h * yzoom;
190+ hh = hh * nd * yzoom;
191+ break;
192+ case 3:
193+ ww = ((ww * nd) / par_h) * yzoom;
194+ hh = ((hh * nd) / par_w) * xzoom;
195+ break;
184196 }
197+ } else {
198+ ww = ww * nd * xzoom;
199+ hh = hh * nd * yzoom;
185200 }
186201 w = (int)ww;
187202 h = (int)hh;
--- a/source/src/qt/gui/menu_flags.h
+++ b/source/src/qt/gui/menu_flags.h
@@ -137,6 +137,9 @@ protected:
137137
138138 int real_screen_width;
139139 int real_screen_height;
140+
141+ float screen_x_zoom;
142+ float screen_y_zoom;
140143
141144 int screen_width_aspect;
142145 int screen_height_aspect;
@@ -277,6 +280,8 @@ public:
277280 int get_screen_height_aspect() { return screen_height_aspect; }
278281 int get_real_screen_width() { return real_screen_width; }
279282 int get_real_screen_height() { return real_screen_height; }
283+ float get_screen_x_zoom() { return screen_x_zoom; }
284+ float get_screen_y_zoom() { return screen_y_zoom; }
280285
281286 int get_screen_mode_num() { return screen_mode_num; }
282287 int get_max_button() { return max_button; }
--- a/source/src/qt/gui/menu_flags_tmpl.cpp
+++ b/source/src/qt/gui/menu_flags_tmpl.cpp
@@ -84,7 +84,9 @@ USING_FLAGS::USING_FLAGS(config_t *cfg)
8484
8585 screen_width = SCREEN_WIDTH;
8686 screen_height = SCREEN_HEIGHT;
87-
87+
88+ screen_x_zoom = 1.0f;
89+ screen_y_zoom = 1.0f;
8890 screen_width_aspect = WINDOW_WIDTH_ASPECT;
8991 screen_height_aspect = WINDOW_HEIGHT_ASPECT;
9092 max_button = 0;
--- a/source/src/qt/gui/menu_screen.cpp
+++ b/source/src/qt/gui/menu_screen.cpp
@@ -30,24 +30,39 @@ void Object_Menu_Control::set_screen_aspect(void) {
3030
3131 void Object_Menu_Control::set_screen_size(void) {
3232 int w, h;
33- double nd, ww, hh;
33+ float nd, ww, hh;
34+ float xzoom = using_flags->get_screen_x_zoom();
35+ float yzoom = using_flags->get_screen_y_zoom();
3436 using_flags->get_config_ptr()->window_mode = getNumber();
3537 nd = getDoubleValue();
36- ww = nd * (double)using_flags->get_screen_width();
37- hh = nd * (double)using_flags->get_screen_height();
38+ ww = (float)using_flags->get_screen_width();
39+ hh = (float)using_flags->get_screen_height();
3840 if((using_flags->get_screen_height_aspect() != using_flags->get_screen_height()) ||
3941 (using_flags->get_screen_width_aspect() != using_flags->get_screen_width())) {
40- double par_w = (double)using_flags->get_screen_width_aspect() / (double)using_flags->get_screen_width();
41- double par_h = (double)using_flags->get_screen_height_aspect() / (double)using_flags->get_screen_height();
42- //double par = par_h / par_w;
43- if(using_flags->get_config_ptr()->window_stretch_type == 1) { // refer to X, scale Y.
44- hh = hh * par_h;
45- } else if(using_flags->get_config_ptr()->window_stretch_type == 2) { // refer to Y, scale X only
46- ww = ww / par_h;
47- } else if(using_flags->get_config_ptr()->window_stretch_type == 3) { // Scale both X, Y
48- ww = ww * par_w;
49- hh = hh * par_h;
42+ float par_w = (float)using_flags->get_screen_width_aspect() / ww;
43+ float par_h = (float)using_flags->get_screen_height_aspect() / hh;
44+ //float par = par_h / par_w;
45+ switch(using_flags->get_config_ptr()->window_stretch_type) {
46+ case 0: // refer to X and Y.
47+ ww = ww * nd * xzoom;
48+ hh = hh * nd * yzoom;
49+ break;
50+ case 1: // refer to X, scale Y only
51+ ww = ww * nd * xzoom;
52+ hh = hh * nd * par_h;
53+ break;
54+ case 2: // refer to Y, scale X only
55+ ww = (ww * nd) / par_h * yzoom;
56+ hh = hh * nd * yzoom;
57+ break;
58+ case 3:
59+ ww = ((ww * nd) / par_h) * yzoom;
60+ hh = ((hh * nd) / par_w) * xzoom;
61+ break;
5062 }
63+ } else {
64+ ww = ww * nd * xzoom;
65+ hh = hh * nd * yzoom;
5166 }
5267 w = (int)ww;
5368 h = (int)hh;
Show on old repository browser