Merge remote-tracking branch 'winqt/qt' into winqt5

This commit is contained in:
Cacodemon345
2021-12-17 12:17:56 +06:00
17 changed files with 162 additions and 217 deletions

View File

@@ -133,8 +133,6 @@ target_link_libraries(
# needed for static builds
if (WIN32)
qt_import_plugins(plat INCLUDE Qt5::QWindowsIntegrationPlugin Qt5::QICOPlugin QWindowsVistaStylePlugin)
else()
qt_import_plugins(plat INCLUDE Qt5::QICOPlugin)
endif()
if (UNIX AND NOT APPLE)

View File

@@ -17,12 +17,6 @@ void HardwareRenderer::initializeGL()
}
void HardwareRenderer::paintGL() {
//onPaint(this);
}
void HardwareRenderer::paintUnderGL() {
glClearColor(0.f, 0.f, 0.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
onPaint(this);
}

View File

@@ -27,9 +27,8 @@ public:
void resizeGL(int w, int h) override;
void initializeGL() override;
void paintGL() override;
void paintUnderGL() override;
HardwareRenderer(QWindow* parent = nullptr)
: QOpenGLWindow(QOpenGLWindow::PartialUpdateBlend, parent), QOpenGLFunctions()
: QOpenGLWindow(QOpenGLWindow::NoPartialUpdate, parent), QOpenGLFunctions()
{
setMinimumSize(QSize(16, 16));
setFlags(Qt::FramelessWindowHint);

View File

@@ -5,6 +5,8 @@
#include <QLabel>
#include <QMouseEvent>
#include <memory>
class QStatusBar;
class ClickableLabel : public QLabel {

View File

@@ -15,6 +15,8 @@ RendererCommon::RendererCommon() = default;
void RendererCommon::onPaint(QPaintDevice* device) {
QPainter painter(device);
painter.setRenderHint(QPainter::SmoothPixmapTransform, video_filter_method > 0 ? true : false);
painter.fillRect(0, 0, device->width(), device->height(), QColorConstants::Black);
painter.setCompositionMode(QPainter::CompositionMode_Plus);
painter.drawImage(destination, image, source);
// "release" image, reducing it's refcount, so renderstack::blit()
// won't have to reallocate

View File

@@ -25,8 +25,8 @@ RendererStack::RendererStack(QWidget *parent) :
{
ui->setupUi(this);
imagebufs = QVector<QImage>(2);
imagebufs[0] = QImage{QSize(2048 + 64, 2048 + 64), QImage::Format_RGB32};
imagebufs[1] = QImage{QSize(2048 + 64, 2048 + 64), QImage::Format_RGB32};
imagebufs[0] = QImage{QSize(2048, 2048), QImage::Format_RGB32};
imagebufs[1] = QImage{QSize(2048, 2048), QImage::Format_RGB32};
buffers_in_use = std::vector<std::atomic_flag>(2);
buffers_in_use[0].clear();
@@ -222,11 +222,11 @@ void RendererStack::blit(int x, int y, int w, int h)
sw = this->w = w;
sh = this->h = h;
auto imagebits = imagebufs[currentBuf].bits();
video_copy(imagebits + y * ((2048 + 64) * 4) + x * 4, &(buffer32->line[y][x]), h * (2048 + 64) * sizeof(uint32_t));
video_copy(imagebits + y * ((2048) * 4) + x * 4, &(buffer32->line[y][x]), h * (2048) * sizeof(uint32_t));
if (screenshots)
{
video_screenshot((uint32_t *)imagebits, 0, 0, 2048 + 64);
video_screenshot((uint32_t *)imagebits, 0, 0, 2048);
}
video_blit_complete();
blitToRenderer(imagebufs[currentBuf], sx, sy, sw, sh, &buffers_in_use[currentBuf]);

View File

@@ -313,10 +313,10 @@ sdl_blit(int x, int y, int w, int h)
SDL_LockMutex(sdl_mutex);
SDL_LockTexture(sdl_tex, 0, &pixeldata, &pitch);
video_copy(pixeldata, &(buffer32->line[y][x]), h * (2048 + 64) * sizeof(uint32_t));
video_copy(pixeldata, &(buffer32->line[y][x]), h * (2048) * sizeof(uint32_t));
if (screenshots)
video_screenshot((uint32_t *) pixeldata, 0, 0, (2048 + 64));
video_screenshot((uint32_t *) pixeldata, 0, 0, (2048));
SDL_UnlockTexture(sdl_tex);
@@ -414,7 +414,7 @@ sdl_init_texture(void)
}
sdl_tex = SDL_CreateTexture(sdl_render, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING, (2048 + 64), (2048 + 64));
SDL_TEXTUREACCESS_STREAMING, (2048), (2048));
if (sdl_render == NULL) {
sdl_log("SDL: unable to SDL_CreateRenderer (%s)\n", SDL_GetError());

View File

@@ -22,9 +22,9 @@ SpecifyDimensions::SpecifyDimensions(QWidget *parent) :
{
ui->setupUi(this);
ui->checkBox->setChecked(vid_resize == 2);
ui->spinBoxWidth->setRange(16, 2048 + 64);
ui->spinBoxWidth->setRange(16, 2048);
ui->spinBoxWidth->setValue(main_window->getRenderWidgetSize().width());
ui->spinBoxHeight->setRange(16, 2048 + 64);
ui->spinBoxHeight->setRange(16, 2048);
ui->spinBoxHeight->setValue(main_window->getRenderWidgetSize().height());
}