pixlib 0.1

git-svn-id: svn://kolibrios.org@880 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-10-18 09:23:53 +00:00
parent b3fee1b5e7
commit 869e8cdf52
7 changed files with 2655 additions and 2052 deletions

View File

@ -42,8 +42,8 @@ WRect
WFileName WFileName
10 10
clib_r.tgt clib_r.tgt
21 309
50 342
11 11
VComponent VComponent
12 12
@ -59,5 +59,5 @@ WFileName
7 7
crt.tgt crt.tgt
0 0
12 8
8 8

File diff suppressed because it is too large Load Diff

View File

@ -294,7 +294,7 @@ WString
COBJ COBJ
70 70
WVList WVList
15 14
71 71
MVState MVState
72 72
@ -367,8 +367,8 @@ WString
WCC WCC
89 89
WString WString
33 30
?????Disable stack depth checking ?????Call/return optimizations
1 1
1 1
90 90
@ -379,22 +379,22 @@ WString
WCC WCC
92 92
WString WString
30 25
?????Call/return optimizations ?????Relax alias checking
1 1
1 1
93 93
MCState MRState
94 94
WString WString
3 3
WCC WCC
95 95
WString WString
25 21
?????Relax alias checking ?????Compiler default
1
1 1
0
96 96
MRState MRState
97 97
@ -415,10 +415,10 @@ WString
WCC WCC
101 101
WString WString
21 37
?????Compiler default ?????In-line Pentium Pro instructions
1
1 1
0
102 102
MRState MRState
103 103
@ -427,10 +427,10 @@ WString
WCC WCC
104 104
WString WString
37 21
?????In-line Pentium Pro instructions ?????Compiler default
1
1 1
0
105 105
MRState MRState
106 106
@ -439,10 +439,10 @@ WString
WCC WCC
107 107
WString WString
21 29
?????Compiler default ?????In-line with coprocessor
1
1 1
0
108 108
MRState MRState
109 109
@ -451,10 +451,10 @@ WString
WCC WCC
110 110
WString WString
29 21
?????In-line with coprocessor ??2??32bit Flat model
1
1 1
0
111 111
MRState MRState
112 112
@ -463,473 +463,461 @@ WString
WCC WCC
113 113
WString WString
21
??2??32bit Flat model
1
0
114
MRState
115
WString
3
WCC
116
WString
22 22
??2??32bit Small model ??2??32bit Small model
1 1
1 1
117 114
WVList WVList
0 0
-1 -1
1 1
1 1
0 0
118 115
MItem MItem
17 17
CLIB\CRT\8087cw.c CLIB\CRT\8087cw.c
119 116
WString WString
4 4
COBJ COBJ
120 117
WVList WVList
0 0
121 118
WVList WVList
0 0
68 68
1 1
1 1
0 0
122 119
MItem MItem
18 18
CLIB\CRT\___argc.c CLIB\CRT\___argc.c
123 120
WString WString
4 4
COBJ COBJ
124 121
WVList WVList
0 0
125 122
WVList WVList
0 0
68 68
1 1
1 1
0 0
126 123
MItem MItem
16 16
CLIB\CRT\_exit.c CLIB\CRT\_exit.c
127 124
WString WString
4 4
COBJ COBJ
128 125
WVList WVList
0 0
129 126
WVList WVList
0 0
68 68
1 1
1 1
0 0
130 127
MItem MItem
16 16
CLIB\CRT\abort.c CLIB\CRT\abort.c
131 128
WString WString
4 4
COBJ COBJ
132 129
WVList WVList
0 0
133 130
WVList WVList
0 0
68 68
1 1
1 1
0 0
134 131
MItem MItem
16 16
CLIB\CRT\argcv.c CLIB\CRT\argcv.c
135 132
WString WString
4 4
COBJ COBJ
136 133
WVList WVList
0 0
137 134
WVList WVList
0 0
68 68
1 1
1 1
0 0
138 135
MItem MItem
17 17
CLIB\CRT\atexit.c CLIB\CRT\atexit.c
139 136
WString WString
4 4
COBJ COBJ
140 137
WVList WVList
0 0
141 138
WVList WVList
0 0
68 68
1 1
1 1
0 0
142 139
MItem MItem
18 18
CLIB\CRT\binmode.c CLIB\CRT\binmode.c
143 140
WString WString
4 4
COBJ COBJ
144 141
WVList WVList
0 0
145 142
WVList WVList
0 0
68 68
1 1
1 1
0 0
146 143
MItem MItem
18 18
CLIB\CRT\chk8087.c CLIB\CRT\chk8087.c
147 144
WString WString
4 4
COBJ COBJ
148 145
WVList WVList
0 0
149 146
WVList WVList
0 0
68 68
1 1
1 1
0 0
150 147
MItem MItem
16 16
CLIB\CRT\cinit.c CLIB\CRT\cinit.c
151 148
WString WString
4 4
COBJ COBJ
152 149
WVList WVList
0 0
153 150
WVList WVList
0 0
68 68
1 1
1 1
0 0
154 151
MItem MItem
18 18
CLIB\CRT\cmdname.c CLIB\CRT\cmdname.c
155 152
WString WString
4 4
COBJ COBJ
156 153
WVList WVList
0 0
157 154
WVList WVList
0 0
68 68
1 1
1 1
0 0
158 155
MItem MItem
18 18
CLIB\CRT\commode.c CLIB\CRT\commode.c
159 156
WString WString
4 4
COBJ COBJ
160 157
WVList WVList
0 0
161 158
WVList WVList
0 0
68 68
1 1
1 1
0 0
162 159
MItem MItem
17 17
CLIB\CRT\cvtbuf.c CLIB\CRT\cvtbuf.c
163 160
WString WString
4 4
COBJ COBJ
164 161
WVList WVList
0 0
165 162
WVList WVList
0 0
68 68
1 1
1 1
0 0
166 163
MItem MItem
16 16
CLIB\CRT\errno.c CLIB\CRT\errno.c
167 164
WString WString
4 4
COBJ COBJ
168 165
WVList WVList
0 0
169 166
WVList WVList
0 0
68 68
1 1
1 1
0 0
170 167
MItem MItem
19 19
CLIB\CRT\errnovar.c CLIB\CRT\errnovar.c
171 168
WString WString
4 4
COBJ COBJ
172 169
WVList WVList
0 0
173 170
WVList WVList
0 0
68 68
1 1
1 1
0 0
174 171
MItem MItem
15 15
CLIB\CRT\exit.c CLIB\CRT\exit.c
175 172
WString WString
4 4
COBJ COBJ
176 173
WVList WVList
0 0
177 174
WVList WVList
0 0
68 68
1 1
1 1
0 0
178 175
MItem MItem
18 18
CLIB\CRT\fltused.c CLIB\CRT\fltused.c
179 176
WString WString
4 4
COBJ COBJ
180 177
WVList WVList
0 0
181 178
WVList WVList
0 0
68 68
1 1
1 1
0 0
182 179
MItem MItem
19 19
CLIB\CRT\fpexcept.c CLIB\CRT\fpexcept.c
183 180
WString WString
4 4
COBJ COBJ
184 181
WVList WVList
0 0
185 182
WVList WVList
0 0
68 68
1 1
1 1
0 0
186 183
MItem MItem
19 19
CLIB\CRT\initargv.c CLIB\CRT\initargv.c
187 184
WString WString
4 4
COBJ COBJ
188 185
WVList WVList
0 0
189 186
WVList WVList
0 0
68 68
1 1
1 1
0 0
190 187
MItem MItem
19 19
CLIB\CRT\initrtns.c CLIB\CRT\initrtns.c
191 188
WString WString
4 4
COBJ COBJ
192 189
WVList WVList
0 0
193 190
WVList WVList
0 0
68 68
1 1
1 1
0 0
194 191
MItem MItem
17 17
CLIB\CRT\ioexit.c CLIB\CRT\ioexit.c
195 192
WString WString
4 4
COBJ COBJ
196 193
WVList WVList
0 0
197 194
WVList WVList
0 0
68 68
1 1
1 1
0 0
198 195
MItem MItem
18 18
CLIB\CRT\ljmphdl.c CLIB\CRT\ljmphdl.c
199 196
WString WString
4 4
COBJ COBJ
200 197
WVList WVList
0 0
201 198
WVList WVList
0 0
68 68
1 1
1 1
0 0
202 199
MItem MItem
19 19
CLIB\CRT\main2wnt.c CLIB\CRT\main2wnt.c
203 200
WString WString
4 4
COBJ COBJ
204 201
WVList WVList
0 0
205 202
WVList WVList
0 0
68 68
1 1
1 1
0 0
206 203
MItem MItem
19 19
CLIB\CRT\seterrno.c CLIB\CRT\seterrno.c
207 204
WString WString
4 4
COBJ COBJ
208 205
WVList WVList
0 0
209 206
WVList WVList
0 0
68 68
1 1
1 1
0 0
210 207
MItem MItem
19 19
CLIB\CRT\stackwnt.c CLIB\CRT\stackwnt.c
211 208
WString WString
4 4
COBJ COBJ
212 209
WVList WVList
0 0
213 210
WVList WVList
0 0
68 68
1 1
1 1
0 0
214 211
MItem MItem
18 18
CLIB\CRT\xmsgwnt.c CLIB\CRT\xmsgwnt.c
215 212
WString WString
4 4
COBJ COBJ
216 213
WVList WVList
0 0
217 214
WVList WVList
0 0
68 68

