aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xterm.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/xterm.c b/src/xterm.c
index a214cd81031..5c1b061566f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -23,9 +23,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <config.h> 23#include <config.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <stdlib.h> 25#include <stdlib.h>
26#ifdef USE_CAIRO
27#include <math.h> 26#include <math.h>
28#endif
29 27
30#include "lisp.h" 28#include "lisp.h"
31#include "blockinput.h" 29#include "blockinput.h"
@@ -3475,6 +3473,21 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
3475 s->background_filled_p = true; 3473 s->background_filled_p = true;
3476} 3474}
3477 3475
3476static void
3477x_get_scale_factor(Display *disp, int *scale_x, int *scale_y)
3478{
3479 const int base_res = 96;
3480 struct x_display_info * dpyinfo = x_display_info_for_display (disp);
3481
3482 *scale_x = *scale_y = 1;
3483
3484 if (dpyinfo)
3485 {
3486 *scale_x = floor (dpyinfo->resx / base_res);
3487 *scale_y = floor (dpyinfo->resy / base_res);
3488 }
3489}
3490
3478/* 3491/*
3479 Draw a wavy line under S. The wave fills wave_height pixels from y0. 3492 Draw a wavy line under S. The wave fills wave_height pixels from y0.
3480 3493
@@ -3485,11 +3498,16 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
3485 wave_height = 3 | * * * * 3498 wave_height = 3 | * * * *
3486 3499
3487*/ 3500*/
3488
3489static void 3501static void
3490x_draw_underwave (struct glyph_string *s) 3502x_draw_underwave (struct glyph_string *s)
3491{ 3503{
3492 int wave_height = 3, wave_length = 2; 3504 /* Adjust for scale/HiDPI. */
3505 int scale_x, scale_y;
3506
3507 x_get_scale_factor (s->display, &scale_x, &scale_y);
3508
3509 int wave_height = 3 * scale_y, wave_length = 2 * scale_x, thickness = scale_y;
3510
3493#ifdef USE_CAIRO 3511#ifdef USE_CAIRO
3494 x_draw_horizontal_wave (s->f, s->gc, s->x, s->ybase - wave_height + 3, 3512 x_draw_horizontal_wave (s->f, s->gc, s->x, s->ybase - wave_height + 3,
3495 s->width, wave_height, wave_length); 3513 s->width, wave_height, wave_length);
@@ -3501,7 +3519,7 @@ x_draw_underwave (struct glyph_string *s)
3501 dx = wave_length; 3519 dx = wave_length;
3502 dy = wave_height - 1; 3520 dy = wave_height - 1;
3503 x0 = s->x; 3521 x0 = s->x;
3504 y0 = s->ybase - wave_height + 3; 3522 y0 = s->ybase + wave_height / 2;
3505 width = s->width; 3523 width = s->width;
3506 xmax = x0 + width; 3524 xmax = x0 + width;
3507 3525
@@ -3535,6 +3553,8 @@ x_draw_underwave (struct glyph_string *s)
3535 3553
3536 while (x1 <= xmax) 3554 while (x1 <= xmax)
3537 { 3555 {
3556 XSetLineAttributes (s->display, s->gc, thickness, LineSolid, CapButt,
3557 JoinRound);
3538 XDrawLine (s->display, FRAME_X_DRAWABLE (s->f), s->gc, x1, y1, x2, y2); 3558 XDrawLine (s->display, FRAME_X_DRAWABLE (s->f), s->gc, x1, y1, x2, y2);
3539 x1 = x2, y1 = y2; 3559 x1 = x2, y1 = y2;
3540 x2 += dx, y2 = y0 + odd*dy; 3560 x2 += dx, y2 = y0 + odd*dy;