Re: Vrooom



On Fri, 2002-01-04 at 14:32, Sven Neumann wrote:
> Hi,
> 
> Owen Taylor <otaylor redhat com> writes:
> 
> > I'm about to commit the attached (quite large) patch. It's all about
> > accelerating alpha compositing of images with and without the RENDER
> > extension, though it has random bug fixes scattered in it.
> 
> nice. Now if we could change GdkPixbuf to hold the data as ARGB
> instead of the stupid RGBA format, compositing pixbufs could become
> really efficient.  No hardware that I know of supports RGBA surfaces.

While I am in favor of this change (I'm really in favor of anything that
makes GdkPixbuf work faster), I would like to suggest a set of macros to
go along with it:

#define GDK_PIXBUF_RED_OFFSET 1
#define GDK_PIXBUF_GREEN_OFFSET 2
#define GDK_PIXBUF_BLUE_OFFSET 3
#define GDK_PIXBUF_ALPHA_OFFSET 0
#define GDK_PIXBUF_PIXEL_WIDTH 3
#define GDK_PIXBUF_PIXEL_WIDTH_WITH_ALPHA 4

This way changes like this would not break things if they needed to be
done again (it also would make code which edits a pixbuf much easier to
read).

pixel_width = (gdk_pixbuf_has_alpha (pixbuf) ?
GDK_PIXBUF_PIXEL_WIDTH_WITH_ALPHA : GDK_PIXBUF_PIXEL_WIDTH);

is much cleaner than putting a (has_alpha?4:3) test for every pixel in
gdk-pixbuf-utils.c (ahem).

    Jim Cape
    http://www.ignore-your.tv

    "No cause, no God, no abstract idea can justify the mass
     slaughter of innocents."
        -- Edward Said




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]