From owner-svn-ports-all@freebsd.org Thu Dec 28 10:54:30 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1D91E87860; Thu, 28 Dec 2017 10:54:30 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7923A75A93; Thu, 28 Dec 2017 10:54:30 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBSAsTGj058656; Thu, 28 Dec 2017 10:54:29 GMT (envelope-from danfe@FreeBSD.org) Received: (from danfe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBSAsTk9058654; Thu, 28 Dec 2017 10:54:29 GMT (envelope-from danfe@FreeBSD.org) Message-Id: <201712281054.vBSAsTk9058654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: danfe set sender to danfe@FreeBSD.org using -f From: Alexey Dokuchaev Date: Thu, 28 Dec 2017 10:54:29 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r457444 - in head/x11/hsetroot: . files X-SVN-Group: ports-head X-SVN-Commit-Author: danfe X-SVN-Commit-Paths: in head/x11/hsetroot: . files X-SVN-Commit-Revision: 457444 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Dec 2017 10:54:30 -0000 Author: danfe Date: Thu Dec 28 10:54:29 2017 New Revision: 457444 URL: https://svnweb.freebsd.org/changeset/ports/457444 Log: Add custom patch that introduces "sane" image rendering mode: it allows to select the best aspect ratio and display image with minimal scaling yet not centered. This mode is useful when one wants to use an image with author's copyright in the lower corner and wants to hide it. Existing modes did not always provide the best possible result. While here, take maintainership. Added: head/x11/hsetroot/files/patch-hsetroot.c (contents, props changed) Modified: head/x11/hsetroot/Makefile Modified: head/x11/hsetroot/Makefile ============================================================================== --- head/x11/hsetroot/Makefile Thu Dec 28 10:51:49 2017 (r457443) +++ head/x11/hsetroot/Makefile Thu Dec 28 10:54:29 2017 (r457444) @@ -3,10 +3,10 @@ PORTNAME= hsetroot PORTVERSION= 1.0.2 -PORTREVISION= 12 +PORTREVISION= 13 CATEGORIES= x11 -MAINTAINER= ports@FreeBSD.org +MAINTAINER= danfe@FreeBSD.org COMMENT= Wallpaper manipulation utility for X11 LICENSE= GPLv2 Added: head/x11/hsetroot/files/patch-hsetroot.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/x11/hsetroot/files/patch-hsetroot.c Thu Dec 28 10:54:29 2017 (r457444) @@ -0,0 +1,56 @@ +--- hsetroot.c.orig 2016-02-14 00:09:11 UTC ++++ hsetroot.c +@@ -8,7 +8,7 @@ + #include "outputs.h" + + +-typedef enum { Full, Fill, Center, Tile, Xtend, Cover } ImageMode; ++typedef enum { Full, Fill, Center, Tile, Xtend, Cover, Sane } ImageMode; + + void + usage(char *commandline) +@@ -33,6 +33,7 @@ usage(char *commandline) + "Image files:\n" + " -center Render an image centered on screen\n" + " -cover Render an image centered on screen scaled to fill the screen fully\n" ++ " -sane Render an image in sane mode (choose the best aspect, but do not center)\n" + " -tile Render an image tiled\n" + " -full Render an image maximum aspect\n" + " -extend Render an image max aspect and fill borders\n" +@@ -229,6 +230,20 @@ load_image(ImageMode mode, const char *arg, int alpha, + } + } + } ++ } else if (mode == Sane) { ++ int newW, newH; ++ double aspect_w = ((double) o.w) / imgW; ++ double aspect_h = ((double) o.h) / imgH; ++ if (aspect_h < aspect_w) { ++ // image is taller ++ newW = o.w; ++ newH = (int) (imgH * aspect_w); ++ } else { ++ // image is wider ++ newW = (int) (imgW * aspect_h); ++ newH = o.h; ++ } ++ imlib_blend_image_onto_image(buffer, 0, 0, 0, imgW, imgH, 0, 0, newW, newH); + } else { // Center || Tile + int left = (o.w - imgW) / 2; + int top = (o.h - imgH) / 2; +@@ -457,6 +472,15 @@ main(int argc, char **argv) + } + if (load_image(Cover, argv[i], alpha, image, outputs, noutputs) == 0) { + fprintf (stderr, "Bad image (%s)\n", argv[i]); ++ continue; ++ } ++ } else if (strcmp (argv[i], "-sane") == 0) { ++ if ((++i) >= argc) { ++ fprintf(stderr, "Missing image\n"); ++ continue; ++ } ++ if (load_image(Sane, argv[i], alpha, image, outputs, noutputs) == 0) { ++ fprintf(stderr, "Bad image (%s)\n", argv[i]); + continue; + } + } else if (strcmp(argv[i], "-tint") == 0) {