OSDN Git Service

[Draw][OpenGL][OSD] Prepare to direct update vram.
[csp-qt/common_source_project-fm7.git] / source / src / qt / gui / draw_thread.h
1 /*
2         Skelton for retropc emulator
3         Author : Takeda.Toshiya
4         Port to Qt : K.Ohta <whatisthis.sowhat _at_ gmail.com>
5         Date   : 2006.08.18 -
6         License : GPLv2
7         History : 2015.11.10 Split from qt_main.h
8         [ win32 main ] -> [ Qt main ] -> [Draw]
9 */
10 #ifndef _CSP_QT_DRAW_THREAD_H
11 #define _CSP_QT_DRAW_THREAD_H
12
13 #include <QThread>
14
15 #include <SDL.h>
16
17 #include "qt_gldraw.h"
18
19 class Ui_MainWindowBase;
20 class EMU;
21 class OSD;
22 class CSP_Logger;
23 class QSemaphore;
24 class QScreen;
25 class USING_FLAGS;
26 QT_BEGIN_NAMESPACE
27
28 class DLL_PREFIX DrawThreadClass : public QThread {
29         Q_OBJECT
30  private:
31         OSD *p_osd;
32         Ui_MainWindowBase *MainWindow;
33         GLDrawClass *glv;
34
35         qreal refresh_rate;
36         qreal wait_refresh;
37         qreal wait_count;
38         int wait_factor;
39         int rec_frame_count;
40         int rec_frame_width;
41         int rec_frame_height;
42         
43  protected:
44         USING_FLAGS *using_flags;
45         QScreen *screen;
46         int draw_frames;
47         bool bRunThread;
48         bool bDrawReq;
49         bool bRecentRenderStatus;
50         bool use_separate_thread_draw;
51         bitmap_t *draw_screen_buffer;
52         CSP_Logger *csp_logger;
53         int ncount;
54         double emu_frame_rate;
55
56         bool mapping_status;
57         scrntype_t *mapping_pointer;
58         int mapping_width;
59         int mapping_height;
60         bool mapped_drawn;
61         void doDrawMain(bool flag);
62  public:
63         DrawThreadClass(OSD *o, CSP_Logger *logger, QObject *parent = 0);
64         ~DrawThreadClass();
65         QSemaphore *renderSemaphore;
66         QSemaphore *textureMappingSemaphore;
67         
68         void run() { doWork("");}
69         void SetEmu(EMU *p);
70 public slots:
71         void doWork(const QString &);
72         void doExit(void);
73         void doDraw(bool flag);
74         void do_change_refresh_rate(qreal rate);
75         void do_update_screen(bitmap_t *p);
76         void do_req_encueue_video(int count, int width, int height);
77         void do_draw_one_turn(bool _req_draw);
78         void do_set_frames_per_second(double fps);
79         void do_recv_texture_map_status(bool f, void *p, int width, int height);
80         void do_recv_texture_unmap_status(void);
81
82         void req_map_screen_texture();
83         void req_unmap_screen_texture();
84 signals:
85         int sig_draw_frames(int);
86         int message_changed(QString);
87         int sig_update_screen(bitmap_t *);
88         int sig_update_osd(void);
89         int sig_draw_timing(bool);
90         int sig_push_frames_to_avio(int, int, int);
91         int sig_call_draw_screen();
92         int sig_call_no_draw_screen();
93         int sig_map_texture();
94         int sig_unmap_texture();
95 };
96
97 QT_END_NAMESPACE
98 #endif