View File

@ -0,0 +1,270 @@
include 'proc32.inc'
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd mem
dd mem
dd 0
dd 0
include 'pixlib.inc'
align 4
start:
call load_pxlib
test eax, eax
jz .fail
sub esp, 1024
mov eax, 9
mov ebx, esp
mov ecx, -1
int 0x40
movzx ecx, word [esp+0x1E]
mov eax, 18
mov ebx, 21
int 0x40
mov [slot], eax
add esp, 1024
mov eax,48 ; get system colors
mov ebx,3
mov ecx,sc
mov edx,10*4
int 0x40
.redraw:
call draw_window
.wait_event:
mov eax, 18
mov ebx, 7
int 0x40
cmp eax, [slot]
jne .skip_draw
sub esp, 1024
mov eax, 9
mov ebx, esp
mov ecx, -1
int 0x40
mov edx, [esp+0x22]; xwin
mov ecx, [esp+0x26]; ywin
add edx, [esp+0x36]
add ecx, [esp+0x3A]
mov eax, [esp+0x3E]
mov ebx, [esp+0x42]
add esp, 1024
test eax, eax
jle .skip_draw
test ebx, ebx
jle .skip_draw
push ebx
push eax
push ecx
push edx
call _Draw
add esp, 16
.skip_draw:
; mov ebx, 1
; mov eax, 23
; int 0x40
mov eax, 11
int 0x40
dec eax ; if event = 1
js .wait_event
jz .redraw ; jump to redraw handler
dec eax ; else if event = 2
jz .key ; jump to key handler
dec eax
jz .button
jmp .wait_event
.button: ; button event handler
mov al, 17 ; get button identifier
int 0x40
cmp ah, 1
jne .wait_event ; return if button id != 1
.exit:
; restore old screen and cleanup
.fail:
or eax, -1 ; exit application
int 0x40
.key: ; key event handler
mov al, 2 ; get key code
int 0x40
jmp .wait_event
draw_window:
mov eax, 12 ; start drawing
mov ebx, 1
int 0x40
xor eax, eax ; create and draw the window
mov ebx, 100*65536+320 ; (window_cx)*65536+(window_sx)
mov ecx, 100*65536+240 ; (window_cy)*65536+(window_sy)
mov edx, [sc.work] ; work area color
or edx, 0x33000000 ; & window type 3
mov edi, title ; window title
int 0x40
mov eax, 12 ; finish drawing
mov ebx, 2
int 0x40
ret
DWORD equ dword
PTR equ
_Draw:
push ebp
xor edx, edx
push edi
push esi
push ebx
sub esp, 44
imul eax, DWORD PTR [_glSeed], 69069
mov ebp, DWORD PTR [esp+72]
mov ecx, DWORD PTR [esp+76]
inc eax
mov DWORD PTR [esp+32], eax
imul eax, eax, 69069
inc eax
mov DWORD PTR [esp+36], eax
imul eax, eax, 69069
inc eax
mov DWORD PTR [esp+40], eax
imul eax, eax, 69069
lea ebx, [eax+1]
mov eax, ebx
div ebp
imul eax, ebx, 69069
lea ebx, [eax+1]
mov eax, ebx
mov edi, edx
xor edx, edx
div ecx
imul eax, ebx, 69069
lea ebx, [eax+1]
mov eax, ebx
mov esi, edx
xor edx, edx
div ebp
imul eax, ebx, 69069
inc eax
mov DWORD PTR [_glSeed], eax
mov ebp, edx
mov DWORD PTR [esp+28], edx
xor edx, edx
div ecx
cmp ebp, edi
mov ebx, edx
jge L2
mov DWORD PTR [esp+28], edi
mov edi, ebp
L2:
cmp ebx, esi
jge L4
mov ebx, esi
mov esi, edx
L4:
push eax
mov ecx, 255
push -16777216
mov eax, DWORD PTR [esp+40]
xor edx, edx
div ecx
mov eax, DWORD PTR [esp+48]
mov ebp, edx
xor edx, edx
div ecx
mov eax, DWORD PTR [esp+44]
sal ebp, 16
or ebp, -16777216
mov DWORD PTR [esp+8], edx
or ebp, edx
xor edx, edx
div ecx
lea eax, [ebx+1]
sub eax, esi
sal edx, 8
or ebp, edx
push ebp
push eax
mov eax, DWORD PTR [esp+44]
inc eax
sub eax, edi
push eax
mov eax, esi
add eax, DWORD PTR [esp+88]
push eax
mov eax, edi
add eax, DWORD PTR [esp+88]
push eax
push -1
call [imp_DrawRect]
add esp, 76
pop ebx
pop esi
pop edi
pop ebp
ret
align 4
count dd 0
_glSeed dd -365387184
title db 'Draw rect demo',0
i_end:
align 4
slot rd 1
sc system_colors
align 16
rb 2048 ;stack
mem:

