Subversion Repositories Kolibri OS

Rev

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

Rev 4128 Rev 4228
Line 52... Line 52...
52
  inc cx ; reverse
52
  inc cx ; reverse
53
  mov edx,315*65536+25
53
  mov edx,315*65536+25
54
  call draw_but_icon
54
  call draw_but_icon
55
or ecx,0x40000000
55
or ecx,0x40000000
Line 56... Line 56...
56
 
56
 
57
cmp byte[buf],0
57
cmp dword[buf],0
58
jne @f
58
jne @f
59
and ecx,0xffff
59
and ecx,0xffff
60
@@:
60
@@:
61
  mov cx,6 ; Paste
61
  mov cx,6 ; Paste
Line 354... Line 354...
354
;input:
354
;input:
355
; buf_rgb - áóôåð ñ âõîäíûì 24 áèòíûì öâåòíûì èçîáðàæåíèåì
355
; buf_rgb - áóôåð ñ âõîäíûì 24 áèòíûì öâåòíûì èçîáðàæåíèåì
356
; buf_g24 - áóôåð ñ âûõîäíûì 24 áèòíûì ñåðûì èçîáðàæåíèåì
356
; buf_g24 - áóôåð ñ âûõîäíûì 24 áèòíûì ñåðûì èçîáðàæåíèåì
357
; pixels - ÷èñëî ïèêñåëåé â èçîáðàæåíèè
357
; pixels - ÷èñëî ïèêñåëåé â èçîáðàæåíèè
358
align 4
358
align 4
359
proc img_to_gray uses eax ebx ecx edi esi, buf_rgb:dword, buf_g24:dword, pixels:dword
359
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
-
 
360
pushad
360
	mov esi,[buf_rgb]
361
	mov esi,[buf_rgb]
361
	mov edi,[buf_g24]
362
	mov edi,[buf_g24]
362
	mov ecx,[pixels]
363
	mov ecx,[pixels]
-
 
364
	mov ebx,3
363
	@@:
365
	@@:
364
		movzx eax,byte[esi]
366
		movzx eax,byte[esi]
365
		movzx ebx,byte[esi+1]
367
		movzx edx,byte[esi+1]
366
		add eax,ebx
368
		add eax,edx
367
		movzx ebx,byte[esi+2]
369
		movzx edx,byte[esi+2]
368
		add eax,ebx
370
		add eax,edx
369
		shr eax,2
371
		xor edx,edx
-
 
372
		div ebx ;shr eax,2
370
		mov ah,al
373
		mov ah,al
371
		mov word[edi],ax
374
		mov word[edi],ax
372
		mov byte[edi+2],al
375
		mov byte[edi+2],al
373
		add esi,3
376
		add esi,3
374
		add edi,3
377
		add edi,3
375
		loop @b
378
		loop @b
-
 
379
popad
376
	ret
380
	ret
377
endp
381
endp