Guest User

Untitled

a guest
Mar 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. void XStretchBlt16(unsigned char * pBB,int sdx,int sdy,int ddx,int ddy)
  2. {
  3. unsigned short * pSrc=(unsigned short *)pBackBuffer;
  4. unsigned short * pSrcR=NULL;
  5. unsigned short * pDst=(unsigned short *)pBB;
  6. unsigned long * pDstR=NULL;
  7. int x,y,cyo=-1,cy;
  8. int xpos, xinc;
  9. int ypos, yinc,ddx2=ddx>>1;
  10. #ifdef USE_DGA2
  11. int DGA2fix;
  12. int dga2Fix;
  13. if (!iWindowMode)
  14. {
  15. DGA2fix = (char*)pBB == Xpixels;
  16. dga2Fix = dgaDev->mode.imageWidth - dgaDev->mode.viewportWidth;
  17. } else DGA2fix = dga2Fix = 0;
  18. #endif
  19.  
  20. // 2xsai stretching
  21. if(iUseNoStretchBlt>=2)
  22. {
  23. //p2XSaIFunc(pBackBuffer,sdx<<1,(unsigned char *)pSaIBigBuff,sdx,sdy);
  24. if(p2XSaIFunc==hq2x_16 )
  25. p2XSaIFunc(pBackBuffer,sdx<<2,(unsigned char *)pSaIBigBuff,sdx,sdy);
  26. else if(p2XSaIFunc==hq3x_16)
  27. p2XSaIFunc(pBackBuffer,sdx*6,(unsigned char *)pSaIBigBuff,sdx,sdy);
  28. else
  29. p2XSaIFunc(pBackBuffer,sdx<<1,(unsigned char *)pSaIBigBuff,sdx,sdy);
  30. pSrc=(unsigned short *)pSaIBigBuff;
  31. //sdx+=sdx;sdy+=sdy;
  32. if(iUseNoStretchBlt>=12)
  33. {
  34. sdx= sdx*3;
  35. sdy=sdy*3;
  36. }
  37. else
  38. sdx+=sdx;sdy+=sdy;
  39. }
  40.  
  41. xinc = (sdx << 16) / ddx;
  42.  
  43. ypos=0;
  44. yinc = (sdy << 16) / ddy;
  45.  
  46. for(y=0;y<ddy;y++,ypos+=yinc)
  47. {
  48. cy=(ypos>>16);
  49.  
  50. if(cy==cyo)
  51. {
  52. #ifndef USE_DGA2
  53. pDstR=(unsigned long *)(pDst-ddx);
  54. #else
  55. pDstR=(unsigned long *)(pDst-(ddx+dga2Fix));
  56. #endif
  57. for(x=0;x<ddx2;x++) *((unsigned long*)pDst)++=*pDstR++;
  58. }
  59. else
  60. {
  61. cyo=cy;
  62. pSrcR=pSrc+(cy*sdx);
  63. xpos = 0;
  64. for(x=ddx;x>0;--x)
  65. {
  66. pSrcR+= xpos>>16;
  67. xpos -= xpos&0xffff0000;
  68. *pDst++=*pSrcR;
  69. xpos += xinc;
  70. }
  71. }
  72. #ifdef USE_DGA2
  73. if (DGA2fix) pDst+= dga2Fix;
  74. #endif
  75. }
  76. }
Add Comment
Please, Sign In to add comment