View File

@ -0,0 +1,278 @@
include 'proc32.inc'
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd mem
dd mem
dd 0
dd 0
include 'pixlib.inc'
align 4
start:
call load_pxlib
test eax, eax
jz .fail
sub esp, 1024
mov eax, 9
mov ebx, esp
mov ecx, -1
int 0x40
movzx ecx, word [esp+0x1E]
mov eax, 18
mov ebx, 21
int 0x40
mov [slot], eax
add esp, 1024
mov eax,48 ; get system colors
mov ebx,3
mov ecx,sc
mov edx,10*4
int 0x40
CreateHatch HS_CROSS, 0xFFFFFFFF, 0xFF000000
mov [br_cross], eax
CreateHatch HS_DIAGCROSS, 0xFFFFFFFF, 0xFF000000
mov [br_dcross], eax
CreateHatch HS_HORIZONTAL, 0xFFFFFFFF, 0xFF000000
mov [br_horz], eax
CreateHatch HS_VERTICAL, 0xFFFFFFFF, 0xFF000000
mov [br_vert], eax
CreateHatch HS_FDIAGONAL, 0xFFFFFFFF, 0xFF000000
mov [br_fd], eax
CreateHatch HS_BDIAGONAL, 0xFFFFFFFF, 0xFF000000
mov [br_bd], eax
.redraw:
call draw_window
.wait_event:
mov eax, 18
mov ebx, 7
int 0x40
cmp eax, [slot]
jne .skip_draw
sub esp, 1024
mov eax, 9
mov ebx, esp
mov ecx, -1
int 0x40
mov edx, [esp+0x22]; xwin
mov ecx, [esp+0x26]; ywin
add edx, [esp+0x36]
add ecx, [esp+0x3A]
mov eax, [esp+0x3E] ;width
mov ebx, [esp+0x42] ;height
add esp, 1024
cmp eax, 50
jle .skip_draw
cmp ebx, 40
jle .skip_draw
push ebx
push eax
push ecx
push edx
call _Draw
add esp, 16
.skip_draw:
mov ebx, 1000
mov eax, 23
int 0x40
; mov eax, 11
; int 0x40
dec eax ; if event = 1
; js .wait_event
jz .redraw ; jump to redraw handler
dec eax ; else if event = 2
jz .key ; jump to key handler
dec eax
jz .button
jmp .wait_event
.button: ; button event handler
mov al, 17 ; get button identifier
int 0x40
cmp ah, 1
jne .wait_event ; return if button id != 1
.exit:
; restore old screen and cleanup
.fail:
or eax, -1 ; exit application
int 0x40
.key: ; key event handler
mov al, 2 ; get key code
int 0x40
jmp .wait_event
draw_window:
mov eax, 12 ; start drawing
mov ebx, 1
int 0x40
xor eax, eax ; create and draw the window
mov ebx, 100*65536+320 ; (window_cx)*65536+(window_sx)
mov ecx, 100*65536+240 ; (window_cy)*65536+(window_sy)
mov edx, [sc.work] ; work area color
or edx, 0x33000000 ; & window type 3
mov edi, title ; window title
int 0x40
mov eax, 12 ; finish drawing
mov ebx, 2
int 0x40
ret
DWORD equ dword
PTR equ
_Draw:
push ebp
push edi
push esi
push ebx
mov ebx, 1431655766
sub esp, 44
mov esi, DWORD PTR [esp+72]
mov ecx, DWORD PTR [esp+76]
mov DWORD PTR [esp+24], -16777216
mov DWORD PTR [esp], -1
lea edi, [esi-40]
mov eax, edi
imul ebx
sar edi, 31
lea eax, [ecx-30]
sub ecx, 10
mov ebp, edx
sub ebp, edi
mov edi, eax
shr edi, 31
add edi, eax
lea edx, [esi-20]
lea eax, [ebp+ebp*2]
sub edx, eax
mov esi, edx
shr esi, 31
add esi, edx
sar esi, 1
add esi, DWORD PTR [esp+64]
sar edi, 1
lea eax, [ebp+10+esi]
mov DWORD PTR [esp+32], eax
lea eax, [edi+edi]
sub ecx, eax
mov ebx, ecx
shr ebx, 31
add ebx, ecx
sar ebx, 1
add ebx, DWORD PTR [esp+68]
lea edx, [esi+20+ebp*2]
mov DWORD PTR [esp+36], edx
lea eax, [ebx+10+edi]
mov DWORD PTR [esp+40], eax
FillRect -1, esi, ebx,ebp, edi, [br_fd], 0xFF000000
mov edx, DWORD PTR [esp+32]
FillRect -1, edx, ebx, ebp, edi, [br_cross], 0xFF000000
mov eax, DWORD PTR [esp+36]
FillRect -1, eax, ebx, ebp, edi, [br_horz],0xFF000000
mov edx, DWORD PTR [esp+40]
FillRect -1, esi, edx, ebp, edi, [br_bd], 0xFF000000
mov edx, DWORD PTR [esp+32]
mov eax, DWORD PTR [esp+40]
FillRect -1, edx, eax, ebp, edi, [br_dcross], 0xFF000000
mov edx, DWORD PTR [esp+36]
mov eax, DWORD PTR [esp+40]
FillRect -1, edx, eax, ebp, edi, [br_vert], 0xFF000000
call [imp_FillRect]
add esp, 44
pop ebx
pop esi
pop edi
pop ebp
ret
align 4
count dd 0
title db 'Hatches',0
i_end:
align 4
slot rd 1
br_fd rd 1
br_bd rd 1
br_cross rd 1
br_dcross rd 1
br_horz rd 1
br_vert rd 1
sc system_colors
align 16
rb 2048 ;stack
mem:

