Subversion Repositories Kolibri OS

Rev

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

Rev 2815 Rev 2920
Line 247... Line 247...
247
		.over_255:
247
		.over_255:
Line 248... Line 248...
248
 
248
 
249
		mov byte[transp_32+3],al ;¯à®§à ç­®áâì à¨á㥬®© â®çª¨
249
		mov byte[transp_32+3],al ;¯à®§à ç­®áâì à¨á㥬®© â®çª¨
Line 250... Line 250...
250
		mov esi,dword transp_32 ;㪠§ â¥«ì ­  梥â à¨á㥬®© â®çª¨
250
		mov esi,dword transp_32 ;㪠§ â¥«ì ­  梥â à¨á㥬®© â®çª¨
251
 
251
 
252
		call combine_colors
252
		call combine_colors_0
253
	pop esi edi edx ebx eax
253
	pop esi edi edx ebx eax
254
	@@:
254
	@@:
Line 1752... Line 1752...
1752
		mov eax,buf2d_w
1752
		mov eax,buf2d_w
1753
		mov ecx,buf2d_h
1753
		mov ecx,buf2d_h
1754
		imul ecx,eax
1754
		imul ecx,eax
1755
		stdcall img_rgb24_wdiv2, buf2d_data,ecx
1755
		stdcall img_rgb24_wdiv2, buf2d_data,ecx
1756
	.end_draw_24:
1756
	.end_draw_24:
-
 
1757
	cmp buf2d_bits,32
-
 
1758
	jne .end_draw_32
-
 
1759
		mov eax,buf2d_w
-
 
1760
		mov ecx,buf2d_h
-
 
1761
		imul ecx,eax
-
 
1762
		stdcall img_rgb32_wdiv2, buf2d_data,ecx
-
 
1763
	.end_draw_32:
1757
	popad
1764
	popad
1758
	ret
1765
	ret
1759
endp
1766
endp
Line 1760... Line 1767...
1760
 
1767
 
1761
;input:
1768
;input:
1762
;data_rgb - pointer to rgb data
1769
;data_rgb - pointer to rgb data
1763
;size - count img pixels (size img data / 3(rgb) )
1770
;size - count img pixels (size img data / 3(rgb) )
1764
align 4
1771
align 4
1765
proc img_rgb24_wdiv2 data_rgb:dword, size:dword
-
 
1766
  ;push eax ebx ecx edx
1772
proc img_rgb24_wdiv2 data_rgb:dword, size:dword
1767
  mov eax,dword[data_rgb]
1773
  mov eax,dword[data_rgb]
1768
  mov ecx,dword[size] ;ecx = size
1774
  mov ecx,dword[size] ;ecx = size
1769
  lea ecx,[ecx+ecx*2]
1775
  lea ecx,[ecx+ecx*2]
1770
  cld
1776
  cld
Line 1798... Line 1804...
1798
		mov byte[eax+2],dl
1804
		mov byte[eax+2],dl
Line 1799... Line 1805...
1799
 
1805
 
1800
		add eax,3
1806
		add eax,3
1801
		add ebx,6
1807
		add ebx,6
-
 
1808
		loop @b
-
 
1809
  ret
-
 
1810
endp
-
 
1811
 
-
 
1812
;input:
-
 
1813
;data_rgb - pointer to rgb data
-
 
1814
;size - count img pixels (size img data / 3(rgb) )
-
 
1815
align 4
-
 
1816
proc img_rgb32_wdiv2 data_rgb:dword, size:dword
-
 
1817
	mov eax,dword[data_rgb]
-
 
1818
 
-
 
1819
	mov eax,dword[data_rgb]
-
 
1820
	mov ebx,eax
-
 
1821
	add ebx,4
-
 
1822
	mov ecx,dword[size] ;ecx = size
-
 
1823
	shr ecx,1
-
 
1824
	@@: ;ᬥ訢 ­¨¥ 梥⮢ ¯¨ªá¥«¥©
-
 
1825
		call combine_colors_1
