Annotation of nono/vm/renderer.h, revision 1.1.1.1

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2018 [email protected]
                      4: //
                      5: // レンダラ
                      6: //
                      7: 
                      8: #pragma once
                      9: 
                     10: #include "device.h"
                     11: #include <condition_variable>
                     12: #include <mutex>
                     13: 
                     14: class Renderer : public Device
                     15: {
                     16:        typedef Device inherited;
                     17:  public:
                     18:        // wxWidgets のビットマップは R8_G8_B8 の3バイト。
                     19:        static const int BPP = 3;
                     20: 
                     21:        static const uint REQ_TERMINATE         = 0x01; // スレッド終了指示
                     22:        static const uint REQ_REND_POWEROFF     = 0x02; // 電源オフ時の描画指示
                     23:        static const uint REQ_REND_NORMAL       = 0x04; // 通常の描画指示
                     24: 
                     25:  public:
                     26:        Renderer();
                     27:        virtual ~Renderer();
                     28: 
                     29:        virtual bool Init();
                     30:        virtual bool PowerOff();
                     31: 
                     32:        // バッファとコールバック関数を指定
                     33:        // XXX 名前...
                     34:        void SetBuf(uint8 *, void (*)(void));
                     35: 
                     36:        // 画面合成処理 (CRTC とかから呼ばれる)
                     37:        void Render();
                     38: 
                     39:        // 仮想画面幅(ピクセル)を取得
                     40:        int GetWidth() const { return width; }
                     41: 
                     42:        // 仮想画面高さ(ピクセル)を取得
                     43:        int GetHeight() const { return height; }
                     44: 
                     45:        // レンダリングスレッド (エントリポイントから呼ばれる)
                     46:        void ThreadRun();
                     47: 
                     48:  protected:
                     49:        // 画面合成。更新があれば true を返す。(派生クラス側で用意)
                     50:        virtual bool RenderMain() = 0;
                     51: 
                     52:        // ウィンドウとして表示される画面はオプションや設定などで縮尺を変える
                     53:        // ことが出来るが (こっちを実画面とする)、ここで扱う仮想画面とはそれに
                     54:        // 関わらず常にその機種の最大描画面積を指す。
                     55:        // LUNA でいう 1280 x 1024 のこと。
                     56: 
                     57:        // 仮想画面幅(ピクセル)
                     58:        int width = 0;
                     59: 
                     60:        // 仮想画面高さ(ピクセル)
                     61:        int height = 0;
                     62: 
                     63:        // バッファ (実体は wx 側で用意)
                     64:        uint8 *imagebuf = NULL;
                     65: 
                     66:        // リフレッシュを指示するためのコールバック (wx 側で用意)
                     67:        // ここから直接 wxWindow::Refresh() を呼べないため。
                     68:        void (*refresh_callback)(void) = NULL;
                     69: 
                     70:        // リクエストフラグ
                     71:        uint32 request = 0;
                     72:        std::mutex mtx {};
                     73:        std::condition_variable cv {};
                     74: };
                     75: 
                     76: //
                     77: // X68030 レンダラ
                     78: //
                     79: class X68030Renderer : public Renderer
                     80: {
                     81:        typedef Renderer inherited;
                     82:  public:
                     83:        X68030Renderer();
                     84:        virtual ~X68030Renderer();
                     85: 
                     86:        virtual bool RenderMain();
                     87: };
                     88: 
                     89: //
                     90: // LUNA レンダラ
                     91: //
                     92: class LunaRenderer : public Renderer
                     93: {
                     94:        typedef Renderer inherited;
                     95:  public:
                     96:        LunaRenderer();
                     97:        virtual ~LunaRenderer();
                     98: 
                     99:        virtual bool RenderMain();
                    100: };
                    101: 
                    102: extern Renderer *gRenderer;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.