diff options
Diffstat (limited to 'pango/pango-renderer.c')
-rw-r--r-- | pango/pango-renderer.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c index 6c0786c5..07f81a88 100644 --- a/pango/pango-renderer.c +++ b/pango/pango-renderer.c @@ -227,7 +227,7 @@ draw_underline (PangoRenderer *renderer, rect->y + 2 * rect->height, rect->width, rect->height); - /* Fall through */ + G_GNUC_FALLTHROUGH; case PANGO_UNDERLINE_SINGLE: case PANGO_UNDERLINE_LOW: case PANGO_UNDERLINE_SINGLE_LINE: @@ -1096,15 +1096,22 @@ pango_renderer_default_draw_error_underline (PangoRenderer *renderer, int width, int height) { - int square = height / HEIGHT_SQUARES; - int unit_width = (HEIGHT_SQUARES - 1) * square; - int width_units = (width + unit_width / 2) / unit_width; + int square; + int unit_width; + int width_units; const PangoMatrix identity = PANGO_MATRIX_INIT; const PangoMatrix *matrix; double dx, dx0, dy0; PangoMatrix total; int i; + if (width <= 0 || height <= 0) + return; + + square = height / HEIGHT_SQUARES; + unit_width = (HEIGHT_SQUARES - 1) * square; + width_units = (width + unit_width / 2) / unit_width; + x += (width - width_units * unit_width) / 2; if (renderer->matrix) |