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