emacs-devel
[Top][All Lists]
Advanced

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

Re: Unifying code for drawing on a cairo context


From: Eli Zaretskii
Subject: Re: Unifying code for drawing on a cairo context
Date: Sat, 23 Apr 2022 12:18:13 +0300

> Date: Sat, 23 Apr 2022 11:06:16 +0200
> From: "Pfrommer, Julius" <julius.pfrommer@web.de>
> 
> Obviously maintaining duplicate code is an anti-pattern. I'd like to
> pull out common cairo functionality bit-by-bit into methods to be used
> by both the X and the PGTK toolkit.
> 
> With the cairo primitives unified between X and PGTK, adding a cairo
> "glass" for more toolkits should also become easier as a future option
> (ns, haiku, w32).

In general, I don't think we'd object to having such Cairo-specific
code in one place.  However, having GUI code common to all the GUI
backends in one place is more important, so if this Cairo-specific
module will make that common code less so, it would be a step
backward, IMO.  IOW, as long as the effort to have Cairo-specific code
in one place doesn't "invade" on the common code, it is welcome, I
think.

> - Would the unified cairo function be called cairo_draw_horizontal_wave,
> establishing a new cairo_ prefix convention?

Yes, why not?

> - Should such functions generally take an immediate cairo_t context as
> input or some "larger" struct that includes that cairo_t and can be
> extended in the future (e.g. with foreground and background color
> information).

It could, if that leads to a clean code that is easy to understand and
maintain.  I'm not sure why you are asking this, or what would be the
alternative.

> - Is it okay to create the files cairoterm.h/.c or can we expect
> functionality beyond "term" to be added over time as well?

Yes.  But again, as long as this doesn't make the common GUI code we
already have less common.

Thank you for your interest in Emacs.

P.S. You don't seem to have copyright assignment on file.  As I
presume this work will produce substantial changes in the code, I'd
encourage you to start your legal paperwork rolling at this time, so
that we could accept your contributions without any limitations.  If
you agree, I will send you the form to start the paperwork.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]