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.

679 lines
23 KiB

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