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