-
 
1826
		mov [eax],edx
-
 
1827
		add eax,8 ;=2*4
-
 
1828
		add ebx,8
-
 
1829
		loop @b
-
 
1830
 
-
 
1831
	mov eax,dword[data_rgb]
-
 
1832
	add eax,4
-
 
1833
	mov ebx,eax
-
 
1834
	add ebx,4
-
 
1835
	mov ecx,dword[size] ;ecx = size
-
 
1836
	shr ecx,1
-
 
1837
	dec ecx ;«¨è­¨© ¯¨ªá¥«ì
1802
		loop @b
1838
	@@: ;¯®¤¦ â¨¥ ¯¨ªá¥«¥©
-
 
1839
		mov edx,dword[ebx]
-
 
1840
		mov dword[eax],edx
-
 
1841
 
-
 
1842
		add eax,4
-
 
1843
		add ebx,8
1803
  ;pop edx ecx ebx eax
1844
		loop @b
1804
  ret
1845
	ret
Line 1805... Line 1846...
1805
endp
1846
endp
1806
 
1847
 
Line 1813... Line 1854...
1813
		mov eax,buf2d_w
1854
		mov eax,buf2d_w
1814
		mov ecx,buf2d_h
1855
		mov ecx,buf2d_h
1815
		imul ecx,eax
1856
		imul ecx,eax
1816
		stdcall img_rgb24_hdiv2, buf2d_data,ecx,eax
1857
		stdcall img_rgb24_hdiv2, buf2d_data,ecx,eax
1817
	.end_draw_24:
1858
	.end_draw_24:
-
 
1859
	cmp buf2d_bits,32
-
 
1860
	jne .end_draw_32
-
 
1861
		mov eax,buf2d_w
-
 
1862
		mov ecx,buf2d_h
-
 
1863
		imul ecx,eax
-
 
1864
		shl eax,2
-
 
1865
		stdcall img_rgb32_hdiv2, buf2d_data,ecx,eax
-
 
1866
	.end_draw_32:
1818
	popad
1867
	popad
1819
	ret
1868
	ret
1820
endp
1869
endp
Line 1821... Line 1870...
1821
 
1870
 
1822
;input:
1871
;input:
1823
;data_rgb - pointer to rgb data
1872
;data_rgb - pointer to rgb data
1824
;size - count img pixels (size img data / 3(rgb) )
1873
;size - count img pixels (size img data / 3(rgb) )
1825
;size_w - width img in pixels
1874
;size_w - width img in pixels
1826
align 4
1875
align 4
1827
proc img_rgb24_hdiv2, data_rgb:dword, size:dword, size_w:dword
-
 
Line 1828... Line 1876...
1828
  ;pushad
1876
proc img_rgb24_hdiv2, data_rgb:dword, size:dword, size_w:dword
1829
 
1877
 
1830
  mov eax,dword[data_rgb] ;eax =
1878
  mov eax,dword[data_rgb] ;eax =
1831
  mov ecx,dword[size]	  ;ecx = size
1879
  mov ecx,dword[size]	  ;ecx = size
Line 1835... Line 1883...
1835
    shr byte[eax],1
1883
    shr byte[eax],1
1836
    inc eax
1884
    inc eax
1837
    loop @b
1885
    loop @b
Line 1838... Line 1886...
1838
 
1886
 
1839
  mov eax,dword[data_rgb] ;eax =
1887
  mov eax,dword[data_rgb] ;eax =
1840
  mov edi,dword[size_w]
1888
  mov esi,dword[size_w]
1841
  lea esi,[edi+edi*2] ;esi = width*3(rgb)
1889
  lea esi,[esi+esi*2] ;esi = width*3(rgb)
1842
  mov ebx,esi
1890
  mov ebx,esi
1843
  add ebx,eax
1891
  add ebx,eax
1844
  mov ecx,dword[size]  ;ecx = size
1892
  mov ecx,dword[size]  ;ecx = size
1845
  shr ecx,1
1893
  shr ecx,1
