Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualKhatharr

Posted 28 December 2012 - 08:52 PM

Aye, you always want to try to have a direct relationship between the number that fills a buffer and the number that was used to create it.

 

+1 Bregma

 

Meanwhile, you're doing a bit of extra work here, so I thought I'd make a suggestion:

 

You're reading into the array 'pixelInfo', but your real target is the bitmap data. Why not try something like:

 

unsigned char* texelPtr = bitmapArray; //roaming pointer that will traverse the data
unsigned char* texelEnd = texelPtr + (the length of the array); //this pointer value indicates the first overflow byte

while(texelPtr < texelEnd) {
    reader.read(texelPtr, 3);
    texelPtr[3] = 255;
    texelPtr += 4;
}

Which would eliminate the double-copy behavior?


#1Khatharr

Posted 28 December 2012 - 08:50 PM

Aye, you always want to try to have a direct relationship between the number that fills a buffer and the number that was used to create it.

 

+1 Bregma

 

Meanwhile, you're doing a bit of extra work here, so I thought I'd make a suggestion:

 

You're reading into the array 'pixelInfo', but your real target is the bitmap data. Why not try something like:

 

unsigned char* texelPtr = bitmapArray; //roaming pointer that will traverse the data
unsigned char* texelEnd = texelPtr + (the length of the array); //this pointer value indicates the first overflow byte

while(texelPtr < texelEnd) {
    reader.read(texelPtr, 3);
    texelPtr += 3;
    texelPtr++ = 255;
}

Which would eliminate the double-copy behavior?


PARTNERS