aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/lcddisplayview.h
blob: 461bffce8a83bae2b20030cb370e774eea02787a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef LCDDISPLAYVIEW_H
#define LCDDISPLAYVIEW_H

#include <QWidget>
#include <QImage>

#include "lcddisplay.h"

class LcdDisplayView : public QWidget
{
    Q_OBJECT

    using Super = QWidget;

public:
    explicit LcdDisplayView(QWidget *parent = 0);
    ~LcdDisplayView();

    void setup(machine::LcdDisplay *lcd_display);
    uint fb_width();
    uint fb_height();

public slots:
    void pixel_update(uint x, uint y, uint r, uint g, uint b);

protected:
    virtual void paintEvent(QPaintEvent *event)  override;
    virtual void resizeEvent(QResizeEvent *event) override;

private:
    void update_scale();
    float scale_x;
    float scale_y;
    QImage *fb_pixels;
};

#endif // LCDDISPLAYVIEW_H