Pixrect line padding

what is the definition of broth? david at sun.com
Wed Jan 31 05:47:05 AEST 1990


In v8n229 canon!smith at nsfnet-relay.ac.uk (Mark Smith) is unhappy about the
following exchange:

>> >My 4.0.3 documentation says
>> >that for pixrects of width > 16 scan lines are padded out to a 32 bit
>> >boundary.
>> 
>> Read the documentation carefully -- this is describing pixrects created by
>> mem_create().  The minimum padding requirement is still 16 bits.

He quotes:

>In the Memory Pixrects chapter of the Pixrect Reference Manual:
>
>    The mpr_linebytes macro computes the bytes per line of a primary memory
>    pixrect given its width in pixels and the bits per pixel. This includes
>    the padding to word bounds. It is useful for incrementing pixel addresses
>    in the y direction or calculating line padding in the bitmap.
>
>Next comes the definition of mpr_linebytes, which is *wrong* because it has
>the number 15 hardcoded. Next comes a helpful example with the description:
>
>    Note how the mpr_linebytes macro is used to find the number of bytes
>    used to hold a line of a memory pixrect.

Mark is quite correct that these statements are misleading and should have
been updated when 32 bit padded pixrects were introduced.

However, the definition of mpr_linebytes() in the manual is not wrong and
is in fact what you will find in <pixrect/memvar.h>.  The macro has not
changed, it is just not as useful as it once was.  (It is now only used
for static pixrects and mem_point().)

>As for "look at md_linebytes instead of assuming a particular padding
>algorithm", I think most people would reasonably assume that using a
>provided macro should be safer than accessing a data structure member
>directly.

You can use the mpr_mdlinebytes() macro if you prefer.  However, since the
data structures are also printed in the manual it would be impractical to
change them.

David DiGiacomo, Sun Microsystems, Mt. View, CA  sun!david david at eng.sun.com



More information about the Comp.sys.sun mailing list