Re: Inlining pixbufs



On 23 Jun 2000, Havoc Pennington wrote:

> 
> Tim Janik <timj@gtk.org> writes: 
> > glancing at your patch, you're saving the pixels as a const guchar
> > array.
> > i did quite some testing back then and can say, saving arrays
> > has enourmous disadvantages, quoting the Gimp's ChangeLog
> > (and thus me, but who cares ;):
> > 
> 
> You're still saving an array, right, just a compressed one?

nope, i'm using a string, that should be evident from the changelog
entries.

> What I mean is, does this change the public interface at all or does
> gdk_pixbuf_new_from_inline() still work? If it doesn't change the
> public interface it might be good to get things working like this,
> since we are trying to nail down the API, and then we can tune
> efficiency later.

i'm not sure what exact API you proposed, for beast i have:

BseIcon* bse_icon_from_pixdata (const BsePixdata *pixdata);

with

typedef struct  _BsePixdata             BsePixdata;
typedef enum                    /*< skip >*/
{
  BSE_PIXDATA_RGB               = 3,
  BSE_PIXDATA_RGBA              = 4,
  BSE_PIXDATA_RGB_MASK          = 0x07,
  BSE_PIXDATA_1BYTE_RLE         = (1 << 3),
  BSE_PIXDATA_ENCODING_MASK     = 0x08
} BsePixdataType;
struct _BsePixdata
{
  BsePixdataType type : 8;
  guint          width : 12;
  guint          height : 12;
  const guint8  *encoded_pix_data;
};

something similar probably wouldn't be a bad idea for gdk_pixbuf, we
can easily have a PixdataType flag that would indicate sharing of
of static uncompressed data. and that interface is extensible for
future refinements, such as more complicated compression algorithms
for instance.

> I guess it clearly obsoletes the copy_data arg from
> gdk_pixbuf_new_from_inline(). (which is possibly a problem, in some
> situations leaving that data in read-only shared memory could be
> good).
> 
> Alternatively we can allow the user to specify compressed or no when
> they invoke the image-to-inline command, and new_from_inline() can
> read either one.

you didn't look at bse_icon_from_pixdata() or CSource, right? all
that logic is already there ;)

> 
> Havoc
> 

---
ciaoTJ





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