Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

DrawDecal.c File Reference

#include "DrawDecal.h"
#include "SoftDrv.h"

Go to the source code of this file.

Functions

geBoolean DRIVERCC DrawDecal (geRDriver_THandle *THandle, RECT *SRect, int32 x, int32 y)

Variables

int32 BWidth
int32 BHeight
int32 BStride
int32 DrawWidth
int32 DrawHeight
int32 EbpAdd
int32 EdiAdd
uint16BBitPtr16
uint8BBitPtr
uint16pScrPtr16bpp
uint32pScrPtr32bpp


Function Documentation

geBoolean DRIVERCC DrawDecal geRDriver_THandle THandle,
RECT SRect,
int32  x,
int32  y
 

Definition at line 34 of file DrawDecal.c.

References BBitPtr, BBitPtr16, BHeight, geRDriver_THandle::BitPtr, tagRECT::bottom, DRV_Window::Buffer, BWidth, ClientWindow, DrawHeight, DrawWidth, DRIVERCC, EbpAdd, EdiAdd, GE_TRUE, geBoolean, DRV_Window::Height, geRDriver_THandle::Height, tagRECT::left, geRDriver_THandle::PalHandle, DRV_Window::PixelPitch, pScrPtr16bpp, pScrPtr32bpp, tagRECT::right, SD_Active, SD_ProcessorHas3DNow, tagRECT::top, U16, U32, U8, DRV_Window::Width, geRDriver_THandle::Width, and y.

