Subversion Repositories Kolibri OS

Rev

Rev 5153 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5153 Rev 5159
Line 49... Line 49...
49
	add edi,[eax+offs_zbuf_pbuf] ;edi = (zb.pbuf + zb.linesize*p1.y + p1.x*PSZB)
49
	add edi,[eax+offs_zbuf_pbuf] ;edi = (zb.pbuf + zb.linesize*p1.y + p1.x*PSZB)
50
if INTERP_Z eq 1
50
if INTERP_Z eq 1
51
	mov edx,[ecx+offs_zbup_y]
51
	mov edx,[ecx+offs_zbup_y]
52
	imul edx,[sx]
52
	imul edx,[sx]
53
	add edx,[ecx+offs_zbup_x]
53
	add edx,[ecx+offs_zbup_x]
-
 
54
	shl edx,1
54
	add edx,[eax+offs_zbuf_zbuf]
55
	add edx,[eax+offs_zbuf_zbuf]
55
	mov [pz],edx ;pz = zb.zbuf + (p1.y*sx + p1.x)
56
	mov [pz],edx ;pz = zb.zbuf + (p1.y*sx + p1.x)
56
	mov edx,[ecx+offs_zbup_z]
57
	mov edx,[ecx+offs_zbup_z]
57
	mov [z],edx ;z = p1.z
58
	mov [z],edx ;z = p1.z
58
end if
59
end if
Line 97... Line 98...
97
if INTERP_Z eq 1
98
if INTERP_Z eq 1
98
local .end_0
99
local .end_0
99
	mov eax,[z]
100
	mov eax,[z]
100
	shr eax, ZB_POINT_Z_FRAC_BITS
101
	shr eax, ZB_POINT_Z_FRAC_BITS
101
	mov [zz],eax
102
	mov [zz],eax
102
	cmp eax,[pz]
103
	mov ebx,[pz]
-
 
104
	cmp ax,word[ebx]
103
	jl .end_0
105
	jl .end_0
104
		RGBPIXEL
106
		RGBPIXEL
105
		mov eax,dword[zz]
107
		mov eax,dword[zz]
-
 
108
		mov ebx,[pz]
106
		mov [pz],eax
109
		mov word[ebx],ax
107
	.end_0:
110
	.end_0:
108
else ; INTERP_Z
111
else
109
	RGBPIXEL
112
	RGBPIXEL
110
end if ; INTERP_Z
113
end if
111
}
114
}
Line 112... Line 115...
112
 
115
 
113
macro DRAWLINE d_x,d_y,inc_1,inc_2
116
macro DRAWLINE d_x,d_y,inc_1,inc_2
-
 
