Re: [PATCH] Autocompletion list image scaling for HiDPI/Retina displays
Mitchell <[email protected]> Mon, 12 May 2025 09:35:18 -0400
| Newsgroups | gmane.comp.lib.scintilla.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Neil, > On May 11, 2025, at 11:31 PM, Neil Hodgson <[email protected]> wrote: > > Hi Mitchell, > >> Attached is a patch and zip against Scintilla 5.5.6 that implements ... > > There are some warnings from compilers and linters so I made some more > changes that silenced these. Thanks. I’m not sure why my compiler didn’t catch some of those. >> The only questionable bit in my opinion is the GTK implementation switches the list store image column type to CAIRO_GOBJECT_TYPE_SURFACE from GDK_TYPE_PIXBUF. Not only does this require the <cairo/cairo-gobject.h> header (which is included with my default libgtk-3-dev installation), > > If this may be missing, there may be a need for a more complex check > with a __has_include(<cairo/cairo-gobject.h>) I figured if my libgtk-3-dev includes it, perhaps all or most distributions have it too. You know more about GTK than me though. >> but it also performs a copy for each pixbuf to be included in the list. This copy is necessary because Cairo surfaces store device scale, not GDK Pixbufs[2]. The list store takes ownership of the surface (it’s a boxed pointer), and will free it when done[3]. I was not able to figure out how to create a Cairo surface from an incoming pixbuf, g_object_ref() it, and pass it to the list store directly (thus avoiding copies and a premature deallocation). > > I was originally unconcerned but this is a new allocation for each row > that shows an image. Probably not too bad in normal use. In my testing with language servers that can return over 100 autocompletion items for me to show, I haven’t noticed any issues. I was initially concerned about the allocations and tried hard to avoid them, but I don’t know enough about GTK, Cairo, and GObject to keep a single copy of a Cairo surface around long enough; those surfaces were constantly being deallocated and my images were being drawn corrupted. I learned to live with the allocations and found that it wasn’t noticeable at all. Cheers, Mitchell -- You received this message because you are subscribed to the Google Groups "scintilla-interest" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/DFBC12CD-5ED5-4294-8735-D5C119DCFA21%40foicica.com.