AppleWin/source/frontends/qapple/video.h
Andrea Odetti 416b461291 Finally some results in the optimisation of CPU usage:
1) Do not call Video::paint() with a scale != 1:1
2) For this reason we need to draw elsewhere
3) and finally scale the whole thing just once to the widget
4) QPixmap vs QImage: cant see the difference
5) QOpenGLWidget is 2x faster than QWidget but it has some flickering when resizing

On my i5-4460  CPU @ 3.20GHz with x2 zoom
TEXT: 4-5% CPU usage
HGR: 6-7% CPU usage


Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
2017-10-14 19:18:44 +01:00

42 lines
1.2 KiB
C++

#ifndef VIDEO_H
#define VIDEO_H
#include <QOpenGLWidget>
#include <memory>
#define VIDEO_BASECLASS QOpenGLWidget
//#define VIDEO_BASECLASS QWidget
class GraphicsCache;
class Video : public VIDEO_BASECLASS
{
Q_OBJECT
public:
explicit Video(QWidget *parent = 0);
signals:
public slots:
protected:
virtual void paintEvent(QPaintEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
private:
bool Update40ColCell(QPainter & painter, int x, int y, int xpixel, int ypixel, int offset);
bool Update80ColCell(QPainter & painter, int x, int y, int xpixel, int ypixel, int offset);
bool UpdateLoResCell(QPainter & painter, int x, int y, int xpixel, int ypixel, int offset);
bool UpdateDLoResCell(QPainter & painter, int x, int y, int xpixel, int ypixel, int offset);
bool UpdateHiResCell(QPainter & painter, int x, int y, int xpixel, int ypixel, int offset);
bool UpdateDHiResCell(QPainter & painter, int x, int y, int xpixel, int ypixel, int offset);
// paint the whole screen
// no scale applied
void paint(QPainter & painter);
std::shared_ptr<const GraphicsCache> myGraphicsCache;
};
#endif // VIDEO_H