117
{
-
 
118
local .mz_0
-
 
119
local .mz_1
-
 
120
local .mz_2
-
 
121
local .mr_0
-
 
122
local .mr_1
-
 
123
local .mr_2
-
 
124
local .mg_0
-
 
125
local .mg_1
-
 
126
local .mg_2
-
 
127
local .mb_0
-
 
128
local .mb_1
-
 
129
local .mb_2
114
{
130
 
115
	mov eax,d_x
131
	mov eax,d_x
Line 116... Line 132...
116
	mov [n],eax
132
	mov [n],eax
117
 
133
 
118
	mov ebx,[p1]
134
	mov ebx,[p1]
119
	mov ecx,[p2]
135
	mov ecx,[p2]
-
 
136
if INTERP_Z eq 1
-
 
137
	mov eax,[ecx+offs_zbup_z]
-
 
138
	cmp eax,[ebx+offs_zbup_z]
-
 
139
	jg .mz_0
-
 
140
	je .mz_1
-
 
141
		;if(p2.z
-
 
142
		sub eax,[ebx+offs_zbup_z]
-
 
143
		neg eax
-
 
144
		inc eax
-
 
145
		xor edx,edx
-
 
146
		div dword[n]
-
 
147
		neg eax
-
 
148
		inc eax
120
if INTERP_Z eq 1
149
		jmp .mz_2
121
	mov eax,[ecx+offs_zbup_z]
150
	.mz_0:
122
	sub eax,[ebx+offs_zbup_z]
151
	sub eax,[ebx+offs_zbup_z]
-
 
152
	xor edx,edx
-
 
153
	div dword[n]
-
 
154
	jmp .mz_2
-
 
155
	.mz_1:
123
	xor edx,edx
156
		xor eax,eax
124
	div dword[n]
157
	.mz_2:
Line 125... Line 158...
125
	mov [zinc],eax ;zinc=(p2.z-p1.z)/n
158
	mov [zinc],eax ;zinc=(p2.z-p1.z)/n
126
end if
159
end if
-
 
160
 
-
 
161
	;ebx=&p1, ecx=&p2
-
 
162
	mov eax,[ecx+offs_zbup_r]
-
 
163
	cmp eax,[ebx+offs_zbup_r]
-
 
164
	jg .mr_0
-
 
165
	je .mr_1
-
 
166
		;if(p2.r
-
 
167
		sub eax,[ebx+offs_zbup_r]
-
 
168
		neg eax
-
 
169
		inc eax
-
 
170
		shl eax,8
-
 
171
		xor edx,edx
-
 
172
		div dword[n]
-
 
173
		neg eax
127
 
174
		inc eax
128
	;ebx=&p1, ecx=&p2
175
		jmp .mr_2
129
	mov eax,[ecx+offs_zbup_r]
176
	.mr_0:
130
	sub eax,[ebx+offs_zbup_r]
177
	sub eax,[ebx+offs_zbup_r]
-
 
178
	shl eax,8
-
 
179
	xor edx,edx
-
 
180
	div dword[n]
-
 
181
	jmp .mr_2
131
	shl eax,8
182
	.mr_1:
Line 132... Line 183...
132
	xor edx,edx
183
		xor eax,eax
-
 
184
	.mr_2:
-
 
185
	mov [rinc],eax ;rinc=((p2.r-p1.r)<<8)/n
-
 
186
 
-
 
187
	mov eax,[ecx+offs_zbup_g]
133
	div dword[n]
188
	cmp eax,[ebx+offs_zbup_g]
-
 
189
	jg .mg_0
-
 
190
	je .mg_1
134
	mov [rinc],eax ;rinc=((p2.r-p1.r)<<8)/n
191
		;if(p2.g
135
 
192
		sub eax,[ebx+offs_zbup_g]
136
	mov eax,[ecx+offs_zbup_g]
193
		neg eax
-
 
194
		inc eax
-
 
195
		shl eax,8
-
 
196
		xor edx,edx
-
 
197
		div dword[n]
-
 
198
		neg eax
-
 
199
		inc eax
-
 
200
		jmp .mg_2
-
 
201
	.mg_0:
-
 
202
	sub eax,[ebx+offs_zbup_g]
-
 
203
	shl eax,8
-
 
204
	xor edx,edx
-
 
205
	div dword[n]
137
	sub eax,[ebx+offs_zbup_g]
206
	jmp .mg_2
Line 138... Line 207...
138
	shl eax,8
207
	.mg_1:
-
 
208
		xor eax,eax
-
 
209
	.mg_2:
-
 
210
	mov [ginc],eax ;ginc=((p2.g-p1.g)<<8)/n
-
 
211
 
-
 
212
	mov eax,[ecx+offs_zbup_b]
-
 
213
	cmp eax,[ebx+offs_zbup_b]
-
 
214
	jg .mb_0
-
 
215
	je .mb_1
-
 
216
		;if(p2.b
-
 
217
		sub eax,[ebx+offs_zbup_b]
-
 
218
		neg eax
-
 
219
		inc eax
-
 
220
		shl eax,8
-
 
221
		xor edx,edx
139
	xor edx,edx
222
		div dword[n]
140
	div dword[n]
223
		neg eax
141
	mov [ginc],eax ;ginc=((p2.g-p1.g)<<8)/n
224
		inc eax
142
 
225
		jmp .mb_2
-
 
226
	.mb_0:
-
 
227
	sub eax,[ebx+offs_zbup_b]
-
 
228
	shl eax,8
-
 
229
	xor edx,edx
143
	mov eax,[ecx+offs_zbup_b]
230
	div dword[n]
Line 144... Line 231...
144
	sub eax,[ebx+offs_zbup_b]
231
	jmp .mb_2
145
	shl eax,8
232
	.mb_1:
146
	xor edx,edx
233
		xor eax,eax
Line 183... Line 270...
183
	cmp dword[a],0
270
	cmp dword[a],0
184
	jle .els_0
271
	jle .els_0
185
	add edi,[pp_inc_1]
272
	add edi,[pp_inc_1]
186
if INTERP_Z eq 1
273
if INTERP_Z eq 1
187
	mov eax,inc_1
274
	mov eax,inc_1
-
 
275
	shl eax,1
188
	add [pz],eax
276
	add [pz],eax
189
end if
277
end if
190
	mov eax,d_x
278
	mov eax,d_x
191
	sub [a],eax
279
	sub [a],eax
192
	jmp .end_0
280
	jmp .end_0
Line 193... Line 281...
193
 
281
 
194
.els_0:
282
.els_0:
195
	add edi,[pp_inc_2]
283
	add edi,[pp_inc_2]
196
if INTERP_Z eq 1
284
if INTERP_Z eq 1
-
 
285
	mov eax,inc_2
197
	mov eax,inc_2
286
	shl eax,1
198
	add [pz],eax
287
	add [pz],eax
199
end if
288
end if
200
	mov eax,d_y
289
	mov eax,d_y