• R/O
  • SSH
  • HTTPS

chnosproject: Commit


Commit MetaInfo

Revisión205 (tree)
Tiempo2010-11-28 22:38:45
Autorhikarupsp

Log Message

とりあえず描画系はそろえた。
タスクバーの描写と、boxfillの動作を変更した。
メモリの使用可能領域も、頭のほうにページディレクトリ、テーブルが、後ろにはsystem構造体が置いてあるので、そのあたりも変更した。
タイマーなどはまだない。
とりあえず、前回と同じく多色対応はできている。

Cambiar Resumen

Diferencia incremental

--- beta/tolset_chn_000/chnos_008/chnos/grap_16.c (revision 204)
+++ beta/tolset_chn_000/chnos_008/chnos/grap_16.c (revision 205)
@@ -5,6 +5,9 @@
55 {
66 int x, y;
77
8+ y1 -= 1;
9+ x1 -= 1;
10+
811 for (y = y0;y <= y1;y++) {
912 for (x = x0; x <= x1; x++)
1013 vram[y * xsize + x] = c;
@@ -15,9 +18,6 @@
1518 void init_desktop16(ushort *vram, uint xsize, uint ysize)
1619 {
1720 boxfill16(vram, xsize, DESKTOP_COL16, 0, 0, xsize, ysize);
18- putfonts16_asc(vram, xsize, 168, 8, RGB16(31,62,31), "welcome to CHNOSProject! on 16bit video mode .");
19- putfonts16_asc(vram, xsize, 168, 24, RGB16(31,62,31), "ヨウコソ CHNOSプロジェクトヘ!");
20- putfonts16_asc(vram, xsize, 168, 40, RGB16(31,62,31), "カタコトデスガ ニホンゴガ カケルヨウニ ナリマシタ");
2121
2222 return;
2323 }
@@ -24,9 +24,9 @@
2424
2525 void init_taskbar16(ushort *vram, uint xsize)
2626 {
27- boxfill16(vram, xsize, TASKBAR_COL16, 0, 0, xsize, TASKBAR_HEIGHT);
28- boxfill16(vram, xsize, RGB16(31,62,31), 0, 0, xsize, 1);
29- boxfill16(vram, xsize, RGB16(31,62,31), xsize-2, 0, xsize, TASKBAR_HEIGHT);
27+ boxfill16(vram, xsize, RGB16(31,62,31), 0, 0, xsize, TASKBAR_HEIGHT);
28+ boxfill16(vram, xsize, RGB16(31,62,31), 0, 0, xsize - 2, TASKBAR_HEIGHT - 2);
29+ boxfill16(vram, xsize, TASKBAR_COL16, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2);
3030
3131 return;
3232 }
--- beta/tolset_chn_000/chnos_008/chnos/grap_08.c (revision 204)
+++ beta/tolset_chn_000/chnos_008/chnos/grap_08.c (revision 205)
@@ -5,6 +5,9 @@
55 {
66 int x, y;
77
8+ y1 -= 1;
9+ x1 -= 1;
10+
811 for (y = y0; y <= y1; y++) {
912 for (x = x0; x <= x1; x++)
1013 vram[y * xsize + x] = c;
@@ -16,9 +19,6 @@
1619 void init_desktop8(uchar *vram, uint xsize, uint ysize)
1720 {
1821 boxfill8(vram, xsize, DESKTOP_COL8, 0, 0, xsize, ysize);
19- putfonts8_asc(vram, xsize, 168, 8, COL8_FFFFFF, "welcome to CHNOSProject! on 8bit video mode .");
20- putfonts8_asc(vram, xsize, 168, 24, COL8_FFFFFF, "ヨウコソ CHNOSプロジェクトヘ!");
21- putfonts8_asc(vram, xsize, 168, 40, COL8_FFFFFF, "カタコトデスガ ニホンゴガ カケルヨウニ ナリマシタ");
2222
2323 return;
2424 }
@@ -25,9 +25,9 @@
2525
2626 void init_taskbar8(uchar *vram, uint xsize)
2727 {
28- boxfill8(vram, xsize, TASKBAR_COL8, 0, 0, xsize, TASKBAR_HEIGHT);
29- boxfill8(vram, xsize, COL8_FFFFFF, 0, 0, xsize, 1);
30- boxfill8(vram, xsize, COL8_FFFFFF, xsize-2, 0, xsize, TASKBAR_HEIGHT);
28+ boxfill8(vram, xsize, COL8_FFFFFF, 0, 0, xsize, TASKBAR_HEIGHT);
29+ boxfill8(vram, xsize, COL8_FFFFFF, 0, 0, xsize - 2, TASKBAR_HEIGHT - 2);
30+ boxfill8(vram, xsize, TASKBAR_COL8, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2);
3131
3232 return;
3333 }
--- beta/tolset_chn_000/chnos_008/chnos/bootpack.c (revision 204)
+++ beta/tolset_chn_000/chnos_008/chnos/bootpack.c (revision 205)
@@ -9,14 +9,16 @@
99
1010 init_system();
1111
12- col_pat(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, system.data.info.boot.scrny);
13- draw_chnos_logo(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, system.data.info.boot.scrnx >> 4, system.data.info.boot.scrnx >> 1, (system.data.info.boot.scrny >> 1) - (system.data.info.boot.scrny / 10));
12+ init_screen_i(system.draw.sht.desktop_buf, system.draw.sht.taskbar_buf, system.draw.sht.mouse_buf);
1413
15- sprintf(s, "Welcome to CHNOS Project Paging-Test-Version.");
16- putfonts_asc_i(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 0, 0xFFFFFF, s);
14+ boxfill_i(system.draw.sht.core_buf, system.data.info.boot.scrnx, 0x000000, 0, 0, system.data.info.boot.scrnx, system.data.info.boot.scrny);
15+ draw_chnos_logo(system.draw.sht.core_buf, system.data.info.boot.scrnx, system.data.info.boot.scrnx >> 4, system.data.info.boot.scrnx >> 1, (system.data.info.boot.scrny >> 1) - (system.data.info.boot.scrny / 10));
16+ sheet_updown(system.draw.sht.core, 0);
1717
18- sprintf(s, "Physical-Memory:%dMB(%dKB) Free_Total:%dMB(%dKB)", system.io.mem.total >> 20, system.io.mem.total >> 10, sys_memman_free_total() >> 20, sys_memman_free_total() >> 10);
19- putfonts_asc_i(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 16, 0xFFFFFF, s);
18+ sheet_updown(system.draw.sht.core, -1);
19+ sheet_updown(system.draw.sht.desktop, 0);
20+ sheet_updown(system.draw.sht.taskbar, 1);
21+ sheet_updown(system.draw.sht.mouse, 2);
2022
2123 for(;;){
2224 io_hlt();
--- beta/tolset_chn_000/chnos_008/chnos/init.c (revision 204)
+++ beta/tolset_chn_000/chnos_008/chnos/init.c (revision 205)
@@ -20,11 +20,38 @@
2020 system.data.info.vesa = *vesa;
2121 system.data.info.boot = *boot;
2222
23+ init_serial();
2324 init_gdtidt();
2425 init_paging();
2526 sys_memman_init();
26- sys_memman_free((void *)0x00400000, system.io.mem.total - sizeof(struct SYSTEM) - 0x00400000);
27- init_serial();
27+ sys_memman_free((void *)(0x00400000 + (1024 * 4) + (1024 * 1024 * 4)), system.io.mem.total - sizeof(struct SYSTEM) - 0x00400000) - (1024 * 4) - (1024 * 1024 * 4);
28+ init_sheets(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, system.data.info.boot.scrny, system.data.info.vesa.BitsPerPixel);
2829
30+
31+ system.draw.sht.core = sheet_alloc();
32+ system.draw.sht.desktop = sheet_alloc();
33+ system.draw.sht.taskbar = sheet_alloc();
34+ system.draw.sht.mouse = sheet_alloc();
35+
36+ system.draw.sht.core_buf = sys_memman_alloc(system.data.info.boot.scrnx * system.data.info.boot.scrny * (system.data.info.vesa.BitsPerPixel >> 3));
37+ system.draw.sht.desktop_buf = sys_memman_alloc(system.data.info.boot.scrnx * system.data.info.boot.scrny * (system.data.info.vesa.BitsPerPixel >> 3));
38+ system.draw.sht.taskbar_buf = sys_memman_alloc(system.data.info.boot.scrnx * TASKBAR_HEIGHT * (system.data.info.vesa.BitsPerPixel >> 3));
39+ system.draw.sht.mouse_buf = sys_memman_alloc(24 * 24 * (system.data.info.vesa.BitsPerPixel >> 3));
40+
41+
42+ sheet_setbuf(system.draw.sht.desktop, system.draw.sht.desktop_buf, system.data.info.boot.scrnx, system.data.info.boot.scrny, INV_COL32);
43+ sheet_setbuf(system.draw.sht.mouse, system.draw.sht.mouse_buf, 24, 24, INV_COL32);
44+ sheet_setbuf(system.draw.sht.taskbar, system.draw.sht.taskbar_buf, system.data.info.boot.scrnx, TASKBAR_HEIGHT, INV_COL32);
45+ sheet_setbuf(system.draw.sht.core, system.draw.sht.core_buf, system.data.info.boot.scrnx, system.data.info.boot.scrny, INV_COL32);
46+
47+ sheet_slide(system.draw.sht.desktop, 0, 0);
48+ sheet_updown(system.draw.sht.desktop, -1);
49+ sheet_slide(system.draw.sht.taskbar, 0, system.data.info.boot.scrny - TASKBAR_HEIGHT);
50+ sheet_updown(system.draw.sht.taskbar, -1);
51+ sheet_slide(system.draw.sht.mouse, system.data.info.boot.scrnx >> 1, system.data.info.boot.scrny >> 1);
52+ sheet_updown(system.draw.sht.mouse, -1);
53+ sheet_slide(system.draw.sht.core, 0, 0);
54+ sheet_updown(system.draw.sht.core, -1);
55+
2956 return;
3057 }
--- beta/tolset_chn_000/chnos_008/chnos/sheet.c (nonexistent)
+++ beta/tolset_chn_000/chnos_008/chnos/sheet.c (revision 205)
@@ -0,0 +1,376 @@
1+
2+#include "core.h"
3+
4+UI_SheetControl *ctl;
5+void (*sheet_refreshsub)(int vx0, int vy0, int vx1, int vy1, int h0, int h1);
6+void (*sheet_refreshmap)(int vx0, int vy0, int vx1, int vy1, int h0);
7+
8+void init_sheets(void *vram, int xsize, int ysize, uchar bits)
9+{
10+ int i;
11+
12+ switch(bits){
13+ case 8:
14+ sheet_refreshsub = sheet_refreshsub8;
15+ sheet_refreshmap = sheet_refreshmap8;
16+ break;
17+ case 16:
18+ sheet_refreshsub = sheet_refreshsub16;
19+ sheet_refreshmap = sheet_refreshmap16;
20+ break;
21+ case 32:
22+ sheet_refreshsub = sheet_refreshsub32;
23+ sheet_refreshmap = sheet_refreshmap32;
24+ break;
25+ }
26+
27+ ctl = (UI_SheetControl *)sys_memman_alloc(sizeof(UI_SheetControl));
28+ if(ctl == 0) goto err;
29+ ctl->map = (uint *)sys_memman_alloc(xsize * ysize * 4);
30+ if(ctl->map == 0){
31+ sys_memman_free(ctl, sizeof(UI_SheetControl));
32+ goto err;
33+ }
34+ ctl->vram = vram;
35+ ctl->xsize = xsize;
36+ ctl->ysize = ysize;
37+ ctl->top = -1;
38+ for(i = 0;i < MAX_SHEETS;i++){
39+ ctl->sheets0[i].flags = initialized;
40+ }
41+err:
42+ return;
43+}
44+
45+UI_Sheet *sheet_alloc(void)
46+{
47+ UI_Sheet *sht;
48+ int i;
49+
50+ for(i = 0;i < MAX_SHEETS;i++){
51+ if(ctl->sheets0[i].flags == initialized){
52+ sht = &ctl->sheets0[i];
53+ sht->flags = allocated;
54+ sht->height = -1;
55+ return sht;
56+ }
57+ }
58+ return 0;
59+}
60+
61+void sheet_setbuf(UI_Sheet *sht, void *buf,int xsize, int ysize, uint col_inv)
62+{
63+ sht->buf = buf;
64+ sht->bxsize = xsize;
65+ sht->bysize = ysize;
66+ sht->col_inv = col_inv;
67+ return;
68+}
69+
70+void sheet_updown(UI_Sheet *sht, int height)
71+{
72+ int h, old = sht->height;
73+
74+ if(height > ctl->top + 1) height = ctl->top + 1;
75+ if (height < -1) height = -1;
76+ sht->height = height;
77+
78+ if (old > height){ /*以前よりも低くなる場合*/
79+ if (height >= 0){
80+ for (h = old; h > height; h--){
81+ ctl->sheets[h] = ctl->sheets[h - 1];
82+ ctl->sheets[h]->height = h;
83+ }
84+ ctl->sheets[height] = sht;
85+ sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1);
86+ sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old);
87+ } else { /*非表示になる場合*/
88+ if(ctl->top > old){
89+ for(h = old; h < ctl->top; h++){
90+ ctl->sheets[h] = ctl->sheets[h + 1];
91+ ctl->sheets[h]->height = h;
92+ }
93+ }
94+ ctl->top--;
95+ sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);
96+ sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);
97+ }
98+ } else if(old < height) { /*以前よりも高くなる場合*/
99+ if(old >= 0){
100+ for(h = old; h < height; h++){
101+ ctl->sheets[h] = ctl->sheets[h + 1];
102+ ctl->sheets[h]->height = h;
103+ }
104+ ctl->sheets[height]= sht;
105+ } else {
106+ for(h = ctl->top; h >= height; h--){
107+ ctl->sheets[h + 1] = ctl->sheets[h];
108+ ctl->sheets[h + 1]->height = h;
109+ }
110+ ctl->sheets[height] = sht;
111+ ctl->top++;
112+ }
113+ sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);
114+ sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height);
115+ }
116+
117+ return;
118+}
119+
120+void sheet_refresh(UI_Sheet *sht, int bx0, int by0, int bx1, int by1)
121+{
122+ if(sht->height >= 0){
123+ sheet_refreshsub(sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1 , sht->height, sht->height);
124+ }
125+
126+ return;
127+}
128+
129+void sheet_refresh_full_alpha(UI_Sheet *sht)
130+{
131+ sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, sht->height);
132+ sheet_refresh_full(sht);
133+
134+ return;
135+}
136+
137+void sheet_refresh_full(UI_Sheet *sht)
138+{
139+ sheet_refresh(sht, 0, 0, sht->bxsize, sht->bysize);
140+
141+ return;
142+}
143+
144+void sheet_slide(UI_Sheet *sht, int vx0, int vy0)
145+{
146+ int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
147+
148+ sht->vx0 = vx0;
149+ sht->vy0 = vy0;
150+ if(sht->height >= 0) {
151+ sheet_refreshmap(old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize,0);
152+ sheet_refreshmap(vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize,sht->height);
153+ sheet_refreshsub(old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize,0,sht->height - 1);
154+ sheet_refreshsub(vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize,sht->height, sht->height);
155+ }
156+
157+ return;
158+}
159+
160+void sheet_free(UI_Sheet *sht)
161+{
162+ if(sht->height >= 0) sheet_updown(sht, -1);
163+ sht->flags = initialized;
164+
165+ return;
166+}
167+
168+void sheet_refreshsub32(int vx0, int vy0, int vx1, int vy1, int h0, int h1)
169+{
170+ int h, bx, by, vx, vy, bx0, by0, bx1, by1;
171+ uint *map = ctl->map,sid;
172+ uint *buf, *vram = (uint *)ctl->vram;
173+ UI_Sheet *sht;
174+
175+ if(vx0 < 0) vx0 = 0;
176+ if(vy0 < 0) vy0 = 0;
177+ if(vx1 > ctl->xsize) vx1 = ctl->xsize;
178+ if(vy1 > ctl->ysize) vy1 = ctl->ysize;
179+ for(h = 0; h <= ctl->top; h++){
180+ sht = ctl->sheets[h];
181+ buf = sht->buf;
182+ sid = sht - ctl->sheets0;
183+ bx0 = vx0 - sht->vx0;
184+ by0 = vy0 - sht->vy0;
185+ bx1 = vx1 - sht->vx0;
186+ by1 = vy1 - sht->vy0;
187+ if(bx0 < 0) bx0 = 0;
188+ if(by0 < 0) by0 = 0;
189+ if(bx1 > sht->bxsize) bx1 = sht->bxsize;
190+ if(by1 > sht->bysize) by1 = sht->bysize;
191+ for(by = by0; by < by1; by++){
192+ vy = sht->vy0 + by;
193+ for(bx = bx0; bx < bx1; bx++){
194+ vx = sht->vx0 + bx;
195+ if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx];
196+ }
197+ }
198+ }
199+
200+ return;
201+}
202+
203+void sheet_refreshsub16(int vx0, int vy0, int vx1, int vy1, int h0, int h1)
204+{
205+ int h, bx, by, vx, vy, bx0, by0, bx1, by1;
206+ uint *map = ctl->map,sid;
207+ ushort *buf, *vram = (ushort *)ctl->vram;
208+ UI_Sheet *sht;
209+
210+ if(vx0 < 0) vx0 = 0;
211+ if(vy0 < 0) vy0 = 0;
212+ if(vx1 > ctl->xsize) vx1 = ctl->xsize;
213+ if(vy1 > ctl->ysize) vy1 = ctl->ysize;
214+ for(h = 0; h <= ctl->top; h++){
215+ sht = ctl->sheets[h];
216+ buf = sht->buf;
217+ sid = sht - ctl->sheets0;
218+ bx0 = vx0 - sht->vx0;
219+ by0 = vy0 - sht->vy0;
220+ bx1 = vx1 - sht->vx0;
221+ by1 = vy1 - sht->vy0;
222+ if(bx0 < 0) bx0 = 0;
223+ if(by0 < 0) by0 = 0;
224+ if(bx1 > sht->bxsize) bx1 = sht->bxsize;
225+ if(by1 > sht->bysize) by1 = sht->bysize;
226+ for(by = by0; by < by1; by++){
227+ vy = sht->vy0 + by;
228+ for(bx = bx0; bx < bx1; bx++){
229+ vx = sht->vx0 + bx;
230+ if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx];
231+ }
232+ }
233+ }
234+
235+ return;
236+}
237+
238+void sheet_refreshsub8(int vx0, int vy0, int vx1, int vy1, int h0, int h1)
239+{
240+ int h, bx, by, vx, vy, bx0, by0, bx1, by1;
241+ uint *map = ctl->map,sid;
242+ uchar *buf, *vram = (uchar *)ctl->vram;
243+ UI_Sheet *sht;
244+
245+ if(vx0 < 0) vx0 = 0;
246+ if(vy0 < 0) vy0 = 0;
247+ if(vx1 > ctl->xsize) vx1 = ctl->xsize;
248+ if(vy1 > ctl->ysize) vy1 = ctl->ysize;
249+ for(h = 0; h <= ctl->top; h++){
250+ sht = ctl->sheets[h];
251+ buf = sht->buf;
252+ sid = sht - ctl->sheets0;
253+ bx0 = vx0 - sht->vx0;
254+ by0 = vy0 - sht->vy0;
255+ bx1 = vx1 - sht->vx0;
256+ by1 = vy1 - sht->vy0;
257+ if(bx0 < 0) bx0 = 0;
258+ if(by0 < 0) by0 = 0;
259+ if(bx1 > sht->bxsize) bx1 = sht->bxsize;
260+ if(by1 > sht->bysize) by1 = sht->bysize;
261+ for(by = by0; by < by1; by++){
262+ vy = sht->vy0 + by;
263+ for(bx = bx0; bx < bx1; bx++){
264+ vx = sht->vx0 + bx;
265+ if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx];
266+ }
267+ }
268+ }
269+
270+ return;
271+}
272+
273+void sheet_refreshmap32(int vx0, int vy0, int vx1, int vy1, int h0)
274+{
275+ int h, bx, by, vx, vy, bx0, by0, bx1, by1;
276+ uint sid, *map = ctl->map;
277+ uint *buf;
278+ UI_Sheet *sht;
279+
280+ if(vx0 < 0) vx0 = 0;
281+ if(vy0 < 0) vy0 = 0;
282+ if(vx1 > ctl->xsize) vx1 = ctl->xsize;
283+ if(vy1 > ctl->ysize) vy1 = ctl->ysize;
284+ for(h = 0; h <= ctl->top; h++){
285+ sht = ctl->sheets[h];
286+ sid = sht - ctl->sheets0;
287+ buf = sht->buf;
288+ bx0 = vx0 - sht->vx0;
289+ by0 = vy0 - sht->vy0;
290+ bx1 = vx1 - sht->vx0;
291+ by1 = vy1 - sht->vy0;
292+ if(bx0 < 0) bx0 = 0;
293+ if(by0 < 0) by0 = 0;
294+ if(bx1 > sht->bxsize) bx1 = sht->bxsize;
295+ if(by1 > sht->bysize) by1 = sht->bysize;
296+ for(by = by0; by < by1; by++){
297+ vy = sht->vy0 + by;
298+ for(bx = bx0; bx < bx1; bx++){
299+ vx = sht->vx0 + bx;
300+ if(buf[by * sht->bxsize + bx] != INV_COL32) map[vy * ctl->xsize + vx] = sid;
301+ }
302+ }
303+ }
304+
305+ return;
306+}
307+
308+void sheet_refreshmap16(int vx0, int vy0, int vx1, int vy1, int h0)
309+{
310+ int h, bx, by, vx, vy, bx0, by0, bx1, by1;
311+ uint sid, *map = ctl->map;
312+ ushort *buf;
313+ UI_Sheet *sht;
314+
315+ if(vx0 < 0) vx0 = 0;
316+ if(vy0 < 0) vy0 = 0;
317+ if(vx1 > ctl->xsize) vx1 = ctl->xsize;
318+ if(vy1 > ctl->ysize) vy1 = ctl->ysize;
319+ for(h = 0; h <= ctl->top; h++){
320+ sht = ctl->sheets[h];
321+ sid = sht - ctl->sheets0;
322+ buf = sht->buf;
323+ bx0 = vx0 - sht->vx0;
324+ by0 = vy0 - sht->vy0;
325+ bx1 = vx1 - sht->vx0;
326+ by1 = vy1 - sht->vy0;
327+ if(bx0 < 0) bx0 = 0;
328+ if(by0 < 0) by0 = 0;
329+ if(bx1 > sht->bxsize) bx1 = sht->bxsize;
330+ if(by1 > sht->bysize) by1 = sht->bysize;
331+ for(by = by0; by < by1; by++){
332+ vy = sht->vy0 + by;
333+ for(bx = bx0; bx < bx1; bx++){
334+ vx = sht->vx0 + bx;
335+ if(buf[by * sht->bxsize + bx] != INV_COL16) map[vy * ctl->xsize + vx] = sid;
336+ }
337+ }
338+ }
339+
340+ return;
341+}
342+
343+void sheet_refreshmap8(int vx0, int vy0, int vx1, int vy1, int h0)
344+{
345+ int h, bx, by, vx, vy, bx0, by0, bx1, by1;
346+ uint sid, *map = ctl->map;
347+ uchar *buf;
348+ UI_Sheet *sht;
349+
350+ if(vx0 < 0) vx0 = 0;
351+ if(vy0 < 0) vy0 = 0;
352+ if(vx1 > ctl->xsize) vx1 = ctl->xsize;
353+ if(vy1 > ctl->ysize) vy1 = ctl->ysize;
354+ for(h = 0; h <= ctl->top; h++){
355+ sht = ctl->sheets[h];
356+ sid = sht - ctl->sheets0;
357+ buf = sht->buf;
358+ bx0 = vx0 - sht->vx0;
359+ by0 = vy0 - sht->vy0;
360+ bx1 = vx1 - sht->vx0;
361+ by1 = vy1 - sht->vy0;
362+ if(bx0 < 0) bx0 = 0;
363+ if(by0 < 0) by0 = 0;
364+ if(bx1 > sht->bxsize) bx1 = sht->bxsize;
365+ if(by1 > sht->bysize) by1 = sht->bysize;
366+ for(by = by0; by < by1; by++){
367+ vy = sht->vy0 + by;
368+ for(bx = bx0; bx < bx1; bx++){
369+ vx = sht->vx0 + bx;
370+ if(buf[by * sht->bxsize + bx] != INV_COL8) map[vy * ctl->xsize + vx] = sid;
371+ }
372+ }
373+ }
374+
375+ return;
376+}
--- beta/tolset_chn_000/chnos_008/chnos/graphic.c (revision 204)
+++ beta/tolset_chn_000/chnos_008/chnos/graphic.c (revision 205)
@@ -47,7 +47,6 @@
4747 "***.....................",
4848 };
4949
50-/*
5150 void putfonts_asc_sht_i(UI_Sheet *sht, int x, int y, uint c, uint bc, const uchar *s)
5251 {
5352 int l;
@@ -66,7 +65,6 @@
6665 sheet_refresh(sht, x, y, x + l * 8, y + 16);
6766 return;
6867 }
69-*/
7068
7169 void init_screen_i(void *desktop, void *taskbar, void *mousecursor)
7270 {
@@ -107,15 +105,17 @@
107105 void init_taskbar_i(void *vrami)
108106 {
109107 uchar bpp;
108+ uint xsize;
110109
111110 bpp = system.data.info.vesa.BitsPerPixel;
111+ xsize = system.data.info.boot.scrnx;
112112
113113 if(bpp == 8){
114- init_taskbar8(vrami, bpp);
114+ init_taskbar8(vrami, xsize);
115115 } else if(bpp == 16){
116- init_taskbar16(vrami, bpp);
116+ init_taskbar16(vrami, xsize);
117117 } else if(bpp == 32){
118- init_taskbar32(vrami, bpp);
118+ init_taskbar32(vrami, xsize);
119119 }
120120 return;
121121 }
@@ -191,9 +191,6 @@
191191
192192 void boxfill_i(void *vrami, int xsize, uint c, int x0, int y0, int x1, int y1)
193193 {
194- y1 -= 1;
195- x1 -= 1;
196-
197194 if(system.data.info.vesa.BitsPerPixel == 8){
198195 uchar c8 = rgb_int2char(c);
199196 boxfill8(vrami, xsize, c8, x0, y0, x1, y1);
--- beta/tolset_chn_000/chnos_008/chnos/Makefile (revision 204)
+++ beta/tolset_chn_000/chnos_008/chnos/Makefile (revision 205)
@@ -1,6 +1,6 @@
11
22 #OBJS_BOOTPACK = naskfunc.obj hankaku.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj gdtidt.obj int.obj io.obj fifo.obj keyboard.obj timer.obj mouse.obj memory.obj sheet.obj window.obj system.obj bootpack.obj
3-OBJS_BOOTPACK = naskfunc.obj hankaku.obj gdtidt.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj init.obj intrpt.obj io.obj memory.obj paging.obj bootpack.obj
3+OBJS_BOOTPACK = naskfunc.obj hankaku.obj gdtidt.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj init.obj intrpt.obj io.obj memory.obj paging.obj sheet.obj bootpack.obj
44 TOOLPATH = ../../z_tools/
55 INCPATH = ../../z_tools/CHNOSProject/
66
--- beta/tolset_chn_000/chnos_008/chnos/grap_32.c (revision 204)
+++ beta/tolset_chn_000/chnos_008/chnos/grap_32.c (revision 205)
@@ -5,6 +5,9 @@
55 {
66 int x, y;
77
8+ y1 -= 1;
9+ x1 -= 1;
10+
811 for (y = y0;y <= y1;y++) {
912 for (x = x0; x <= x1; x++)
1013 vram[y * xsize + x] = c;
@@ -16,9 +19,6 @@
1619 void init_desktop32(uint *vram, uint xsize, uint ysize)
1720 {
1821 boxfill32(vram, xsize, DESKTOP_COL32, 0, 0, xsize, ysize);
19- putfonts32_asc(vram, xsize, 168, 8, 0xFFFFFF, "welcome to CHNOSProject! on 32bit video mode .");
20- putfonts32_asc(vram, xsize, 168, 24, 0xFFFFFF, "ヨウコソ CHNOSプロジェクトヘ!");
21- putfonts32_asc(vram, xsize, 168, 40, 0xFFFFFF, "カタコトデスガ ニホンゴガ カケルヨウニ ナリマシタ");
2222
2323 return;
2424 }
@@ -25,9 +25,9 @@
2525
2626 void init_taskbar32(uint *vram, uint xsize)
2727 {
28- boxfill32(vram, xsize, TASKBAR_COL32, 0, 0, xsize, TASKBAR_HEIGHT);
29- boxfill32(vram, xsize, 0xFFFFFF, 0, 0, xsize, 1);
30- boxfill32(vram, xsize, 0xFFFFFF, xsize-2, 0, xsize, TASKBAR_HEIGHT);
28+ boxfill32(vram, xsize, 0xFFFFFF, 0, 0, xsize, TASKBAR_HEIGHT);
29+ boxfill32(vram, xsize, 0xFFFFFF, 0, 0, xsize - 2, TASKBAR_HEIGHT - 2);
30+ boxfill32(vram, xsize, TASKBAR_COL32, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2);
3131
3232 return;
3333 }
--- beta/tolset_chn_000/chnos_008/chnos/core.h (revision 204)
+++ beta/tolset_chn_000/chnos_008/chnos/core.h (revision 205)
@@ -96,6 +96,13 @@
9696
9797 #define MEMMAN_FREES 4000
9898
99+#define INV_COL32 0xFFFFFFFF
100+#define INV_COL16 0x1192
101+#define INV_COL8 0xFF
102+
103+#define MAX_SHEETS 1024
104+
105+
99106 /*new object types*/
100107 typedef enum _bool { false, true} bool;
101108 typedef enum _state_alloc { none, initialized, allocated, configured, inuse} state_alloc;
@@ -166,6 +173,21 @@
166173 } free[MEMMAN_FREES];
167174 };
168175
176+struct SHEET {
177+ void *buf;
178+ uint col_inv;
179+ int bxsize, bysize, vx0, vy0, height;
180+ state_alloc flags;
181+};
182+
183+struct SHTCTL {
184+ uint *map;
185+ void *vram;
186+ int xsize,ysize,top;
187+ struct SHEET *sheets[MAX_SHEETS];
188+ struct SHEET sheets0[MAX_SHEETS];
189+};
190+
169191 /*typedef structures*/
170192 typedef struct BOOTINFO DATA_BootInfo;
171193 typedef struct VESAINFO DATA_VESAInfo;
@@ -172,6 +194,8 @@
172194 typedef struct SEGMENT_DESCRIPTOR IO_SegmentDescriptor;
173195 typedef struct GATE_DESCRIPTOR IO_GateDescriptor;
174196 typedef struct MEMMAN IO_MemoryControl;
197+typedef struct SHEET UI_Sheet;
198+typedef struct SHTCTL UI_SheetControl;
175199
176200 /*virtual classes*/
177201 struct SYSTEM {
@@ -191,6 +215,18 @@
191215 IO_GateDescriptor *idt;
192216 } interrupt;
193217 } io;
218+ struct SYS_DRAW {
219+ struct SYS_DRAW_SHT {
220+ UI_Sheet *core;
221+ UI_Sheet *desktop;
222+ UI_Sheet *taskbar;
223+ UI_Sheet *mouse;
224+ void *core_buf;
225+ void *desktop_buf;
226+ void *taskbar_buf;
227+ void *mouse_buf;
228+ } sht;
229+ } draw;
194230 struct SYS_DATA {
195231 struct SYS_DATA_INFO {
196232 DATA_BootInfo boot;
@@ -229,6 +265,10 @@
229265 uchar rgb_int2char (uint c32);
230266 ushort rgb_int2short (uint c32);
231267 void col_pat(void *vrami, int xsize, int ysize);
268+
269+void putfonts_asc_sht_i(UI_Sheet *sht, int x, int y, uint c, uint bc, const uchar *s);
270+void putfonts_asc_sht_i_no_bc(UI_Sheet *sht, int x, int y, uint c, const uchar *s);
271+
232272 /*08Bits*/
233273 void boxfill8(uchar *vram, int xsize, uchar c, int x0, int y0, int x1, int y1);
234274 void init_desktop8(uchar *vram, uint xsize, uint ysize);
@@ -315,6 +355,22 @@
315355 void paging_set_dir(uint *dir_entry, uint *table_base, uint attribute, uint available);
316356 void paging_set_table(uint *table_entry, uint *page_base, uint attribute, uint available);
317357
358+/*sheet.c*/
359+void init_sheets(void *vram, int xsize, int ysize, uchar bits);
360+UI_Sheet *sheet_alloc(void);
361+void sheet_setbuf(UI_Sheet *sht, void *buf,int xsize, int ysize, uint col_inv);
362+void sheet_updown(UI_Sheet *sht, int height);
363+void sheet_refresh(UI_Sheet *sht, int bx0, int by0, int bx1, int by1);
364+void sheet_refresh_full_alpha(UI_Sheet *sht);
365+void sheet_refresh_full(UI_Sheet *sht);
366+void sheet_slide(UI_Sheet *sht, int vx0, int vy0);
367+void sheet_free(UI_Sheet *sht);
368+void sheet_refreshsub32(int vx0, int vy0, int vx1, int vy1, int h0, int h1);
369+void sheet_refreshsub16(int vx0, int vy0, int vx1, int vy1, int h0, int h1);
370+void sheet_refreshsub8(int vx0, int vy0, int vx1, int vy1, int h0, int h1);
371+void sheet_refreshmap32(int vx0, int vy0, int vx1, int vy1, int h0);
372+void sheet_refreshmap16(int vx0, int vy0, int vx1, int vy1, int h0);
373+void sheet_refreshmap8(int vx0, int vy0, int vx1, int vy1, int h0);
318374
319375 /* naskfunc.nas */
320376 void pipelineflush(void);
Show on old repository browser