Line 1862... Line 1910...
1862
    loop @b
1910
    loop @b
Line 1863... Line 1911...
1863
 
1911
 
1864
 
1912
 
1865
  mov eax,dword[data_rgb] ;eax =
1913
  mov eax,dword[data_rgb] ;eax =
1866
  add eax,esi ;esi = width*3(rgb)
1914
  add eax,esi ;esi = width*3(rgb)
1867
  mov ebx,esi
1915
  mov ebx,eax
1868
  add ebx,eax
1916
  add ebx,esi
1869
  mov ecx,dword[size] ;ecx = size
1917
  mov ecx,dword[size] ;ecx = size
1870
  shr ecx,1
1918
  shr ecx,1
1871
  sub ecx,dword[size_w] ;«¨è­ïï áâப  ¯¨ªá¥«¥©
1919
  sub ecx,dword[size_w] ;«¨è­ïï áâப  ¯¨ªá¥«¥©
Line 1884... Line 1932...
1884
      add ebx,esi
1932
      add ebx,esi
1885
      xor edi,edi
1933
      xor edi,edi
1886
    .old_line_2:
1934
    .old_line_2:
1887
    loop @b
1935
    loop @b
Line -... Line 1936...
-
 
1936
 
-
 
1937
  ret
-
 
1938
endp
-
 
1939
 
-
 
1940
;input:
-
 
1941
;data_rgb - pointer to rgb data
-
 
1942
;size - count img pixels (size img data / 3(rgb) )
-
 
1943
;size_w_b - width img in bytes
-
 
1944
align 4
-
 
1945
proc img_rgb32_hdiv2, data_rgb:dword, size:dword, size_w_b:dword
-
 
1946
 
-
 
1947
	mov eax,dword[data_rgb] ;eax =
-
 
1948
	mov ebx,dword[size_w_b]
-
 
1949
	add ebx,eax
-
 
1950
	mov ecx,dword[size]  ;ecx = size
-
 
1951
	shr ecx,1
-
 
1952
	xor edi,edi
-
 
1953
	@@: ;ᬥ訢 ­¨¥ 梥⮢ ¯¨ªá¥«¥©
-
 
1954
		call combine_colors_1
-
 
1955
		mov dword[eax],edx
-
 
1956
 
-
 
1957
		add eax,4
-
 
1958
		add ebx,4
-
 
1959
		add edi,4
-
 
1960
		cmp edi,dword[size_w_b]
-
 
1961
		jl .old_line
-
 
1962
			add eax,dword[size_w_b]
-
 
1963
			add ebx,dword[size_w_b]
-
 
1964
			xor edi,edi
-
 
1965
		.old_line:
-
 
1966
		loop @b
-
 
1967
 
-
 
1968
 
-
 
1969
	mov eax,dword[data_rgb] ;eax =
-
 
1970
	mov ebx,dword[size_w_b]
-
 
1971
	add eax,ebx
-
 
1972
	add ebx,eax
-
 
1973
	mov ecx,dword[size] ;ecx = size
-
 
1974
	shl ecx,1
-
 
1975
	sub ecx,dword[size_w_b] ;«¨è­ïï áâப  ¯¨ªá¥«¥©
-
 
1976
	shr ecx,2
-
 
1977
	xor edi,edi
-
 
1978
	@@: ;¯®¤¦ â¨¥ ¯¨ªá¥«¥©
-
 
1979
		mov edx,dword[ebx] ;ª®¯¨à㥬 梥⠭¨¦­¥£® ¯¨ªá¥«ï
-
 
1980
		mov dword[eax],edx
-
 
1981
 
-
 
1982
		add eax,4
-
 
1983
		add ebx,4
-
 
1984
		add edi,4
-
 
1985
		cmp edi,dword[size_w_b]
-
 
1986
		jl .old_line_2
-
 
1987
			add ebx,dword[size_w_b]
-
 
1988
			xor edi,edi
1888
 
1989
		.old_line_2:
-
 
1990
		loop @b
