|
|
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.1.3 root 24: ~PlaneVRAMDevice() override;
1.1 root 25:
26: void ResetHard(bool poweron) override;
27:
28: // レンダリング時に使うテーブルを事前に計算する。
29: void InitDeptable();
30:
31: // プレーン数を取得
1.1.1.4 ! root 32: uint GetPlaneCount() const { return nplane; }
1.1 root 33:
34: // 更新情報を取得
1.1.1.4 ! root 35: bool GetModify(ModifyInfo *) const;
1.1 root 36:
37: // 更新フラグをクリア
38: void ClearDirty();
39:
40: // 画面を合成する
1.1.1.3 root 41: bool Render(BitmapRGBX& dst, const ModifyInfo& modify);
1.1 root 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:
1.1.1.3 root 56: // BitmapI8 バッファから BitmapRGBX を作成する。
57: void RenderCompositeToRGBX(BitmapRGBX& dst, const ModifyInfo& modify);
1.1 root 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 は設定による)
1.1.1.4 ! root 69: uint nplane {};
1.1 root 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: // ホストパレット
1.1.1.4 ! root 82: const Color *palette {};
1.1 root 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: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.