Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

684 lines
23 KiB

  1. page ,132
  2. ;------------------------------Module-Header----------------------------;
  3. ; Module Name: alphaimg.asm
  4. ;
  5. ; Inner loop dfor alpha bending
  6. ;
  7. ; Created: 12-Mar-1997
  8. ; Author: Mark Enstrom
  9. ;
  10. ; Copyright (c) 1997-1999 Microsoft Corporation
  11. ;-----------------------------------------------------------------------;
  12. .386
  13. .model small,c
  14. assume cs:FLAT,ds:FLAT,es:FLAT,ss:FLAT
  15. assume fs:nothing,gs:nothing
  16. .xlist
  17. include callconv.inc
  18. include ks386.inc
  19. ovr_DstLast equ 000H
  20. ovr_EDI equ 004H
  21. ovr_ESI equ 008H
  22. ovr_EDX equ 00cH
  23. ovr_ECX equ 010H
  24. ovr_EBX equ 014H
  25. ovr_ppixEBP equ 018H
  26. ovr_RA equ 01cH
  27. ovr_ppixDst equ 020H
  28. ovr_ppixSrc equ 024H
  29. ovr_cx equ 028H
  30. ovr_Blend equ 02cH
  31. ovr_pwrMask equ 030H
  32. ble_ConstAlpha equ 000H
  33. ble_LastX equ 004H
  34. ble_EDI equ 008H
  35. ble_ESI equ 00cH
  36. ble_EDX equ 010H
  37. ble_ECX equ 014H
  38. ble_EBX equ 018H
  39. ble_EBP equ 01cH
  40. ble_RA equ 020H
  41. ble_ppixDst equ 024H
  42. ble_ppixSrc equ 028H
  43. ble_cx equ 02cH
  44. ble_Blend equ 030H
  45. ble16_tSrc equ 000H
  46. ble16_tDst equ 004H
  47. ble16_ConstAlpha equ 008H
  48. ble16_LastX equ 00cH
  49. ble16_EDI equ 010H
  50. ble16_ESI equ 014H
  51. ble16_EDX equ 018H
  52. ble16_ECX equ 01cH
  53. ble16_EBX equ 020H
  54. ble16_EBP equ 024H
  55. ble16_RA equ 028H
  56. ble16_ppixDst equ 02cH
  57. ble16_ppixSrc equ 030H
  58. ble16_cx equ 034H
  59. ble16_Blend equ 038H
  60. ;
  61. ; locals
  62. ;
  63. .list
  64. ;------------------------------------------------------------------------------;
  65. .code
  66. _TEXT$01 SEGMENT DWORD USE32 PUBLIC 'CODE'
  67. ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
  68. ;------------------------------------------------------------------------------;
  69. ;------------------------------------------------------------------------------;
  70. ; vPixelOver
  71. ;
  72. ; Blend source and destination scan line. Source and destination are 32bpp
  73. ; BGRA scan lines.
  74. ;
  75. ; Entry:
  76. ;
  77. ; ppixDst - pointer to dst scan line
  78. ; ppixSrc - pointer to src scan line
  79. ; cx - number of pixels
  80. ; BlendFunction - BlendFunction, not used
  81. ; pwrMask - write mask: Set byte to 1 if need to write output
  82. ;
  83. ; Returns:
  84. ; none
  85. ; Registers Destroyed:
  86. ; all
  87. ; Calls:
  88. ; None
  89. ; History:
  90. ;
  91. ; WARNING: If call parameters are changed, the ret statement must be fixed
  92. ;
  93. ;------------------------------------------------------------------------------;
  94. ;
  95. ; VOID
  96. ; vPixelOver(
  97. ; ALPHAPIX *ppixDst,
  98. ; ALPHAPIX *ppixSrc,
  99. ; LONG cx,
  100. ; BLENDFUNCTION BlendFunction,
  101. ; PBYTE pwrMask
  102. ; )
  103. ; {
  104. ; ALPHAPIX pixSrc;
  105. ; ALPHAPIX pixDst;
  106. ;
  107. ; while (cx--)
  108. ; {
  109. ; pixSrc = *ppixSrc;
  110. ;
  111. ; if (pixSrc.pix.a != 0)
  112. ; {
  113. ; pixDst = *ppixDst;
  114. ;
  115. ; if (pixSrc.pix.a == 255)
  116. ; {
  117. ; pixDst = pixSrc;
  118. ; }
  119. ; else
  120. ; {
  121. ; long SrcTran = 255 - pixSrc->a;
  122. ; PBYTE pTable = &pAlphaMulTable[SrcTran * 256];
  123. ;
  124. ; pixDst->r = pixSrc->r + *(pTable + pixDst->r);
  125. ; pixDst->g = pixSrc->g + *(pTable + pixDst->g);
  126. ; pixDst->b = pixSrc->b + *(pTable + pixDst->b);
  127. ; pixDst->a = pixSrc->a + *(pTable + pixDst->a);
  128. ; }
  129. ;
  130. ; *pwrMask = 1;
  131. ; *ppixDst = pixDst;
  132. ; }
  133. ;
  134. ; pwrMask++;
  135. ; ppixSrc++;
  136. ; ppixDst++;
  137. ; }
  138. ; }
  139. ;
  140. ;
  141. ;
  142. ;
  143. ; parameters
  144. ;
  145. public vPixelOver@20
  146. vPixelOver@20 proc near
  147. ;
  148. ; use ebp as general register
  149. ;
  150. push ebp
  151. push ebx
  152. push ecx
  153. push edx
  154. push edi
  155. push esi
  156. sub esp,4
  157. mov ecx,ovr_cx[esp] ; ebx = pixel count
  158. mov edi,ovr_ppixDst[esp] ; edi = destination address
  159. shl ecx,2 ; ebx = DWORD offset
  160. mov esi,ovr_ppixSrc[esp] ; esi = source address
  161. add ecx,edi ; end dst addr
  162. mov edx,ovr_pwrMask[esp] ; edx = pwrMask
  163. cmp edi,ecx ; end of scan line
  164. mov ovr_DstLast[esp],ecx ; save end scan line
  165. jz PixelReturn
  166. PixelLoop:
  167. mov ecx,0FFH ; ecx = 00 00 00 FF u
  168. mov eax,[esi] ; eax = AA RR GG BB v
  169. shr eax,24 ; eax = 00 00 00 AA u
  170. add esi,4 ; inc src pointer v
  171. ;
  172. ; check for alpha == 0 and alpha == 0xff, these
  173. ; checks allow not writing output pixels that
  174. ; don't change, but this test decreases performance of the
  175. ; loop by 10%
  176. ;
  177. test al,al ; test for 0 u
  178. jz PixelZeroAlpha ; jump to 0 quick out v
  179. ;
  180. cmp al,0ffH ; alpha = 0xff u
  181. jz PixelFFAlpha ; jump to case ff v
  182. sub ecx,eax ; ecx = 00 00 00 255-sA u
  183. mov eax,[edi] ; eax = dA dR dG dB v
  184. mov ebp,eax ; ebp = dA dR dG dB u
  185. and eax,0FF00FFFFH ; eax = dA 00 dG dB v
  186. shr eax,8 ; eax = 00 dA 00 dG u
  187. and ebp,000FF00FFH ; ebp = 00 dR 00 dB v
  188. imul ebp,ecx ; ebp = dR*sA dB*sA 10 cycle delay
  189. imul eax,ecx ; eax = dA*sA dG*sG 10 cycles
  190. add ebp,0800080H ; ebp = ( eR) ( eB) u
  191. add eax,0800080H ; ebp = ( eA) ( eG) v
  192. mov ebx,ebp ; ebx = ( eR) ( eB) u
  193. mov ecx,eax ; ecx = ( eA) ( eG) v
  194. and ebx,0FF00FFFFH ; ebx = eR 00 ( eB) u
  195. and ecx,0FF00FFFFH ; ecx = eA 00 ( eG) v
  196. shr ebx,8 ; ebx = 00 eR 00 eB u
  197. add edi,4 ; inc dst pointer v
  198. shr ecx,8 ; ecx = 00 eA 00 eG u
  199. add ebx,ebp ; ebx = ( eR) ( eB) v
  200. mov ebp,[esi-4] ; ebp = sA sR sG sB v
  201. and ebx,0FF00FFFFH ; ebx = eR 00 ( eB) u
  202. shr ebx,8 ; ebx = 00 eR 00 eB u
  203. add ecx,eax ; ecx = ( eA) ( eG) v
  204. mov eax,ovr_DstLast[esp] ; u
  205. and ecx,0FF00FF00H ; ecx = eA 00 eG 00 v
  206. add ecx,ebp ; ecx = AA sR GG sB u AA = sA + (1-sA)Da
  207. inc edx ; v
  208. add ecx,ebx ; ecx = AA RR GG BB u
  209. cmp edi,eax ; v
  210. mov [edi-4],ecx ; save result u
  211. jnz PixelLoop ; v
  212. ;
  213. ; restore stack frame
  214. ;
  215. PixelReturn:
  216. add esp,4
  217. pop esi
  218. pop edi
  219. pop edx
  220. pop ecx
  221. pop ebx
  222. pop ebp
  223. ret 20
  224. PixelZeroAlpha:
  225. mov eax,ovr_DstLast[esp] ; end scan line
  226. add edi,4 ; inc dst
  227. mov BYTE PTR[edx],0 ; set pwrMask
  228. inc edx ; inc pwrMask
  229. cmp edi,eax ; dst == dstEnd
  230. jnz PixelLoop ; loop
  231. jmp PixelReturn
  232. PixelFFAlpha:
  233. mov ecx,ovr_DstLast[esp] ; end scan line
  234. mov eax,[esi-4] ; eax = dA dR dG dB v
  235. mov [edi],eax ; save result
  236. add edi,4 ; inc dst pointer u
  237. inc edx ; inc pwrMask
  238. cmp edi,ecx ;
  239. jnz PixelLoop
  240. jmp PixelReturn
  241. vPixelOver@20 endp
  242. ;------------------------------------------------------------------------------;
  243. ; vPixelBlend
  244. ;
  245. ; Dst = Dst + Alpha * (Src - Dst)
  246. ;
  247. ; Entry:
  248. ;
  249. ; ppixDst - pointer to dst scan line
  250. ; ppixSrc - pointer to src scan line
  251. ; cx - number of pixels
  252. ; BlendFunction - BlendFunction, not used
  253. ;
  254. ; Returns:
  255. ; none
  256. ; Registers Destroyed:
  257. ; all
  258. ; Calls:
  259. ; None
  260. ; History:
  261. ;
  262. ; WARNING: If call parameters are changed, the ret statement must be fixed
  263. ;
  264. ;------------------------------------------------------------------------------;
  265. ;
  266. ; parameters
  267. ;
  268. public vPixelBlend@20
  269. vPixelBlend@20 proc near
  270. ;
  271. ; use ebp as general register
  272. ;
  273. push ebp
  274. push ebx
  275. push ecx
  276. push edx
  277. push edi
  278. push esi
  279. sub esp,8
  280. movzx eax,BYTE PTR ble_Blend+2[esp]
  281. mov ebx,ble_cx[esp] ; ebx = pixel count
  282. mov edi,ble_ppixDst[esp] ; edi = destination address
  283. mov esi,ble_ppixSrc[esp] ; esi = source address
  284. lea edx,[edi + 4 * ebx] ; edx = last dst address
  285. cmp edi,edx ; end of scan line
  286. jz BlendReturn
  287. mov ble_LastX[esp],edx ; save end x address
  288. BlendLoop:
  289. mov ebx,[edi] ; ebx = D aa rr gg bb
  290. mov ecx,[esi] ; ecx = S aa rr bb bb
  291. and ebx,000ff00ffH ; ebx = D 00 rr 00 bb
  292. and ecx,000ff00ffH ; ecx = S 00 rr 00 bb
  293. mov ebp,ebx ; ebp = D 00 rr 00 bb
  294. sub ecx,ebx ; ecx = s 00 rr 00 bb
  295. imul ecx,eax ; ecx = rr rr bb bb u
  296. shl ebp,8 ; ebp = D rr 00 bb 00 u
  297. mov edx,[edi] ; edx = D aa rr gg bb v
  298. and edx,0ff00ff00H ; edx = D aa 00 gg 00 u
  299. sub ebp,ebx ; ebp = D rr ee bb ee v
  300. shr edx,8 ; edx = D 00 aa 00 gg u
  301. add ecx,000800080H ; ecx = rr rr bb bb + e v
  302. add ecx,ebp ; ecx = rr rr bb bb u
  303. mov ebp,[esi] ; ebp = S aa rr gg bb v
  304. shr ebp,8 ; ebp = S ?? aa rr gg u
  305. mov ebx,ecx ; ebx = rr rr bb bb v
  306. and ecx,0ff00ff00H ; ecx = rr 00 bb 00 u
  307. and ebp,000ff00ffH ; ebp = S 00 aa 00 gg v
  308. shr ecx,8 ; ecx = 00 rr 00 bb u
  309. sub ebp,edx ; ebp = del a del g v
  310. add ebx,ecx ; ebx = rr rr bb bb u
  311. mov ecx,edx ; ecx = D 00 aa 00 gg v
  312. imul ebp,eax ; ebp = m aa aa gg gg u
  313. shl ecx,8 ; ecx = D aa 00 gg 00 u
  314. and ebx,0FF00FF00H ; ebx = rr 00 bb 00 v
  315. add ebp,000800080H ; ebp = m aa aa gg gg u
  316. sub ecx,edx ; ecx = D aa 00 gg 00 v
  317. shr ebx,8 ; ebx = 00 rr 00 bb u
  318. add ecx,ebp ; ecx = M aa aa gg gg v
  319. mov edx,ecx ; edx = M aa aa gg gg u
  320. and ecx,0ff00ff00H ; ecx = M aa 00 gg 00 v
  321. shr ecx,8 ; ecx = M 00 aa 00 gg u
  322. add esi,4 ; inc src to next pixel v
  323. add ecx,edx ; ecx = M aa aa gg gg u
  324. mov ebp,ble_LastX[esp] ; ebp = Last X Dst addr v
  325. and ecx,0FF00FF00H ; ecx = D aa 00 gg 00 u
  326. add edi,4 ; inc dst addr v
  327. or ecx,ebx ; ecx = D aa rr gg bb u
  328. cmp edi,ebp ; v
  329. mov [edi-4],ecx ; store dst pixel u
  330. jnz BlendLoop ; v
  331. ;
  332. ; restore stack frame
  333. ;
  334. BlendReturn:
  335. add esp,8
  336. pop esi
  337. pop edi
  338. pop edx
  339. pop ecx
  340. pop ebx
  341. pop ebp
  342. ret 20
  343. vPixelBlend@20 endp
  344. ;------------------------------------------------------------------------------;
  345. ; vPixelBlend16_555
  346. ;
  347. ; Dst = Dst + Alpha * (Src - Dst)
  348. ;
  349. ; Source and destination are 16 bpp 555 format
  350. ;
  351. ; Entry:
  352. ;
  353. ; ppixDst - pointer to dst scan line
  354. ; ppixSrc - pointer to src scan line
  355. ; cx - number of pixels
  356. ; BlendFunction - BlendFunction, not used
  357. ;
  358. ; Returns:
  359. ; none
  360. ; Registers Destroyed:
  361. ; all
  362. ; Calls:
  363. ; None
  364. ; History:
  365. ;
  366. ; WARNING: If call parameters are changed, the ret statement must be fixed
  367. ;
  368. ;------------------------------------------------------------------------------;
  369. ;
  370. ; parameters
  371. ;
  372. public vPixelBlend16_555@20
  373. vPixelBlend16_555@20 proc near
  374. ;
  375. ; use ebp as general register
  376. ;
  377. push ebp
  378. push ebx
  379. push ecx
  380. push edx
  381. push edi
  382. push esi
  383. sub esp,16
  384. movzx eax,BYTE PTR ble16_Blend+2[esp]
  385. mov ebx,ble16_cx[esp] ; ebx = pixel count
  386. mov edi,ble16_ppixDst[esp] ; edi = destination address
  387. mov esi,ble16_ppixSrc[esp] ; esi = source address
  388. lea edx,[edi + 2 * ebx] ; edx = last dst address
  389. cmp edi,edx ; end of scan line
  390. jz BlendReturn_16
  391. mov ble16_LastX[esp],edx ; save end x address
  392. BlendLoop_16:
  393. movzx ebx,WORD PTR[edi] ; ebx = D 0000 0000 0rrr rrgg gggb bbbb
  394. movzx ecx,WORD PTR[esi] ; ecx = S 0000 0000 0rrr rrgg gggb bbbb
  395. mov ble16_tDst[esp],ebx
  396. mov ble16_tSrc[esp],ecx
  397. and ebx,000007c1fH ; ebx = D 0000 0000 0rrr rr00 000b bbbb
  398. and ecx,000007c1fH ; ecx = S 0000 0000 0rrr rr00 000b bbbb
  399. mov ebp,ebx ; ebp = D 0000 0000 0rrr rr00 000b bbbb
  400. sub ecx,ebx ; ecx = s 0000 0000 0RRR RR00 000B BBBB
  401. imul ecx,eax ; ecx = M 0000 RRRR Rrrr rrBB BBBb bbbb
  402. shl ebp,5 ; ebp = D 0000 rrrr r000 00bb bbb0 0000
  403. mov edx,ble16_tDst[esp] ; ebx = D 0000 0000 0rrr rrgg gggb bbbb
  404. and edx,0000003e0H ; edx = D 0000 0000 0000 00gg ggg0 0000
  405. sub ebp,ebx ; ebp = D 0000 RRRR R000 00BB BBB0 0000 D*(32-1)
  406. shr edx,5 ; edx = D 0000 0000 0000 0000 000g gggg NOT NEEDED!
  407. add ecx,000004010H ; ecx = M 0000 RRRR Rrrr rrBB BBBb bbbb + error
  408. add ecx,ebp ; ecx = M 0000 RRRR Rrrr rrBB BBBb bbbb
  409. mov ebp,ble16_tSrc[esp] ; ecx = S 0000 0000 0rrr rrgg gggb bbbb
  410. shr ebp,5 ; ebp = S 0000 0000 0000 00rr rrrg gggg NOT NEEDED
  411. mov ebx,ecx ; ebx = M
  412. and ecx,0000F83E0H ; ecx = M 0000 RRRR R000 00BB BBB0 0000
  413. and ebp,00000001fH ; ebp = S 0000 0000 0000 0000 000g gggg
  414. shr ecx,5 ; ecx = M 0000 0000 0RRR RR00 000B BBBB
  415. sub ebp,edx ; ebp =DG 0000 0000 0000 0000 000g gggg (sG-dG)
  416. add ebx,ecx ; ebx = M 0000 RRRR Rrrr rrBB BBBb bbbb
  417. mov ecx,edx ; ecx = D 0000 0000 0000 0000 000g gggg
  418. imul ebp,eax ; ebp = M 0000 0000 0000 00GG GGGg gggg alpha * (sG-dG)
  419. shl ecx,5 ; ecx = D 0000 0000 0000 00gg ggg0 0000 dG * 32
  420. and ebx,0000f83e0H ; ebx = M 0000 RRRR R000 00BB BBB0 0000
  421. add ebp,000004010H ; ebp = M 0000 0000 0000 00GG GGGg gggg + error
  422. sub ecx,edx ; ecx = D 0000 0000 0000 00gg ggg0 0000 dG * 31
  423. shr ebx,5 ; ebx = M 0000 0000 0RRR RR00 000B BBBB
  424. add ecx,ebp ; ecx = M 0000 0000 0000 00GG GGGg gggg
  425. mov edx,ecx ; edx = M 0000 0000 0000 00GG GGGg gggg
  426. and ecx,0000003e0H ; ecx = M 0000 0000 0000 00GG GGG0 0000 NOT NEEDED
  427. shr ecx,5 ; ecx = M 0000 0000 0000 0000 000G GGGG
  428. add esi,2 ; inc src to next pixel v
  429. add ecx,edx ; ecx = M 0000 0000 0000 00GG GGGg gggg
  430. mov ebp,ble16_LastX[esp] ; ebp = Last X Dst addr v
  431. and ecx,0000003e0H ; ecx = M 0000 0000 0000 00GG GGG0 0000
  432. add edi,2 ; inc dst addr v
  433. or ecx,ebx ; ecx = D 0000 0000 0RRR RRGG GGGB BBBB
  434. cmp edi,ebp ; v
  435. mov [edi-2],cx ; store dst pixel u
  436. jnz BlendLoop_16 ; v
  437. ;
  438. ; restore stack frame
  439. ;
  440. BlendReturn_16:
  441. add esp,16
  442. pop esi
  443. pop edi
  444. pop edx
  445. pop ecx
  446. pop ebx
  447. pop ebp
  448. ret 20
  449. vPixelBlend16_555@20 endp
  450. ;------------------------------------------------------------------------------;
  451. ; vPixelBlend16_565
  452. ;
  453. ; Dst = Dst + Alpha * (Src - Dst)
  454. ;
  455. ; Source and destination are 16 bpp 565 format
  456. ;
  457. ; Entry:
  458. ;
  459. ; ppixDst - pointer to dst scan line
  460. ; ppixSrc - pointer to src scan line
  461. ; cx - number of pixels
  462. ; BlendFunction - BlendFunction, not used
  463. ;
  464. ; Returns:
  465. ; none
  466. ; Registers Destroyed:
  467. ; all
  468. ; Calls:
  469. ; None
  470. ; History:
  471. ;
  472. ; WARNING: If call parameters are changed, the ret statement must be fixed
  473. ;
  474. ;------------------------------------------------------------------------------;
  475. ;
  476. ; parameters
  477. ;
  478. public vPixelBlend16_565@20
  479. vPixelBlend16_565@20 proc near
  480. ;
  481. ; use ebp as general register
  482. ;
  483. push ebp
  484. push ebx
  485. push ecx
  486. push edx
  487. push edi
  488. push esi
  489. sub esp,16
  490. movzx eax,BYTE PTR ble16_Blend+2[esp]
  491. mov ebx,ble16_cx[esp] ; ebx = pixel count
  492. mov edi,ble16_ppixDst[esp] ; edi = destination address
  493. mov esi,ble16_ppixSrc[esp] ; esi = source address
  494. lea edx,[edi + 2 * ebx] ; edx = last dst address
  495. cmp edi,edx ; end of scan line
  496. jz BlendReturn_16
  497. mov ble16_LastX[esp],edx ; save end x address
  498. BlendLoop_16:
  499. movzx ebx,WORD PTR[edi] ; ebx = D 0000 0000 0rrr rrgg gggb bbbb
  500. movzx ecx,WORD PTR[esi] ; ecx = S 0000 0000 0rrr rrgg gggb bbbb
  501. mov ble16_tDst[esp],ebx
  502. mov ble16_tSrc[esp],ecx
  503. and ebx,00000f81fH ; ebx = D 0000 0000 0rrr rr00 000b bbbb
  504. and ecx,00000f81fH ; ecx = S 0000 0000 0rrr rr00 000b bbbb
  505. mov ebp,ebx ; ebp = D 0000 0000 0rrr rr00 000b bbbb
  506. sub ecx,ebx ; ecx = s 0000 0000 0RRR RR00 000B BBBB
  507. imul ecx,eax ; ecx = M 0000 RRRR Rrrr rrBB BBBb bbbb
  508. shl ebp,5 ; ebp = D 0000 rrrr r000 00bb bbb0 0000
  509. mov edx,ble16_tDst[esp] ; ebx = D 0000 0000 0rrr rrgg gggb bbbb
  510. and edx,0000007e0H ; edx = D 0000 0000 0000 00gg ggg0 0000
  511. sub ebp,ebx ; ebp = D 0000 RRRR R000 00BB BBB0 0000 D*(32-1)
  512. shr edx,5 ; edx = D 0000 0000 0000 0000 000g gggg NOT NEEDED!
  513. add ecx,000008010H ; ecx = M 0000 RRRR Rrrr rrBB BBBb bbbb + error
  514. add ecx,ebp ; ecx = M 0000 RRRR Rrrr rrBB BBBb bbbb
  515. mov ebp,ble16_tSrc[esp] ; ecx = S 0000 0000 0rrr rrgg gggb bbbb
  516. shr ebp,5 ; ebp = S 0000 0000 0000 00rr rrrg gggg NOT NEEDED
  517. mov ebx,ecx ; ebx = M
  518. and ecx,0001f03E0H ; ecx = M 0000 RRRR R000 00BB BBB0 0000
  519. and ebp,00000003fH ; ebp = S 0000 0000 0000 0000 000g gggg
  520. shr ecx,5 ; ecx = M 0000 0000 0RRR RR00 000B BBBB
  521. sub ebp,edx ; ebp =DG 0000 0000 0000 0000 000g gggg (sG-dG)
  522. add ebx,ecx ; ebx = M 0000 RRRR Rrrr rrBB BBBb bbbb
  523. mov ecx,edx ; ecx = D 0000 0000 0000 0000 000g gggg
  524. imul ebp,eax ; ebp = M 0000 0000 0000 00GG GGGg gggg alpha * (sG-dG)
  525. shl ebp,1 ; ConstAlpha *2
  526. shl ecx,6 ; ecx = D 0000 0000 0000 00gg ggg0 0000 dG * 32
  527. and ebx,0001f03e0H ; ebx = M 0000 RRRR R000 00BB BBB0 0000
  528. add ebp,000000020H ; ebp = M 0000 0000 0000 00GG GGGg gggg + error
  529. sub ecx,edx ; ecx = D 0000 0000 0000 00gg ggg0 0000 dG * 31
  530. shr ebx,5 ; ebx = M 0000 0000 0RRR RR00 000B BBBB
  531. add ecx,ebp ; ecx = M 0000 0000 0000 00GG GGGg gggg
  532. mov edx,ecx ; edx = M 0000 0000 0000 00GG GGGg gggg
  533. and ecx,000000fc0H ; ecx = M 0000 0000 0000 00GG GGG0 0000 NOT NEEDED
  534. shr ecx,6 ; ecx = M 0000 0000 0000 0000 000G GGGG
  535. add esi,2 ; inc src to next pixel v
  536. add ecx,edx ; ecx = M 0000 0000 0000 00GG GGGg gggg
  537. mov ebp,ble16_LastX[esp] ; ebp = Last X Dst addr v
  538. and ecx,000000fc0H ; ecx = M 0000 0000 0000 00GG GGG0 0000
  539. add edi,2 ; inc dst addr v
  540. shr ecx,1 ; D 0000 0000 0000 0GGG GGG0 0000
  541. or ecx,ebx ; ecx = D 0000 0000 0RRR RRGG GGGB BBBB
  542. cmp edi,ebp ; v
  543. mov [edi-2],cx ; store dst pixel u
  544. jnz BlendLoop_16 ; v
  545. ;
  546. ; restore stack frame
  547. ;
  548. BlendReturn_16:
  549. add esp,16
  550. pop esi
  551. pop edi
  552. pop edx
  553. pop ecx
  554. pop ebx
  555. pop ebp
  556. ret 20
  557. vPixelBlend16_565@20 endp
  558. _TEXT$01 ends
  559. end
  560.