-
 
1991
 
-
 
1992
	ret
-
 
1993
endp
-
 
1994
 
-
 
1995
;input:
-
 
1996
; eax - 㪠§ â¥«ì ­  32-¡¨â­ë© 梥â
-
 
1997
; ebx - 㪠§ â¥«ì ­  32-¡¨â­ë© 梥â
-
 
1998
;output:
-
 
1999
; edx - 32-¡¨â­ë© 梥â ᬥ蠭­ë© á ãç¥â®¬ ¯à®§à ç­®áâ¨
-
 
2000
;destroy:
-
 
2001
; esi
-
 
2002
align 4
-
 
2003
proc combine_colors_1 uses ecx edi
-
 
2004
locals
-
 
2005
	c_blye dd ?
-
 
2006
	c_green dd ?
-
 
2007
	c_red dd ?
-
 
2008
endl		
-
 
2009
	movzx edi,byte[eax+3]
-
 
2010
	cmp edi,255
-
 
2011
	je .c0z
-
 
2012
	movzx esi,byte[ebx+3]
-
 
2013
	cmp esi,255
-
 
2014
	je .c1z
-
 
2015
 
-
 
2016
	;¯¥à¥¢®à ç¨¢ ¥¬ §­ ç¥­¨ï ¯à®§à ç­®á⥩
-
 
2017
	neg edi
-
 
2018
	inc edi
-
 
2019
	add edi,255
-
 
2020
	neg esi
-
 
2021
	inc esi
-
 
2022
	add esi,255
-
 
2023
 
-
 
2024
	movzx ecx,byte[eax]
-
 
2025
	imul ecx,edi
-
 
2026
	mov [c_blye],ecx
-
 
2027
	movzx ecx,byte[ebx]
-
 
2028
	imul ecx,esi
-
 
2029
	add [c_blye],ecx
-
 
2030
 
-
 
2031
	movzx ecx,byte[eax+1]
-
 
2032
	imul ecx,edi
-
 
2033
	mov [c_green],ecx
-
 
2034
	movzx ecx,byte[ebx+1]
-
 
2035
	imul ecx,esi
-
 
2036
	add [c_green],ecx
-
 
2037
 
-
 
2038
	movzx ecx,byte[eax+2]
-
 
2039
	imul ecx,edi
-
 
2040
	mov [c_red],ecx
-
 
2041
	movzx ecx,byte[ebx+2]
-
 
2042
	imul ecx,esi
-
 
2043
	add [c_red],ecx
-
 
2044
 
-
 
2045
push eax ebx
-
 
2046
	xor ebx,ebx
-
 
2047
	mov eax,[c_red]
-
 
2048
	xor edx,edx
-
 
2049
	mov ecx,edi
-
 
2050
	add ecx,esi
-
 
2051
	div ecx
-
 
2052
	mov bl,al
-
 
2053
	shl ebx,16
-
 
2054
	mov eax,[c_green]
-
 
2055
	xor edx,edx
-
 
2056
	div ecx
-
 
2057
	mov bh,al
-
 
2058
	mov eax,[c_blye]
-
 
2059
	xor edx,edx
-
 
2060
	div ecx
-
 
2061
	mov bl,al
-
 
2062
 
-
 
2063
	shr ecx,1
-
 
2064
	;¯¥à¥¢®à ç¨¢ ¥¬ §­ ç¥­¨ï ¯à®§à ç­®áâ¨
-
 
2065
	neg ecx
-
 
2066
	inc ecx
-
 
2067
	add ecx,255
-
 
2068
 
-
 
2069
	shl ecx,24
-
 
2070
	add ebx,ecx
-
 
2071
	mov edx,ebx
-
 
2072
pop ebx eax
-
 
2073
 
-
 
2074
	jmp .end_f
-
 
2075
	.c0z: ;¥á«¨ 梥⠢ eax ¯à®§à ç­ë©
-
 
2076
		mov edx,dword[ebx]
-
 
2077
		movzx edi,byte[ebx+3]
