From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Removing assumption of unsigned long pixel values for colours Date: Mon, 06 May 2019 05:45:56 +0300 Message-ID: <83pnowjo63.fsf@gnu.org> References: <87v9yqjdnh.fsf@gmail.com> <83a7g2kqsi.fsf@gnu.org> <87lfzlkeic.fsf@gmail.com> <83zho0khdu.fsf@gnu.org> <87h8a8k84a.fsf@gmail.com> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="28494"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Alex Gramiak Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 06 04:46:24 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNTe4-0007Kr-2s for ged-emacs-devel@m.gmane.org; Mon, 06 May 2019 04:46:24 +0200 Original-Received: from localhost ([127.0.0.1]:49228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNTe3-0006vA-2z for ged-emacs-devel@m.gmane.org; Sun, 05 May 2019 22:46:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNTdv-0006v3-Ju for emacs-devel@gnu.org; Sun, 05 May 2019 22:46:16 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNTdv-0000RD-6i; Sun, 05 May 2019 22:46:15 -0400 Original-Received: from [176.228.60.248] (port=3508 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hNTdu-0002at-Iy; Sun, 05 May 2019 22:46:14 -0400 In-reply-to: <87h8a8k84a.fsf@gmail.com> (message from Alex Gramiak on Sun, 05 May 2019 13:35:01 -0600) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236188 Archived-At: > From: Alex Gramiak > Cc: emacs-devel@gnu.org > Date: Sun, 05 May 2019 13:35:01 -0600 > > It's certainly possible that I'm overestimating the cost of the > conversions. It just doesn't seem good to have to do this conversion for > every draw operation. > > Perhaps I should follow the old adage and just use unsigned long with > conversions first and benchmark after. Yes, please. > > . it leaks to platform-independent parts of the code representation > > that is specific to one platform, something that goes against > > everything you've been doing lately in your other work > > I'm not sure what leaks you're referring to here. The cases that use > .pixel directly should only be in the TTY-specific or X-specific code. No, I meant the RGBA representation. The integer color values are our current abstraction. > > . the union you propose has no indication which of its > > interpretations is being used, which will lead to bugs > > I considered that, but as it looks like faces are tied to frames (which > are tied to terminals), then the type shouldn't need to be checked as > long as the terminal-independent code doesn't alter it. That "as long as" part is already a potential problem. And I see other opportunities for exciting bugs. > > (larger structures slow down Emacs) > > More so than other programs? Why should other programs matter here? I don't want to have slow-down in the inner-most loops of Emacs, because that causes legitimate user complaints. Faces are used in redisplay. > > If we want to increase the number of bits per pixel we support in > > Emacs, we need to do that for all the platforms. Currently, they all > > are aligned on 32 bpp, AFAIK. If indeed there will be loss of > > information (and I'd like to see some evidence to that first), then we > > need to move all the platforms to higher precision, not just one. > > Wouldn't it only need to be done for platforms that support a higher > pixel depth? No, we want all platforms to support the same color representation, for various good reasons. For example, platform-independent representation of standard colors. > gdk_rgba_parse uses pango_color_parse, which returns a PangoColor (48 > bpp RGB), and normalizes each component over 2^16. If using either > CAIRO_FORMAT_RGB30 (30 bpp RGB) with image surfaces or using the OpenGL > backend (which I believe the GTK Wayland backend uses), then storing > ARGB values into an unsigned long would mean lost precision that could > have been used. Once again, I'm okay with discussing a change for all the platforms, but it needs to show benefits for all of them, or at least a majority. What you describe could mean a use of a single 'double' for a color; we definitely don't need 4 'double's yet.