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:
22
src/qt/qt_softwarerenderer.cpp
Normal file
22
src/qt/qt_softwarerenderer.cpp
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user