Annotation of nono/vm/planevram.h, revision 1.1.1.2

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2022 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // プレーン VRAM (垂直 VRAM)
                      9: // Lunafb と X68k TVRAM の共通部分
                     10: //
                     11: 
                     12: #pragma once
                     13: 
                     14: #include "device.h"
                     15: #include "renderer.h"
                     16: #include <vector>
                     17: 
                     18: class PlaneVRAMDevice : public IODevice
                     19: {
                     20:        using inherited = IODevice;
                     21: 
                     22:  public:
1.1.1.2 ! root       23:        PlaneVRAMDevice(int width_, int height_);
1.1       root       24:        virtual ~PlaneVRAMDevice() override;
                     25: 
                     26:        void ResetHard(bool poweron) override;
                     27: 
                     28:        // レンダリング時に使うテーブルを事前に計算する。
                     29:        void InitDeptable();
                     30: 
                     31:        // プレーン数を取得
                     32:        int GetPlaneCount() const { return nplane; }
                     33: 
                     34:        // 更新情報を取得
                     35:        ModifyInfo GetModify() const;
                     36: 
                     37:        // 更新フラグをクリア
                     38:        void ClearDirty();
                     39: 
                     40:        // 画面を合成する
                     41:        bool Render(BitmapRGB& dst, const ModifyInfo& modify);
                     42: 
                     43:        // 合成ビットマップを取得する
                     44:        const BitmapI8& GetComposite() const { return composite; }
                     45: 
1.1.1.2 ! root       46:        // 座標位置の情報を出力 (GUI 用)
        !            47:        virtual void UpdateInfo(TextScreen&, int x, int y) const = 0;
1.1       root       48: 
                     49:  protected:
                     50:        // 全画面の更新フラグを立てる
                     51:        void Invalidate();
                     52: 
                     53:        // 垂直 VRAM から BitmapI8 バッファを作成する
                     54:        void RenderVRAMToComposite(const ModifyInfo& modify);
                     55: 
                     56:        // BitmapI8 バッファから BitmapRGB を作成する。
                     57:        void RenderCompositeToRGB(BitmapRGB& dst, const ModifyInfo& modify);
                     58: 
1.1.1.2 ! root       59:        // X 方向にはみ出したときに対応する仮想画面の Y 座標を返す。
        !            60:        virtual int GetWrapY(int) const = 0;
        !            61: 
1.1       root       62:        // ビットマッププレーン。
                     63:        // メモリを確保する時のサイズ計算のため型を uint8 にしているが、
                     64:        // 運用はロングワードでホストバイトオーダー。
                     65:        // Lunafb では 1枚 256KBで 1 or 4枚。TVRAM では 512KB。
                     66:        std::unique_ptr<uint8[]> mem {};
                     67: 
                     68:        // プレーン数 (TVRAM なら 4 固定、LUNA は設定による)
                     69:        int nplane {};
                     70: 
                     71:        // テキスト画面の合成ビットマップ
                     72:        BitmapI8 composite {};
                     73: 
1.1.1.2 ! root       74:        // 仮想画面の更新フラグ。仮想 Y 座標に対応するので
        !            75:        // Lunafb も TVRAM も 1024個。
1.1       root       76:        std::vector<uint8> dirty {};
                     77: 
                     78:        // レンダリング時に使う変換テーブル
                     79:        std::unique_ptr<uint64[]> deptable {};
                     80: 
                     81:        // ホストパレット
                     82:        const ColorXBGR *palette {};
                     83: 
                     84:        // スクロール
                     85:        int xscroll {};
                     86:        int yscroll {};
                     87: };
                     88: 
1.1.1.2 ! root       89: static inline PlaneVRAMDevice *GetPlaneVRAMDevice() {
        !            90:        return Object::GetObject<PlaneVRAMDevice>(OBJ_PLANEVRAM);
        !            91: }

unix.superglobalmegacorp.com

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