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