added software renderer. split common functions prev.

in gleswidget to renderstack (a QStackWidget), which in
turn calls an actual renderer. added ability to target GLES
directly, but this is maybe uneeded.
This commit is contained in:
Joakim L. Gilje
2021-12-04 21:33:04 +01:00
parent 5870e50022
commit a74afc3f1e
12 changed files with 352 additions and 135 deletions

View File

@@ -0,0 +1,22 @@
#include "qt_softwarerenderer.hpp"
#include <QPainter>
SoftwareRenderer::SoftwareRenderer(QWidget *parent) : QWidget(parent) {}
void SoftwareRenderer::paintEvent(QPaintEvent *event) {
(void) event;
QPainter painter(this);
painter.drawImage(QRect(0, 0, width(), height()), image, QRect(sx, sy, sw, sh));
image = QImage();
}
void SoftwareRenderer::onBlit(const QImage& img, int x, int y, int w, int h) {
image = img;
sx = x;
sy = y;
sw = w;
sh = h;
update();
}