summaryrefslogtreecommitdiff
path: root/pango/pango-renderer.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-12-09 10:09:30 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-12-09 10:09:30 +0000
commitc66cf7070344636807ef1766beb41e3bbb8c26b1 (patch)
tree092c0a949676e68a59f27df9cd983c93c09cbf28 /pango/pango-renderer.c
parent33079f7ddb48401b86409710eca18689eb558327 (diff)
downloadpango-c66cf7070344636807ef1766beb41e3bbb8c26b1.tar.gz
Bug 563803 – pango_renderer_finalize fails to call parent finalize
2008-12-09 Behdad Esfahbod <behdad@gnome.org> Bug 563803 – pango_renderer_finalize fails to call parent finalize * pango/pango-renderer.c (pango_renderer_class_init), (pango_renderer_finalize): Call parent finalize. * pango/pango-renderer.c (add_strikethrough), (pango_renderer_default_draw_glyph_item), (pango_renderer_default_draw_error_underline): Clean up a bit. svn path=/trunk/; revision=2755
Diffstat (limited to 'pango/pango-renderer.c')
-rw-r--r--pango/pango-renderer.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 41f290d2..96ffe506 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -106,11 +106,15 @@ to_device (PangoMatrix *matrix,
G_DEFINE_ABSTRACT_TYPE (PangoRenderer, pango_renderer, G_TYPE_OBJECT)
+static GObjectClass *parent_class;
+
static void
pango_renderer_class_init (PangoRendererClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
+
klass->draw_glyphs = pango_renderer_default_draw_glyphs;
klass->draw_glyph_item = pango_renderer_default_draw_glyph_item;
klass->draw_rectangle = pango_renderer_default_draw_rectangle;
@@ -138,6 +142,8 @@ pango_renderer_finalize (GObject *gobject)
if (renderer->matrix)
pango_matrix_free (renderer->matrix);
+
+ parent_class->finalize (gobject);
}
/**
@@ -348,7 +354,7 @@ add_strikethrough (PangoRenderer *renderer,
PangoFontMetrics *metrics,
int base_x,
int base_y,
- PangoRectangle *ink_rect,
+ PangoRectangle *ink_rect G_GNUC_UNUSED,
PangoRectangle *logical_rect)
{
PangoRectangle *current_rect = &state->strikethrough_rect;
@@ -707,7 +713,7 @@ pango_renderer_draw_glyph_item (PangoRenderer *renderer,
static void
pango_renderer_default_draw_glyph_item (PangoRenderer *renderer,
- const char *text,
+ const char *text G_GNUC_UNUSED,
PangoGlyphItem *glyph_item,
int x,
int y)
@@ -967,6 +973,8 @@ pango_renderer_default_draw_error_underline (PangoRenderer *renderer,
int width_units = (width + unit_width / 2) / unit_width;
static const PangoMatrix identity = PANGO_MATRIX_INIT;
const PangoMatrix *matrix;
+ double dx, dx0, dy0;
+ PangoMatrix total;
x += (width - width_units * unit_width) / 2;
width = width_units * unit_width;
@@ -976,10 +984,13 @@ pango_renderer_default_draw_error_underline (PangoRenderer *renderer,
else
matrix = &identity;
+ get_total_matrix (&total, matrix, x, y, square);
+ dx = unit_width * 2;
+ dx0 = (matrix->xx * dx) / PANGO_SCALE;
+ dy0 = (matrix->yx * dx) / PANGO_SCALE;
+
while (TRUE)
{
- PangoMatrix total;
- get_total_matrix (&total, matrix, x, y, square);
draw_rectangle (renderer, &total, PANGO_RENDER_PART_UNDERLINE, /* A */
0, 0,
@@ -991,18 +1002,19 @@ pango_renderer_default_draw_error_underline (PangoRenderer *renderer,
HEIGHT_SQUARES * 2 - 2, - (HEIGHT_SQUARES * 2 - 3),
1, HEIGHT_SQUARES * 2 - 3);
width_units -= 2;
- x += unit_width * 2;
- }
- else if (width_units == 2)
- {
- draw_rectangle (renderer, &total, PANGO_RENDER_PART_UNDERLINE, /* C */
- HEIGHT_SQUARES * 2 - 2, - (HEIGHT_SQUARES * 2 - 2),
- 1, HEIGHT_SQUARES * 2 - 2);
- break;
+
+ total.x0 += dx0;
+ total.y0 += dy0;
}
else
break;
}
+ if (width_units == 2)
+ {
+ draw_rectangle (renderer, &total, PANGO_RENDER_PART_UNDERLINE, /* C */
+ HEIGHT_SQUARES * 2 - 2, - (HEIGHT_SQUARES * 2 - 2),
+ 1, HEIGHT_SQUARES * 2 - 2);
+ }
}
/**