From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Pfrommer, Julius" Newsgroups: gmane.emacs.devel Subject: Unifying code for drawing on a cairo context Date: Sat, 23 Apr 2022 11:06:16 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34275"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 23 11:07:51 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1niBk7-0008oH-Ey for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Apr 2022 11:07:51 +0200 Original-Received: from localhost ([::1]:49214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niBk6-0001ah-8R for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Apr 2022 05:07:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niBik-0000pF-Oe for emacs-devel@gnu.org; Sat, 23 Apr 2022 05:06:27 -0400 Original-Received: from mout.web.de ([212.227.17.11]:60619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niBih-0005Rp-PC for emacs-devel@gnu.org; Sat, 23 Apr 2022 05:06:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1650704778; bh=SJ3Cc4oARZiIMh6TskdeFP4eKOgO3DkzUgx+5sAayxg=; h=X-UI-Sender-Class:Date:To:From:Subject; b=sLyV38XALXBLRruKu7PYGD53fNtKf/lqBXLbx2Wc2ywCCjuwTbycRyTJl4yTagxXC akQglJkL+1JysIg11ikSt1cGY6z7XcWlit1jdRhN1WNyuGiVuEpzkBgxyfBgScSfkJ A1SzLeSpppgrddydkgN0TrdDzNnJ7Rc2WTQrvgYo= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from [192.168.1.12] ([90.126.108.10]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MOlwj-1nXQV43UnX-00QGYS for ; Sat, 23 Apr 2022 11:06:18 +0200 Content-Language: en-US X-Provags-ID: V03:K1:hBIsk7WRtbLYYQZZ9ii5J1/RHq9iC17PEwnBg6OwvnG9JvQZl55 +bwEPElPdbG8hSjJ2G2LRB325d3htRBPJWO6sLPhzN3WniSueW+pHi0BO51ssRwtG10Qwbv WbYhLQR8hFovljzxFy434hVtWFe06j4xPBFOkOtj81dlYCY0iziZGpU89s+4rgZgePA9Qk/ wWIKdrVXtr2cGS4FMBq/w== X-UI-Out-Filterresults: notjunk:1;V03:K0:z8dmp0H4MwQ=:R6sGEK2P1Gof+MnetMtDbe 6a/wVDpKKI3ZklEpJPyQ6LkCdT/m9wmT9I25oXvA8sZf0zbKbLlvh4eexqv11Uq3Ic+YTvKGR KH72IH4V/wkM76yoFj0m0BLgIp4R+25MJLZ8A3iaaAsOazYrL9zyYxgzakRtsvqv6RYtdTOoZ Aep09OcZ70XWJWZxdKHzyV0aAmVhurN0PYLFWBld0fHL0sXazelbWdakQBstxGpyA4W+s/d+x KJItzD8fOFTTZevLZ+6ss8GHDv1jb3E7rrjzzBNDnQoWx8NwW+2t1pPmKG0ZiIdooddxByACn gKseD6ZVLTI343m7WHv1PZYnXiUXLQvTa059v+Zuszwl+ctCXdYKwe2h5JQ7DaFWSZI8ojcI9 xm3Ne5TB9vaKcp4L4wAl/YwgGhH6849dWmFZ5ko/rMCOq/in+HZLH17bM0vOsyX5LU1Wr1CGC iyb3g4M+qxLi6IUYA+odiy6wbbPnjen6i9cXV3/muKFwj1AJ9sMcSHIswGCBaw5/jUXVm5+/x gAoiqOOGFVFZIJW5U2nxs7Ttlz/dwG8y3OXBFAD+iG7xKNx67b4CfYGFLiz+9gi+UVQuTQY+q MXoCDmNWtnXzlopx4GWWDmKNbHj6Gd5P44aq5mFEplMNKEKPg/AmdArZ1Wtm9HVEn3NqE97RX UmBdQO9X7cJ5Gd9FpFuHixYfhICFa+Cx+bY08v9FIjCnLWFmZsLnbcQW8k+ngGgVCzPi5psla yhb+ScYX9h7G3hvLKZy4yzJtZvCV2+yxxddbplvBflzOBiTw5+G8s0/+dc6Wg4mewhMHLHF+ Received-SPF: pass client-ip=212.227.17.11; envelope-from=julius.pfrommer@web.de; helo=mout.web.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:288814 Archived-At: The X and the PGTK toolkits both support a cairo "glass". Their code for drawing on a cairo context is virtually identical. Yet the implementations have started to diverge. As an example, x_draw_horizontal_wave and pgtk_draw_horizontal_wave are virtually the same. But the X implementation takes a "GC" graphics context, whereas the PGTK implementation now takes a "color" integer argument. https://git.savannah.gnu.org/cgit/emacs.git/tree/src/xterm.c#n5155 https://git.savannah.gnu.org/cgit/emacs.git/tree/src/pgtkterm.c#n1995 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). But I'm unsure about how this fits with ongoing development and which conventions to follow. - Would the unified cairo function be called cairo_draw_horizontal_wave, establishing a new cairo_ prefix convention? - 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). - Is it okay to create the files cairoterm.h/.c or can we expect functionality beyond "term" to be added over time as well? Regards, Julius