None of that seems to apply since:
A. All my variables, with the exception of SCREEN_WIDTH are declared within the function
B. Color is defined as follows:
Code:
DWORD color = _RGB16BIT565(0,(index_y >> 3),0);
With _RGB16BIT565:
Code:
#define _RGB16BIT565(r,g,b) ((b & 31) + ((g & 63) << 5) + ((r & 31) << 11))
Edit:
Heres the full part of the function:
Code:
for (int index_y=0; index_y < SCREEN_HEIGHT; index_y++)
{
// build color word up
DWORD color = _RGB16BIT565(0,(index_y >> 3),0);
// replicate color in upper and lower 16 bits of 32-bit word
color = (color) | (color << 16);
// now color has two pixel in it in 16.16 or RGB.RGB format, use a DWORD
// or 32-bit copy to move the bytes into the next video line, we'll need
// inline assembly though...
// draw next line, use a little inline asm baby!
asm
(
"push edi;"
"les edi, [video_buffer];"
"mov eax, [color];"
"mov ecx, [SCREEN_WIDTH];"
"shr ecx, 1;"
"rep stosd;"
"pop edi;"
);
// now advance video_buffer to next line
video_buffer += (ddsd.lPitch >> 1);
}