summaryrefslogtreecommitdiff
path: root/src/haikuterm.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-05-09 11:10:13 +0000
committerPo Lu <luangruo@yahoo.com>2022-05-09 11:10:44 +0000
commit5921e31c45e2d0b2b2ee4e03b21127abb3c30944 (patch)
treece99ec069468fb5d21a785021afe68b339437e0a /src/haikuterm.c
parent2e949031160d769bbac941c064b825a5c578afc5 (diff)
downloademacs-5921e31c45e2d0b2b2ee4e03b21127abb3c30944.tar.gz
Respect display scale factor drawing underwaves on Haiku
* src/haikuterm.c (haiku_get_scale_factor): New function. (haiku_draw_underwave): Apply said factor.
Diffstat (limited to 'src/haikuterm.c')
-rw-r--r--src/haikuterm.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/haikuterm.c b/src/haikuterm.c
index 265d3fbf5e6..bfa6be225ac 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -724,21 +724,40 @@ haiku_draw_relief_rect (struct glyph_string *s,
}
static void
+haiku_get_scale_factor (int *scale_x, int *scale_y)
+{
+ struct haiku_display_info *dpyinfo = x_display_list;
+
+ if (dpyinfo->resx > 96)
+ *scale_x = floor (dpyinfo->resx / 96);
+ if (dpyinfo->resy > 96)
+ *scale_y = floor (dpyinfo->resy / 96);
+}
+
+static void
haiku_draw_underwave (struct glyph_string *s, int width, int x)
{
- int wave_height = 3, wave_length = 2;
- int y, dx, dy, odd, xmax;
+ int wave_height, wave_length;
+ int y, dx, dy, odd, xmax, scale_x, scale_y;
float ax, ay, bx, by;
- void *view = FRAME_HAIKU_VIEW (s->f);
+ void *view;
+
+ scale_x = 4;
+ scale_y = 4;
+ haiku_get_scale_factor (&scale_x, &scale_y);
+ wave_height = 3 * scale_y;
+ wave_length = 2 * scale_x;
dx = wave_length;
dy = wave_height - 1;
y = s->ybase - wave_height + 3;
xmax = x + width;
+ view = FRAME_HAIKU_VIEW (s->f);
BView_StartClip (view);
haiku_clip_to_string (s);
BView_ClipToRect (view, x, y, width, wave_height);
+
ax = x - ((int) (x) % dx) + (float) 0.5;
bx = ax + dx;
odd = (int) (ax / dx) % 2;
@@ -749,6 +768,8 @@ haiku_draw_underwave (struct glyph_string *s, int width, int x)
else
by += dy;
+ BView_SetPenSize (view, scale_y);
+
while (ax <= xmax)
{
BView_StrokeLine (view, ax, ay, bx, by);
@@ -756,6 +777,8 @@ haiku_draw_underwave (struct glyph_string *s, int width, int x)
bx += dx, by = y + 0.5 + odd * dy;
odd = !odd;
}
+
+ BView_SetPenSize (view, 1);
BView_EndClip (view);
}