From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juan =?utf-8?Q?Jos=C3=A9_Garc=C3=ADa-Ripoll?= Newsgroups: gmane.emacs.devel Subject: Re: GDI+ take 3 Date: Tue, 21 Apr 2020 18:20:07 +0200 Message-ID: <86imhszu88.fsf@csic.es> References: <83d088fwgt.fsf@gnu.org> <835ze0fqk2.fsf@gnu.org> <83sgh3eogs.fsf@gnu.org> <838sitazal.fsf@gnu.org> <86imhxufx9.fsf@csic.es> <83y2qsap7r.fsf@gnu.org> <20200418201943.GA57763@breton.holly.idiocy.org> <83eesjibo6.fsf@gnu.org> <86368zxlsn.fsf@csic.es> <834ktei7pj.fsf@gnu.org> <86h7xd72yq.fsf@csic.es> <83lfmpexkq.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="16732"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt) To: emacs-devel@gnu.org Cancel-Lock: sha1:LygBJzXY2nAPnlpWm45736CzdLE= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 21 18:20:57 2020 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 1jQvdo-0004Cw-DE for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Apr 2020 18:20:56 +0200 Original-Received: from localhost ([::1]:60978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQvdn-0000MJ-Ga for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Apr 2020 12:20:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53800) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQvdB-0008Hb-Ex for emacs-devel@gnu.org; Tue, 21 Apr 2020 12:20:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQvdB-0003VU-26 for emacs-devel@gnu.org; Tue, 21 Apr 2020 12:20:17 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:54076) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jQvdA-0003V3-JA for emacs-devel@gnu.org; Tue, 21 Apr 2020 12:20:16 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jQvd8-0003Sg-51 for emacs-devel@gnu.org; Tue, 21 Apr 2020 18:20:14 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=159.69.161.202; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/21 12:20:15 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Received-From: 159.69.161.202 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:247473 Archived-At: Eli Zaretskii writes: >> - Something wants to load an image and invokes lookup_image_type() >> - lookup_image_type() calls image_can_use_native_api >> + within image_can_use_native_api, the type of image is verified >> - if it is right, it _initializes_ gdi+ (= init method) >> - otherwise returns false >> + when image_can_use_native_api returns false, lookup_image_type >> loops over image type >> - for each image type it calls initialize_image_type() >> * initialize_image_type aclls image_can_use_native_api again! >> * it then invokes the initialization method >> >> So, in the current architecture, image_can_use_native_api() is called >> redundantly. > > Yes, but it's very fast. And also, is the above flow the only one? > Can we ever call initialize_image_type directly? No. It is a static function and it is only called from lookup_image_type() > I think we may be miscommunicating. If Emacs is built without > librsvg, the HAVE_RSVG macro is not defined, and the SVG part of the > image_types[] array and init_svg_functions are not compiled into > Emacs. So there's no initialization method to call for SVG images, > and initialize_image_type should return false. My patch only removes the call to image_can_use_native_api () from initialize_image_type() because that function was already used in the only function that invokes it. The output of initialize_image_type() is not changed for other libraries. -- Juan José García Ripoll http://juanjose.garciaripoll.com http://quinfog.hbar.es