In gtk+4, GdkPixbuf has been replaced by cairo_surface_t in many functions.

A cairo_surface_t pointer is wrapped in a Cairo::RefPtr<Cairo::Surface>. There are two alternatives for wrapping a returned cairo_surface_t pointer when it's a nullptr.

1. Cairo::make_refptr_for_instance<Cairo::Surface>(nullptr)
2. Cairo::make_refptr_for_instance<Cairo::Surface>(new Cairo::Surface(nullptr, has_reference))

Alternative 2 is used in gtkmm methods that have previously returned a Cairo::RefPtr<Cairo::Surface>. Alternative 1 is more like how subclasses of GObject are wrapped. The wrap() functions in glibmm and gtkmm return a nullptr if they are given a nullptr to wrap. I would recommend alternative 1 also for cairomm objects. Other opinions? I suppose that there has been a reason for choosing alternative 2.

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to