|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.332
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.332
|
|
|
22c937 |
Problem: GTK: When a sign icon doesn't fit exactly there can be ugly gaps.
|
|
|
22c937 |
Solution: Scale the sign to fit when the aspect ratio is not too far off.
|
|
|
22c937 |
(Christian Brabandt)
|
|
|
22c937 |
Files: src/gui_gtk_x11.c
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.331/src/gui_gtk_x11.c 2014-05-13 20:19:53.573808877 +0200
|
|
|
22c937 |
--- src/gui_gtk_x11.c 2014-06-17 18:44:39.900755807 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 5965,5991 ****
|
|
|
22c937 |
* Decide whether we need to scale. Allow one pixel of border
|
|
|
22c937 |
* width to be cut off, in order to avoid excessive scaling for
|
|
|
22c937 |
* tiny differences in font size.
|
|
|
22c937 |
*/
|
|
|
22c937 |
need_scale = (width > SIGN_WIDTH + 2
|
|
|
22c937 |
! || height > SIGN_HEIGHT + 2
|
|
|
22c937 |
|| (width < 3 * SIGN_WIDTH / 4
|
|
|
22c937 |
&& height < 3 * SIGN_HEIGHT / 4));
|
|
|
22c937 |
if (need_scale)
|
|
|
22c937 |
{
|
|
|
22c937 |
! double aspect;
|
|
|
22c937 |
|
|
|
22c937 |
/* Keep the original aspect ratio */
|
|
|
22c937 |
aspect = (double)height / (double)width;
|
|
|
22c937 |
width = (double)SIGN_WIDTH * SIGN_ASPECT / aspect;
|
|
|
22c937 |
width = MIN(width, SIGN_WIDTH);
|
|
|
22c937 |
! height = (double)width * aspect;
|
|
|
22c937 |
|
|
|
22c937 |
! /* This doesn't seem to be worth caching, and doing so
|
|
|
22c937 |
! * would complicate the code quite a bit. */
|
|
|
22c937 |
! sign = gdk_pixbuf_scale_simple(sign, width, height,
|
|
|
22c937 |
! GDK_INTERP_BILINEAR);
|
|
|
22c937 |
! if (sign == NULL)
|
|
|
22c937 |
! return; /* out of memory */
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/* The origin is the upper-left corner of the pixmap. Therefore
|
|
|
22c937 |
--- 5965,6012 ----
|
|
|
22c937 |
* Decide whether we need to scale. Allow one pixel of border
|
|
|
22c937 |
* width to be cut off, in order to avoid excessive scaling for
|
|
|
22c937 |
* tiny differences in font size.
|
|
|
22c937 |
+ * Do scale to fit the height to avoid gaps because of linespacing.
|
|
|
22c937 |
*/
|
|
|
22c937 |
need_scale = (width > SIGN_WIDTH + 2
|
|
|
22c937 |
! || height != SIGN_HEIGHT
|
|
|
22c937 |
|| (width < 3 * SIGN_WIDTH / 4
|
|
|
22c937 |
&& height < 3 * SIGN_HEIGHT / 4));
|
|
|
22c937 |
if (need_scale)
|
|
|
22c937 |
{
|
|
|
22c937 |
! double aspect;
|
|
|
22c937 |
! int w = width;
|
|
|
22c937 |
! int h = height;
|
|
|
22c937 |
|
|
|
22c937 |
/* Keep the original aspect ratio */
|
|
|
22c937 |
aspect = (double)height / (double)width;
|
|
|
22c937 |
width = (double)SIGN_WIDTH * SIGN_ASPECT / aspect;
|
|
|
22c937 |
width = MIN(width, SIGN_WIDTH);
|
|
|
22c937 |
! if (((double)(MAX(height, SIGN_HEIGHT)) /
|
|
|
22c937 |
! (double)(MIN(height, SIGN_HEIGHT))) < 1.15)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! /* Change the aspect ratio by at most 15% to fill the
|
|
|
22c937 |
! * available space completly. */
|
|
|
22c937 |
! height = (double)SIGN_HEIGHT * SIGN_ASPECT / aspect;
|
|
|
22c937 |
! height = MIN(height, SIGN_HEIGHT);
|
|
|
22c937 |
! }
|
|
|
22c937 |
! else
|
|
|
22c937 |
! height = (double)width * aspect;
|
|
|
22c937 |
|
|
|
22c937 |
! if (w == width && h == height)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! /* no change in dimensions; don't decrease reference counter
|
|
|
22c937 |
! * (below) */
|
|
|
22c937 |
! need_scale = FALSE;
|
|
|
22c937 |
! }
|
|
|
22c937 |
! else
|
|
|
22c937 |
! {
|
|
|
22c937 |
! /* This doesn't seem to be worth caching, and doing so would
|
|
|
22c937 |
! * complicate the code quite a bit. */
|
|
|
22c937 |
! sign = gdk_pixbuf_scale_simple(sign, width, height,
|
|
|
22c937 |
! GDK_INTERP_BILINEAR);
|
|
|
22c937 |
! if (sign == NULL)
|
|
|
22c937 |
! return; /* out of memory */
|
|
|
22c937 |
! }
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/* The origin is the upper-left corner of the pixmap. Therefore
|
|
|
22c937 |
*** ../vim-7.4.331/src/version.c 2014-06-17 18:16:08.420691059 +0200
|
|
|
22c937 |
--- src/version.c 2014-06-17 18:46:49.784760721 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 736,737 ****
|
|
|
22c937 |
--- 736,739 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 332,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
"To whoever finds this note -
|
|
|
22c937 |
I have been imprisoned by my father who wishes me to marry
|
|
|
22c937 |
against my will. Please please please please come and rescue me.
|
|
|
22c937 |
I am in the tall tower of Swamp Castle."
|
|
|
22c937 |
SIR LAUNCELOT's eyes light up with holy inspiration.
|
|
|
22c937 |
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|