Vesa_2D_Blit\r
};\r
\r
-//CODE\r
+// === CODE ===\r
int Vesa_Install(char **Arguments)\r
{\r
tVesa_CallInfo *info;\r
);\r
\r
// Sanity Check\r
- if(y > heightInChars) {\r
+ if(y >= heightInChars) {\r
LEAVE('i', 0);\r
return 0;\r
}\r
\r
void Vesa_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H)\r
{\r
- int scrnwidth = gVesa_Modes[giVesaCurrentMode].width;\r
- int dst = DstY*scrnwidth + DstX;\r
- int src = SrcY*scrnwidth + SrcX;\r
+ int scrnpitch = gVesa_Modes[giVesaCurrentMode].pitch;\r
+ int dst = DstY*scrnpitch + DstX;\r
+ int src = SrcY*scrnpitch + SrcX;\r
int tmp;\r
\r
//Log("Vesa_2D_Blit: (Ent=%p, DstX=%i, DstY=%i, SrcX=%i, SrcY=%i, W=%i, H=%i)",\r
// Ent, DstX, DstY, SrcX, SrcY, W, H);\r
\r
- if(SrcX + W > scrnwidth)\r
- W = scrnwidth - SrcX;\r
- if(DstX + W > scrnwidth)\r
- W = scrnwidth - DstX;\r
+ if(SrcX + W > gVesa_Modes[giVesaCurrentMode].width)\r
+ W = gVesa_Modes[giVesaCurrentMode].width - SrcX;\r
+ if(DstX + W > gVesa_Modes[giVesaCurrentMode].width)\r
+ W = gVesa_Modes[giVesaCurrentMode].width - DstX;\r
if(SrcY + H > gVesa_Modes[giVesaCurrentMode].height)\r
H = gVesa_Modes[giVesaCurrentMode].height - SrcY;\r
if(DstY + H > gVesa_Modes[giVesaCurrentMode].height)\r
H = gVesa_Modes[giVesaCurrentMode].height - DstY;\r
\r
+ //Debug("W = %i, H = %i", W, H);\r
+ \r
if( dst > src ) {\r
// Reverse copy\r
- dst += H*scrnwidth;\r
- src += H*scrnwidth;\r
+ Debug("Reverse scroll");\r
+ dst += H*scrnpitch;\r
+ src += H*scrnpitch;\r
while( H -- ) {\r
- dst -= scrnwidth;\r
- src -= scrnwidth;\r
+ dst -= scrnpitch;\r
+ src -= scrnpitch;\r
tmp = W;\r
for( tmp = W; tmp --; ) {\r
- *((Uint32*)gpVesa_Framebuffer + dst + tmp) = *((Uint32*)gpVesa_Framebuffer + src + tmp);\r
+ *(Uint32*)(gpVesa_Framebuffer + dst + tmp) = *(Uint32*)(gpVesa_Framebuffer + src + tmp);\r
}\r
}\r
}\r
else {\r
// Normal copy is OK\r
+ Debug("memcpy scroll");\r
while( H -- ) {\r
- memcpy((Uint32*)gpVesa_Framebuffer + dst, (Uint32*)gpVesa_Framebuffer + src, W);\r
- dst += scrnwidth;\r
- src += scrnwidth;\r
+ memcpy((void*)gpVesa_Framebuffer + dst, (void*)gpVesa_Framebuffer + src, W);\r
+ dst += scrnpitch;\r
+ src += scrnpitch;\r
}\r
}\r
}\r