Re: Event woes for items with irregular shapes



On Tue, 04 Sep 2018 13:12:48 +0300,
Damon Chaplin wrote:
On Sat, 2018-09-01 at 01:39 +0300, Yavor Doganov wrote:
Also note that if you care about portability to old (pre-C99)

glib defines a guint32 which we can use for this.

OK.

It might be a bit safer to do:

  if (cairo_image_surface_get_format (surface) != CAIRO_FORMAT_ARGB32)
     return TRUE;

as its the only format we can handle.

OK, although my impression is that both formats are supported:

goo_canvas_cairo_surface_from_pixbuf (GdkPixbuf *pixbuf)
{
...
  if (n_channels == 3)
    format = CAIRO_FORMAT_RGB24;
  else
    format = CAIRO_FORMAT_ARGB32;

And then you pass format to cairo_image_surface_create_for_data.

We should also check it is an image surface,

Right, I was confused initially because items are usually created with
a pixbuf which guarantees it's going to be an image surface.  But that
is not the only possibility.

and maybe double-check we don't go off the end of the buffer.

Is this possible at all?  I'm afraid I don't understand.

Attached is an updated patch that addresses your remarks (except the
last one).

Attachment: goocanvasimage-opacity-2.patch
Description: Text document



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