From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Testing native image scaling Date: Sun, 20 Jan 2019 19:26:31 +0000 Message-ID: <20190120192631.GA40845@breton.holly.idiocy.org> References: <83fttpat8p.fsf@gnu.org> <20190119214543.GA13967@breton.holly.idiocy.org> <834la3b9hd.fsf@gnu.org> NNTP-Posting-Host: ciao.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ciao.gmane.org 1548012434 187056 195.159.176.228 (20 Jan 2019 19:27:14 GMT) X-Complaints-To: usenet@ciao.gmane.org NNTP-Posting-Date: Sun, 20 Jan 2019 19:27:14 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 20 20:27:11 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1glIkQ-000mZt-16 for ged-emacs-devel@m.gmane.org; Sun, 20 Jan 2019 20:27:10 +0100 Original-Received: from localhost ([127.0.0.1]:43470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glIkY-00014S-Rd for ged-emacs-devel@m.gmane.org; Sun, 20 Jan 2019 14:27:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glIjz-00014B-14 for emacs-devel@gnu.org; Sun, 20 Jan 2019 14:26:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1glIjx-0000xf-Ia for emacs-devel@gnu.org; Sun, 20 Jan 2019 14:26:42 -0500 Original-Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:52089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1glIjw-0000tJ-6J; Sun, 20 Jan 2019 14:26:40 -0500 Original-Received: by mail-wm1-x335.google.com with SMTP id b11so8897870wmj.1; Sun, 20 Jan 2019 11:26:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=FoAJxhRWVJSaKYfwyrcguVpfqoIQqFCO4W3lGVzRUxM=; b=J11B7B7L9OemX6zSm/1Rh9qg0XS146dR24XUSMVI/g7S7wW+4XtW6MX1mDaGqkRD9R 4hZPnw8imBQKVIY4HVYBv7oV60sTjJi/Pk/GH1bdFIRTr1+YTgo0as3flTAqkTtBN3kk OB3NpahyUmdcr9IT3tqRiHHilmBEXstP9BY31V+IL07biXPK6ZuSnNuVa6Bo4VPFCdqR xiqA4WG+re7lnKcTTba2jnkb4VtDk2Japjubpdn/N1CO+4pMzhlZspxWXZ2BIL16MW+8 96JGZ7pnmZ8gJLQILrhVeF8ZPIqs8vAKZI96hXckH9w3p3joAaPrglpOovJAyQLQxkkv 44nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=FoAJxhRWVJSaKYfwyrcguVpfqoIQqFCO4W3lGVzRUxM=; b=GhAoOdUk/fCsBl0UXbCXuQZSh8Z18b4d9cZNbWXw4fB/WLRry30q/EJhB+G7CSej1l GxpCx9QGnpNOR+TyekphijwNcQDhkITCYYUB6Na02/ZGdv3TFQgtRIaenDMfBVN6oGL1 h6W7oXWmMyUd2Z5iB1In6wGBiaKvpPOiiy5qnxs32RweKVnLaf1oKSZ77TU7nelK4fox jwITVcWPltvPTZI4IttI7EOd2GBngHU9gCmxvPnYm+ZbxZnXPWxFbV4hpc7ZWaFiV5e+ 9gZwdOKDt1VvcXuecjCbTS55vho7RhMq3C7AZQxUe9EQXS2xMVlGZTt41QSP7fZ66dNT q4BA== X-Gm-Message-State: AJcUuke6REOzqrhamjS3qj1jS8XrBp+9LoRzXCRlx+1yJfe3MbOBKgUU YSpElLz2hKCbMPRmLvb3ZM4FXjpw X-Google-Smtp-Source: ALg8bN4tb5OIDFUmP0AWRW7JdKDiIehu+4F1QSfLsYmYfsBOgzbhs1t34JaFxzztZXQDv/O8ZDbs1w== X-Received: by 2002:a1c:4046:: with SMTP id n67mr21217341wma.123.1548012394712; Sun, 20 Jan 2019 11:26:34 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-0cd0-18e1-55fb-5b69.holly.idiocy.org. [2001:8b0:3f8:8129:cd0:18e1:55fb:5b69]) by smtp.gmail.com with ESMTPSA id e16sm150727742wrn.72.2019.01.20.11.26.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Jan 2019 11:26:33 -0800 (PST) Content-Disposition: inline In-Reply-To: <834la3b9hd.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 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:232547 Archived-At: On Sun, Jan 20, 2019 at 06:05:18PM +0200, Eli Zaretskii wrote: > > Date: Sat, 19 Jan 2019 21:45:43 +0000 > > From: Alan Third > > Cc: emacs-devel@gnu.org > > > > x_set_image_size calculates the new sizes, does the conversion, and > > writes those new sizes back into struct image, over‐writing the > > original sizes. > > > > For NS it also asks the NSImage back‐end to scale the image using > > ns_image_set_size, which in effect does the actual scaling. > > > > For XRender it sets up an affine transformation matrix, and applies it > > to img->picture, which also in effect does the actual scaling. > > > > The compositing functions in nsterm.m and xterm.c don’t need to know > > the original image size, just the new size, and NSImage/XRender > > handles the rest. > > Well, on w32, the implementation actually resizes when it draws. > Maybe that's sub-optimal, but I know next to nothing about w32 image > display, so what I got looks definitely fine for my ignorance. I believe that with XRender, and possibly with NS, the actual resizing is done at draw time, it’s just that the drawing functions don’t need to know about it because it’s already built into the image types. > So we now have native resizing on all major platforms. Excellent! Thanks! > > We could use XRender to rotate images if we really wanted to, and the > > NS port already supports it. > > Where's the NS support for that? AFAICT, :rotate is only handled in > ImageMagick specific portions of the code, what did I miss? It’s buried in nsimage.m, ns_load_image gets both :rotation and :index, then processes the image as appropriate. If we were to add XRender rotation support, I’d be tempted to do both rotation and scaling using affine transformation matrices in both XRender and NS, as they would then both use the same code to calculate the transforms. I believe Windows supports transformation matrices through D2D, but I assume Emacs doesn’t use D2D currently, so it may not be straight forward to add. If we were to go that far, it may be worth actually exposing the matrices to lisp and handle the calculations there, but that would potentially be a big change to the API. -- Alan Third