summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-05 19:16:25 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-07-05 19:16:25 -0400
commit7549d36af2e79ebd86ae9cc05a86bfdc22dfebf8 (patch)
tree4a66b59e7e9835f150a2b9acc1f9d2f895bf9bf7
parent467bda1e0bc2614b10e2edc46dccc9588388e045 (diff)
downloadpango-7549d36af2e79ebd86ae9cc05a86bfdc22dfebf8.tar.gz
renderer: Fix averaging of strikethroughsfix-strikethrough-averaging
In 85bdfead1b36945db251 I made consecutive runs average their strikeout positions, but I did handle the accounting properly, causing previous runs to influence the strikeout of later runs, if we have to draw them separately (due to color change). It would be nicer to average even across color changes and draw the line continuously in that case as well, but that would require two passes over the runs. Fixes: #574
-rw-r--r--pango/pango-renderer.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 49eec91d..f575707f 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -282,18 +282,22 @@ draw_strikethrough (PangoRenderer *renderer,
LineState *state)
{
PangoRectangle *rect = &state->strikethrough_rect;
- gboolean strikethrough = state->strikethrough;
int num_glyphs = state->strikethrough_glyphs;
- state->strikethrough = FALSE;
-
- if (strikethrough)
+ if (state->strikethrough)
pango_renderer_draw_rectangle (renderer,
PANGO_RENDER_PART_STRIKETHROUGH,
rect->x,
rect->y / num_glyphs,
rect->width,
rect->height / num_glyphs);
+
+ state->strikethrough = FALSE;
+ state->strikethrough_glyphs = 0;
+ rect->x += rect->width;
+ rect->width = 0;
+ rect->y = 0;
+ rect->height = 0;
}
static void
@@ -336,8 +340,6 @@ handle_line_state_change (PangoRenderer *renderer,
rect->width = state->logical_rect_end - rect->x;
draw_strikethrough (renderer, state);
state->strikethrough = renderer->strikethrough;
- rect->x = state->logical_rect_end;
- rect->width = 0;
}
}
@@ -484,7 +486,6 @@ add_strikethrough (PangoRenderer *renderer,
}
else
{
- draw_strikethrough (renderer, state);
*current_rect = new_rect;
state->strikethrough = TRUE;
state->strikethrough_glyphs = num_glyphs;