Daniel M
October 5th, 2004, 02:27 PM
--------------------------------------------------------------------------------
Iīm working on some directx functions and I need to have full control over the pixeldata pointer to a directdraw surface, It worked in Visual c++ but I get some funny stripe kind of pattern in wince, itīs supposed that the function should fill the surface with red color.
Here is the function:
void SetPixelDataPointer(win* p,IDirectDrawSurface* lpddsurf){
DDSURFACEDESC desc;
DWORD x,y;
ZeroMemory(&desc,sizeof(desc));
desc.dwSize=sizeof(desc);
if(!IDirectDrawSurface_Lock(lpddsurf,NULL,&desc,DDLOCK_SURFACEMEMORYPTR|
DDLOCK_WAIT|DDLOCK_WRITEONLY,0)){
// upload data
p->data = (DWORD*)desc.lpSurface;
p->pitch=desc.lPitch;
//detta ger endast en pekare till pixelarrayen du kan sätta
//hela arrayen mha:
desc.dwHeight=desc.dwHeight;
desc.dwWidth=desc.dwWidth;
for(y=0;y<desc.dwHeight;y++){
for(x=0;x<desc.dwWidth;x++)
#if defined(_WIN32_WCE)
p->data[x]=0xffff;
p->data+=desc.lPitch/2;
#else
p->data[x]=0x00ff0000; //fill whole array with red color
p->data+=desc.lPitch/sizeof(DWORD); //sizeof(DWORD) = 4
#endif
}
}
IDirectDrawSurface_Unlock(lpddsurf,desc.lpSurface);
}
I dont know why it is not working in wince, any ideas?
I hope someone knows something about this, thanks in advance Dani
Iīm working on some directx functions and I need to have full control over the pixeldata pointer to a directdraw surface, It worked in Visual c++ but I get some funny stripe kind of pattern in wince, itīs supposed that the function should fill the surface with red color.
Here is the function:
void SetPixelDataPointer(win* p,IDirectDrawSurface* lpddsurf){
DDSURFACEDESC desc;
DWORD x,y;
ZeroMemory(&desc,sizeof(desc));
desc.dwSize=sizeof(desc);
if(!IDirectDrawSurface_Lock(lpddsurf,NULL,&desc,DDLOCK_SURFACEMEMORYPTR|
DDLOCK_WAIT|DDLOCK_WRITEONLY,0)){
// upload data
p->data = (DWORD*)desc.lpSurface;
p->pitch=desc.lPitch;
//detta ger endast en pekare till pixelarrayen du kan sätta
//hela arrayen mha:
desc.dwHeight=desc.dwHeight;
desc.dwWidth=desc.dwWidth;
for(y=0;y<desc.dwHeight;y++){
for(x=0;x<desc.dwWidth;x++)
#if defined(_WIN32_WCE)
p->data[x]=0xffff;
p->data+=desc.lPitch/2;
#else
p->data[x]=0x00ff0000; //fill whole array with red color
p->data+=desc.lPitch/sizeof(DWORD); //sizeof(DWORD) = 4
#endif
}
}
IDirectDrawSurface_Unlock(lpddsurf,desc.lpSurface);
}
I dont know why it is not working in wince, any ideas?
I hope someone knows something about this, thanks in advance Dani