#include <qpa/qplatformnativeinterface.h>
#include <stdio.h>
+extern bool qt5IsOnscreen;
extern QApplication *qt5App;
extern QOpenGLContext *qt5GLContext;
extern QSurfaceFormat qt5GLFormat;
bool vigs_qt5_onscreen_enabled(void)
{
-#ifndef CONFIG_DARWIN
- /* Qt5 bug, QGLWidget has some problem on MacOS.
- * (scrambled screen when resizing, invalid region masking) */
- if (qt5App != NULL) {
+ // TODO: on Darwin?
+ if (qt5App != NULL && qt5IsOnscreen) {
return true;
}
-#endif
-
return false;
}
if (pixels) {
captured = server->capture(server, root_sfc, pixels);
+ /* TODO: brightness composite to pixels */
}
server->capture_ops->process_captured(captured,
#ifdef CONFIG_MARU
DT_MARU_SDL,
DT_MARU_SHM,
- DT_MARU_QT,
+ DT_MARU_QT_ONSCREEN,
+ DT_MARU_QT_OFFSCREEN,
#endif
DT_NONE,
} DisplayType;
{
switch (display_type) {
#ifdef CONFIG_QT
- case DT_MARU_QT:
- maru_qt5_display_early_init();
+ case DT_MARU_QT_ONSCREEN:
+ maru_qt5_display_early_init(true);
+ break;
+ case DT_MARU_QT_OFFSCREEN:
+ maru_qt5_display_early_init(false);
break;
#endif
default:
break;
#endif
#ifdef CONFIG_QT
- case DT_MARU_QT:
+ case DT_MARU_QT_ONSCREEN:
+ case DT_MARU_QT_OFFSCREEN:
maru_qt5_display_init(mdcl, full_screen);
break;
#endif
void maru_shm_pre_init(MaruDisplayChangeListener *mdcl);
/* maru_qt */
-void maru_qt5_display_early_init(void);
+void maru_qt5_display_early_init(bool isOnscreen);
void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen);
*
*/
+#include <png.h>
#include "ui/console.h"
#include "emul_state.h"
#include "maru_display.h"
#include "qt5_supplement.h"
+#include "maru_display_processing.h"
extern QemuMutex sdl_mutex;
extern QemuCond sdl_cond;
return;
}
+ composite_brightness_image(surf->image);
+
qt5_update_internal(surface_data(surf),
surface_width(surf),
surface_height(surf));
void set_application_icon(char *path);
#endif
-void maru_qt5_display_early_init(void)
+void maru_qt5_display_early_init(bool isOnscreen)
{
#ifdef CONFIG_DARWIN
ns_run_in_event_loop(&qt5_early_prepare);
set_application_icon(icon_path);
g_free(icon_path);
#else
- qt5_early_prepare();
+ qt5_early_prepare(isOnscreen);
#endif
}
void loadMainFormFromXML(QFile *, UIInformation *);
void loadConFormFromXML(QFile *, UIInformation *);
+bool qt5IsOnscreen;
QApplication *qt5App = NULL;
static int argc = 0;
delete uiInfo;
}
-void qt5_early_prepare(void)
+void qt5_early_prepare(bool isOnscreen)
{
+ qt5IsOnscreen = isOnscreen;
Q_INIT_RESOURCE(resource);
qInstallMessageHandler(qMessageOutput);
void qt5_update_internal(void *data, int width, int height)
{
+ QMatrix matrix = QMatrix();
QPixmap pixmap = QPixmap();
QLabel *screenWidget = mainwindow->getScreenWidget();
- /*
- * TODO: support rotation.
- */
+ matrix.scale(mainwindow->getUIState()->getScaleFactor(),
+ mainwindow->getUIState()->getScaleFactor());
+ matrix.rotate(mainwindow->uiInfo->getMainFormDisplayType()->getAngle());
QImage image = QImage((uchar *)data, width, height, QImage::Format_RGB32);
- pixmap.convertFromImage(image);
- screenWidget->setPixmap(pixmap.scaled(screenWidget->size(),
- Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ pixmap.convertFromImage(image.transformed(matrix, Qt::SmoothTransformation));
+ screenWidget->setPixmap(pixmap);
}
void qt5_switch_internal(void)
#endif
void qt5_graphic_hw_invalidate(void);
int qt5_graphic_hw_display(void);
-void qt5_early_prepare(void);
+void qt5_early_prepare(bool isOnscreen);
void qt5_prepare(void);
void qt5_destroy(void);
# endif
} else if (strstart(p, "maru_qt", &opts)) {
# ifdef CONFIG_QT
- display = DT_MARU_QT;
+ if (*opts) {
+ const char *nextopt;
+ if (strstart(opts, ",rendering=", &nextopt)) {
+ opts = nextopt;
+ if (strstart(opts, "onscreen", &nextopt)) {
+ display = DT_MARU_QT_ONSCREEN;
+ } else if (strstart(opts, "offscreen", &nextopt)) {
+ display = DT_MARU_QT_OFFSCREEN;
+ } else {
+ goto invalid_maru_qt_args;
+ }
+ } else {
+ invalid_maru_qt_args:
+ fprintf(stderr, "Invalid maru_qt option string: %s\n", p);
+ exit(1);
+ }
+ } else {
+ display = DT_MARU_QT_ONSCREEN;
+ }
# else
fprintf(stderr, "maru_qt is disabled\n");
break;
#endif
#if defined(CONFIG_QT)
- case DT_MARU_QT:
+ case DT_MARU_QT_ONSCREEN:
+ case DT_MARU_QT_OFFSCREEN:
maru_display_init(ds, display_type, full_screen);
break;
#endif