-
 
2078
		jmp @f
-
 
2079
	.c1z: ;¥á«¨ 梥⠢ ebx ¯à®§à ç­ë©
-
 
2080
		mov edx,dword[eax]
-
 
2081
	@@:
-
 
2082
		add edi,255 ;¤¥« ¥¬ 梥⠭  ¯®«®¢¨­ã ¯à®§à ç­ë¬
-
 
2083
		shr edi,1
-
 
2084
		cmp edi,255
-
 
2085
		jl @f
-
 
2086
			mov edi,255 ;¬ ªá¨¬ «ì­ ï ¯à®§à ç­®áâì ­¥ ¡®«¥¥ 255
-
 
2087
		@@:
-
 
2088
		shl edi,24
-
 
2089
		and edx,0xffffff ;á­¨¬ ¥¬ áâ àãî ¯à®§à ç­®áâì
-
 
2090
		add edx,edi
1889
  ;popad
2091
	.end_f:
1890
  ret
2092
	ret
Line 1891... Line 2093...
1891
endp
2093
endp
1892
 
2094
 
Line 2183... Line 2385...
2183
; esi = pointer to color1 + transparent
2385
; esi = pointer to color1 + transparent
2184
; edi = pointer to background color2
2386
; edi = pointer to background color2
2185
;output:
2387
;output:
2186
; [edi] = combine color
2388
; [edi] = combine color
2187
align 4
2389
align 4
2188
combine_colors:
2390
combine_colors_0:
2189
	push ax bx cx dx
2391
	push ax bx cx dx
2190
	mov bx,0x00ff ;---get transparent---
2392
	mov bx,0x00ff ;---get transparent---
2191
	movzx cx,byte[esi+3] ;pro
2393
	movzx cx,byte[esi+3] ;pro
2192
	sub bx,cx ;256-pro
2394
	sub bx,cx ;256-pro
2193
	;---blye---
2395
	;---blye---
Line 2291... Line 2493...
2291
	cmp [right_bytes],0
2493
	cmp [right_bytes],0
2292
	jg .copy_1
2494
	jg .copy_1
2293
	.copy_0: ;¯à®á⮥ ª®¯¨à®¢ ­¨¥
2495
	.copy_0: ;¯à®á⮥ ª®¯¨à®¢ ­¨¥
2294
		mov ecx,eax
2496
		mov ecx,eax
2295
		@@:
2497
		@@:
2296
			call combine_colors
2498
			call combine_colors_0
2297
			add edi,3
2499
			add edi,3
2298
			add esi,4
2500
			add esi,4
2299
			loop @b
2501
			loop @b
2300
		add edi,ebx
2502
		add edi,ebx
2301
		dec edx
2503
		dec edx
Line 2303... Line 2505...
2303
		jg .copy_0
2505
		jg .copy_0
2304
	jmp .copy_end
2506
	jmp .copy_end
2305
	.copy_1: ;­¥ ¯à®á⮥ ª®¯¨à®¢ ­¨¥ (ª à⨭ª  ¢ë« §¨â §  ¯à ¢ãî áâ®à®­ã)
2507
	.copy_1: ;­¥ ¯à®á⮥ ª®¯¨à®¢ ­¨¥ (ª à⨭ª  ¢ë« §¨â §  ¯à ¢ãî áâ®à®­ã)
2306
		mov ecx,eax
2508
		mov ecx,eax
2307
		@@:
2509
		@@:
2308
			call combine_colors
2510
			call combine_colors_0
2309
			add edi,3
2511
			add edi,3
2310
			add esi,4
2512
			add esi,4
2311
			loop @b
2513
			loop @b
2312
		add edi,ebx
2514
		add edi,ebx
2313
		add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ §  ¯à ¢ãî £à ­¨æã
2515
		add esi,[right_bytes] ;¤®¡ ¢«ï¥¬ ¡ ©âë, ª®â®àë¥ ¢ë« §ïâ §  ¯à ¢ãî £à ­¨æã