0

I have an attachment PDF with pixel alignment.

Then I have this code which assigns short integer to appropriate pixels.

void CMFC3xxDevice::prepare_data_decompress(data_package_ex &pdata)
{

		char *input = (char*) pdata.pData;
		int incount=pdata.cbData;
		int finalarray_pos = 0;
		DWORD dwTempBufferSize = pdata.cbData;
		for(int i = 0; i < incount; i+=3)
		{
			MFC3XXPixelAlignment *pSourcePixel = reinterpret_cast<MFC3XXPixelAlignment*>((char *)input+i);	    		
			//pSourcePixel->bytes[0] = (final_array[finalarray_pos]& 0xff;
			//pSourcePixel->bytes[1] = (final_array[finalarray_pos] & 0xf0)+(final_array[finalarray_pos+1]& 0xf00);
			//pSourcePixel->bytes[2] = (final_array[finalarray_pos+1] & 0xff0);
			pSourcePixel->bytes[0] = final_array[finalarray_pos]& 0xff;
			pSourcePixel->bytes[1] = ((final_array[finalarray_pos] & 0xf00)<<4)+(final_array[finalarray_pos+1]& 0xf);
			pSourcePixel->bytes[2] = (final_array[finalarray_pos+1] & 0xff0)<<4;
			finalarray_pos++;

		}


}

I am having memory violation when debugging the code.

Any ideas:

Thank you.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Salem
0

So run it in the debugger, and find the line of code which actually triggers the memory fault.

Don't just post a few lines of code for your "best guess" and ask "what does this look like?"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.