Bug in PhCreateImage

PhCreateImage is not calculating the BPL correctly for an image, it should
be
padded out to 4 byte boundaries.

I am using the following code to fix it.

image->bpl = ((image->bpl+3)/4)*4)

Jerry Kirk

Which image type is it doing this for? I don’t believe they all have to be
padded that way.


Jerry Kirk <Jerry.Kirk@nexwarecorp.com> wrote:

PhCreateImage is not calculating the BPL correctly for an image, it should
be
padded out to 4 byte boundaries.

I am using the following code to fix it.

image->bpl = ((image->bpl+3)/4)*4)

Jerry Kirk

dleblanc@qnx.com wrote:

Which image type is it doing this for? I don’t believe they all have to be
padded that way.



Jerry Kirk <> Jerry.Kirk@nexwarecorp.com> > wrote:
PhCreateImage is not calculating the BPL correctly for an image, it should
be
padded out to 4 byte boundaries.

I am using the following code to fix it.

image->bpl = ((image->bpl+3)/4)*4)

The padding needs to be four bytes for bitmaps (i.e. 1 bit per pixel).

For all other images, it should be 8 pixels. That means if your image is a
24 bit per pixel image, the granularity is 24 bytes.

It may seem excessive, but this guarantees that all graphics hardware
mechanisms we know of and can anticipate will work. If you don’t pad like
that, we may have to use the CPU to do some operations that would have been
done using the hardware if the padding allowed it.

<pete@qnx.com> wrote in message news:8v3n5h$5n1$2@nntp.qnx.com

dleblanc@qnx.com > wrote:
Which image type is it doing this for? I don’t believe they all have to
be
padded that way.


Jerry Kirk <> Jerry.Kirk@nexwarecorp.com> > wrote:
PhCreateImage is not calculating the BPL correctly for an image, it
should
be
padded out to 4 byte boundaries.

I am using the following code to fix it.

image->bpl = ((image->bpl+3)/4)*4)

The padding needs to be four bytes for bitmaps (i.e. 1 bit per pixel).

For all other images, it should be 8 pixels. That means if your image is
a
24 bit per pixel image, the granularity is 24 bytes.

It may seem excessive, but this guarantees that all graphics hardware
mechanisms we know of and can anticipate will work. If you don’t pad like
that, we may have to use the CPU to do some operations that would have
been
done using the hardware if the padding allowed it.

that may explain it … I will go back and look… thanks