中国开发网: 论坛: Visual C: 贴子 504165
没脾气2x:靠。这竟然是以前我写的代码???
[code=c++] HRESULT extern _stdcall GDIAlphaBlendByAlphaChannel_16( WORD *dst, long dpitch, Rect *dstRect, WORD *src, long spitch, long sx, long sy, WORD *bufAlpha) { long srcoffset, dstoffset; srcoffset = sy*spitch + sx*2, dstoffset = dstRect->top*dpitch + dstRect->left*2; register __int64 ALPHA_MASK = MASKSHIFT*0x1F; register __int64 KEYCOLOR = MASKSHIFT*0x1F; register __int64 XXB = 0x0001000100010001; register __int64 XXG = 0x0020002000200020; register __int64 XXR = 0x0400040004000400; register __int32 alphaesi; long w=(dstRect->right-dstRect->left)>>2<<3, h=dstRect->bottom-dstRect->top; if(w<=0) return 0; _asm { // spitch, dpitch 入栈 mov eax,spitch; push eax mov ebx,dpitch push ebx; mov esi,bufAlpha add esi,srcoffset mov alphaesi, esi mov esi,src; add esi,srcoffset; mov edi,dst add edi,dstoffset ALIGN 8 mov edx,h;//H start: mov ecx,w;// iDstW/4 shr ecx,3; nextpoint: movq mm0, [edi]; // dst data movq mm1, [esi]; // override data // 取 alpha 值到 mm5 push esi; mov esi, alphaesi; movq mm5, [esi]; // alpha pop esi; pand mm5, MASKB; // 跳过大面积 0 或 1f movq mm7, mm5; psrlq mm7, 24; por mm7, mm5; movd ebx, mm7; cmp ebx, 0x00000000; jz valuenotchange; //valueany: //pmullw mm5, MASKSHIFT; /* movq mm6,mm1 pcmpeqw mm6,KEYCOLOR pandn mm6,mm5; */ movq mm6,mm5; //paddw mm6, XXB; // 结果 mm7 清零 pxor mm7,mm7; //b movq mm2,mm0; pand mm2,MASKB; //paddsw mm2,XXB; // alpha 级别调整 movq mm5,mm1; pand mm5,MASKB; psubw mm5,mm2; pmullw mm5,mm6; psrlw mm5,5; paddw mm2,mm5; pand mm2,MASKB; paddusw mm7,mm2; //g movq mm3,mm0; pand mm3,MASKG; //paddsw mm3,XXG; // alpha 级别调整 movq mm5,mm1; pand mm5,MASKG; psrlw mm5,5; psrlw mm3,5; psubw mm5,mm3; pmullw mm5,mm6; psrlw mm5,5; paddw mm3,mm5; psllw mm3,5; pand mm3,MASKG; paddusw mm7,mm3; //r movq mm2,mm0; pand mm2,MASKR; //paddsw mm2,XXR; // alpha 级别调整 movq mm5,mm1; pand mm5,MASKR; psrlw mm5,10; psrlw mm2,10; psubw mm5,mm2; pmullw mm5,mm6; psrlw mm5,5; paddw mm2,mm5; psllw mm2,10; pand mm2,MASKR; paddusw mm7,mm2; //valuefinal: // 存储结果 movq [edi],mm7; valuenotchange: // 地址前进 add esi,8; add edi,8; add alphaesi,8; dec ecx; cmp ecx,0; jnz nextpoint; // NEXT_LINE: pop ebx; pop eax; add esi,eax; sub esi,w; push ecx; add alphaesi,eax; mov ecx,w; sub alphaesi,ecx; pop ecx; add edi,ebx; sub edi,w; push eax; push ebx; // 下一行 dec edx; cmp edx,0; jnz start; //DONE: // spitch, dpitch 出栈 pop ebx; pop eax; emms; } } [/code]
Notemper2x 3.1 ( ̄ε( ̄#)
没脾气2x 之 个人综合篇: http://notemper2x.cndev.org/
我的 panoramio 相册: http://panoramio.com/user/zhaixudong
我的 flickr相册: http://www.flickr.com/photos/notemper2x/



QQ号20250出售,售价400,000元整(5位、皇冠80级、VIP7)

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录