View File

@ -8,7 +8,14 @@ handle CreateHatchBrush(int hatch, color_t bkcolor, color_t fcolor);
Создать штрихованную кисть размером 8х8 пикселей Создать штрихованную кисть размером 8х8 пикселей
hatch тип штриховки hatch тип штриховки:
HS_HORIZONTAL -------
HS_VERTICAL |||||||
HS_FDIAGONAL \\\\\\\
HS_BDIAGONAL ///////
HS_CROSS +++++++
HS_DIAGCROSS xxxxxxx
bkcolor цвет "0" bkcolor цвет "0"
@ -176,10 +183,10 @@ int Blit(handle dst_pixmap, int dst_x, int dst_y,
Скопировать прямоугольную область пикселей. Скопировать прямоугольную область пикселей.
dst_pixmap логический номер битмапа в который будет производится dst_pixmap логический номер битмапа в который будет производитс
копирование. SCR_PIXMAP для первичного экрана. копирование. SCR_PIXMAP для первичного экрана.
dst_x, dst_y координаты левого верхнего угла области назначения dst_x, dst_y координаты левого верхнего угла области назначени
src_pixmap логический номер битмапа - источника пикселей. src_pixmap логический номер битмапа - источника пикселей.
SCR_PIXMAP для первичного экрана. SCR_PIXMAP для первичного экрана.
@ -201,10 +208,10 @@ int TransparentBlit(handle dst_pixmap, int dst_x, int dst_y,
Скопировать прямоугольную область пикселей используя прозрачный цвет. Скопировать прямоугольную область пикселей используя прозрачный цвет.
dst_pixmap логический номер битмапа в который будет производится dst_pixmap логический номер битмапа в который будет производитс
копирование. SCR_PIXMAP для первичного экрана. копирование. SCR_PIXMAP для первичного экрана.
dst_x, dst_y координаты левого верхнего угла области назначения dst_x, dst_y координаты левого верхнего угла области назначени
src_pixmap логический номер битмапа - источника пикселей. src_pixmap логический номер битмапа - источника пикселей.
SCR_PIXMAP для первичного экрана. SCR_PIXMAP для первичного экрана.

View File

@ -204,14 +204,14 @@ int DrawRect(io_draw_t* draw)
OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|1); OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|1);
h--; h--;
} }
if( x0 == draw->x0) if( (h > 0) && (x0 == draw->x0))
{ {
R5xxFIFOWait(2); R5xxFIFOWait(2);
OUTREG(R5XX_DST_Y_X,(y0<<16)|x0); OUTREG(R5XX_DST_Y_X,(y0<<16)|x0);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(1<<16)|h); OUTREG(R5XX_DST_WIDTH_HEIGHT,(1<<16)|h);
} }
if( x1 == xend) if( (h > 0) && (x1 == xend))
{ {
R5xxFIFOWait(2); R5xxFIFOWait(2);
@ -332,14 +332,14 @@ int FillRect(io_fill_t *fill)
OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|1); OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|1);
h--; h--;
} }
if( x0 == fill->x) if( (h > 0) && (x0 == fill->x))
{ {
R5xxFIFOWait(2); R5xxFIFOWait(2);
OUTREG(R5XX_DST_Y_X,(y0<<16)|x0); OUTREG(R5XX_DST_Y_X,(y0<<16)|x0);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(1<<16)|h); OUTREG(R5XX_DST_WIDTH_HEIGHT,(1<<16)|h);
} }
if( x1 == xend) if( (h > 0) && (x1 == xend))
{ {
R5xxFIFOWait(2); R5xxFIFOWait(2);