00035 {
00036 
00037         if(!SD_Active)
00038         {
00039                 return  GE_TRUE;
00040         }
00041         
00042         BWidth          =THandle->Width;
00043         BHeight         =THandle->Height;
00044         DrawWidth       =THandle->Width;
00045         DrawHeight      =THandle->Height;
00046         
00047         #if 0
00048         if(SD_ProcessorHas3DNow )
00049         {
00050                 U32     *PalPtr;
00051                 BBitPtr         =(U8 *)THandle->BitPtr[0];
00052 
00053                 if ( ! THandle->PalHandle )
00054                         return 0;
00055 
00056                 PalPtr  =(U32 *)THandle->PalHandle->BitPtr[0];
00057 
00058                 if(SRect)
00059                 {
00060                         BBitPtr         +=SRect->top * DrawWidth + SRect->left;
00061                         DrawHeight      =(SRect->bottom - SRect->top);
00062                         DrawWidth       =(SRect->right - SRect->left);
00063                 }
00064 
00065                 if(x < 0)
00066                 {
00067                         if(x + DrawWidth <= 0)
00068                         {
00069                                 return  GE_TRUE;
00070                         }
00071                         BBitPtr         -=x;
00072                         DrawWidth       +=x;
00073                         x                       =0;
00074                 }
00075 
00076                 if(y < 0)
00077                 {
00078                         if(y + DrawHeight <= 0)
00079                         {
00080                                 return  GE_TRUE;
00081                         }
00082                         BBitPtr         -=y * BWidth;
00083                         DrawHeight      +=y;
00084                         y                       =0;
00085                 }
00086                 
00087                 if(x >= ClientWindow.Width)
00088                 {
00089                         return  GE_TRUE;
00090                 }
00091                 if(y >= ClientWindow.Height)
00092                 {
00093                         return  GE_TRUE;
00094                 }
00095 
00096                 if(x + DrawWidth >= (ClientWindow.Width-1))
00097                         DrawWidth -= (x+DrawWidth) - (ClientWindow.Width-1);
00098 
00099                 if(y + DrawHeight >= (ClientWindow.Height-1))
00100                         DrawHeight -=  (y+DrawHeight)- (ClientWindow.Height-1);
00101 
00102                 if(DrawWidth <= 0)
00103                         return GE_TRUE;
00104                 
00105                 if(DrawHeight <= 0)
00106                         return GE_TRUE;
00107 
00108                 pScrPtr32bpp    =(U32 *)(ClientWindow.Buffer);
00109                 pScrPtr32bpp    =&pScrPtr32bpp[y * ClientWindow.Width + x];
00110 
00111                 __asm
00112                 {
00113                         push ecx
00114                         push esi
00115                         push edi
00116                         push ebp
00117 
00118                         mov     ebx,PalPtr
00119 
00120                         mov ebp, pScrPtr32bpp
00121                         mov edi, BBitPtr
00122 
00123                         mov ecx, DrawWidth
00124 
00125                         mov edx, ClientWindow.PixelPitch
00126                         shl ecx,2
00127                         sub edx, ecx
00128                         mov EbpAdd, edx
00129 
00130                         mov edx, BWidth
00131                         mov ecx, DrawHeight
00132                         sub edx, DrawWidth
00133                         mov EdiAdd, edx
00134 
00135 
00136                 NextHeight:
00137                 
00138                         push ecx
00139                         mov ecx, DrawWidth
00140 
00141                         lea     ebp,[4*ecx+ebp]
00142 
00143                         add edi, ecx
00144 //                      shl ecx, 2
00145 //                      add ebp, ecx
00146 
00147                         neg ecx
00148 
00149                         NextWidth:
00150                                 xor     eax,eax
00151                                 mov al, [edi+ecx]
00152                                 
00153                                 cmp al,0ffh
00154                                 je Skip
00155 
00156 //                              cmp al,01h
00157 //                              je Skip
00158 
00159                                 mov     eax,[ebx+eax*4]
00160 
00161                                 mov [ebp+ecx*4], eax
00162 
00163                         Skip:
00164                                 inc ecx
00165                                 jnz NextWidth
00166 
00167                         add ebp, EbpAdd
00168                         add edi, EdiAdd
00169 
00170                         pop ecx
00171                         
00172                         sub ecx, 1
00173                         jnz NextHeight
00174 
00175                         pop ebp
00176                         pop edi
00177                         pop esi
00178                         pop ecx
00179                 }
00180         }
00181         else
00182         #endif
00183         {
00184                 BBitPtr16       =THandle->BitPtr[0];
00185                 if(SRect)
00186                 {
00187                         BBitPtr16       +=SRect->top * DrawWidth + SRect->left;
00188                         DrawHeight      =(SRect->bottom - SRect->top);
00189                         DrawWidth       =(SRect->right - SRect->left);
00190                 }
00191 
00192                 if(x < 0)
00193                 {
00194                         if(x + DrawWidth <= 0)
00195                         {
00196                                 return  GE_TRUE;
00197                         }
00198                         BBitPtr16       -=x;
00199                         DrawWidth       +=x;
00200                         x                       =0;
00201                 }
00202 
00203                 if(y < 0)
00204                 {
00205                         if(y + DrawHeight <= 0)
00206                         {
00207                                 return  GE_TRUE;
00208                         }
00209                         BBitPtr16       -=y*BWidth;
00210                         DrawHeight      +=y;
00211                         y                       =0;
00212                 }
00213                 
00214                 if(x >= ClientWindow.Width)
00215                 {
00216                         return  GE_TRUE;
00217                 }
00218                 if(y >= ClientWindow.Height)
00219                 {
00220                         return  GE_TRUE;
00221                 }
00222 
00223                 if(x + DrawWidth >= (ClientWindow.Width - 1))
00224                 {
00225                         DrawWidth       -=(x + DrawWidth) - (ClientWindow.Width - 1);
00226                 }
00227                 if(y + DrawHeight >= (ClientWindow.Height - 1))
00228                 {
00229                         DrawHeight      -=(y + DrawHeight) - (ClientWindow.Height - 1);
00230                 }
00231 
00232                 if(DrawWidth <= 0)
00233                 {
00234                         return  GE_TRUE;
00235                 }
00236                 if(DrawHeight <= 0)
00237                 {
00238                         return  GE_TRUE;
00239                 }
00240 
00241                 pScrPtr16bpp    =(U16 *)(ClientWindow.Buffer);
00242                 pScrPtr16bpp    =&pScrPtr16bpp[y * (ClientWindow.PixelPitch >> 1) + x];
00243 
00244                 __asm
00245                 {
00246                         push ecx
00247                         push esi
00248                         push edi
00249                         push ebp
00250 
00251                         mov ebp, pScrPtr16bpp
00252                         mov edi, BBitPtr16
00253 
00254                         mov ecx, DrawWidth
00255 
00256                         mov edx, ClientWindow.PixelPitch
00257                         sub edx, ecx
00258                         sub edx, ecx
00259                         mov EbpAdd, edx
00260 
00261                         mov edx, BWidth
00262                         add edx, BWidth
00263                         sub edx, ecx
00264                         sub edx, ecx
00265                         mov EdiAdd, edx
00266 
00267                         mov ecx, DrawHeight
00268 
00269                 NextHeightA:
00270                 
00271                         push ecx
00272                         mov ecx, DrawWidth
00273 
00274                         shl ecx, 1
00275                         add ebp, ecx
00276                         add edi, ecx
00277 
00278                         neg ecx
00279 
00280                         NextWidthA:
00281                                 mov ax, [edi+ecx]
00282                                 
00283                                 cmp ax, 0x1
00284                                 je SkipA
00285 
00286                                 mov [ebp+ecx], ax
00287 
00288                         SkipA:
00289                                 add ecx, 2
00290                                 jnz NextWidthA
00291 
00292                         add ebp, EbpAdd
00293                         add edi, EdiAdd
00294 
00295                         pop ecx
00296                         
00297                         sub ecx, 1
00298                         jnz NextHeightA
00299 
00300                         pop ebp
00301                         pop edi
00302                         pop esi
00303                         pop ecx
00304                 }
00305         }
00306         return GE_TRUE;
00307 }


Variable Documentation

uint8* BBitPtr [static]
 

Definition at line 30 of file DrawDecal.c.

Referenced by DrawDecal().

uint16* BBitPtr16 [static]
 

Definition at line 29 of file DrawDecal.c.

Referenced by DrawDecal().

int32 BHeight [static]
 

Definition at line 26 of file DrawDecal.c.

Referenced by DrawDecal().

int32 BStride [static]
 

Definition at line 26 of file DrawDecal.c.

int32 BWidth [static]
 

Definition at line 26 of file DrawDecal.c.

Referenced by DrawDecal().

int32 DrawHeight [static]
 

Definition at line 27 of file DrawDecal.c.

Referenced by DrawDecal().

int32 DrawWidth [static]
 

Definition at line 27 of file DrawDecal.c.

Referenced by DrawDecal().

int32 EbpAdd [static]
 

Definition at line 28 of file DrawDecal.c.

Referenced by DrawDecal().

int32 EdiAdd [static]
 

Definition at line 28 of file DrawDecal.c.

Referenced by DrawDecal().

uint16* pScrPtr16bpp [static]
 

Definition at line 31 of file DrawDecal.c.

uint32* pScrPtr32bpp [static]
 

Definition at line 32 of file DrawDecal.c.


Generated on Tue Sep 30 12:37:26 2003 for GTestAndEngine by doxygen 1.3.2