diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2009-01-02 11:39:51 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2009-01-02 11:39:51 +0000 |
commit | 00f93b05b70ef4e841608a4ddbd6db36474c6d1b (patch) | |
tree | a50bc1f23a1d022b1ceafd19aa369c95e2477d56 /pango-view/viewer-pangocairo.c | |
parent | 4898ac87e81e7c748147aff017368608d8c6c9bb (diff) | |
download | pango-00f93b05b70ef4e841608a4ddbd6db36474c6d1b.tar.gz |
Make sure we measure layout with the same surface type as the final
2009-01-02 Behdad Esfahbod <behdad@gnome.org>
* pango-view/viewer-main.c (main):
* pango-view/viewer-pangocairo.c (pangocairo_view_render):
* pango-view/viewer-pangoft2.c (pangoft2_view_render):
* pango-view/viewer-pangox.c (pangox_view_render):
* pango-view/viewer-pangoxft.c (pangoxft_view_render):
* pango-view/viewer.h:
Make sure we measure layout with the same surface type as the
final target. Also reduces fonts loaded by the pangocairo backend.
svn path=/trunk/; revision=2777
Diffstat (limited to 'pango-view/viewer-pangocairo.c')
-rw-r--r-- | pango-view/viewer-pangocairo.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/pango-view/viewer-pangocairo.c b/pango-view/viewer-pangocairo.c index e3612c34..30259ec6 100644 --- a/pango-view/viewer-pangocairo.c +++ b/pango-view/viewer-pangocairo.c @@ -309,27 +309,16 @@ static void pangocairo_view_render (gpointer instance G_GNUC_UNUSED, gpointer surface, PangoContext *context, - int width G_GNUC_UNUSED, - int height G_GNUC_UNUSED, + int *width, + int *height, gpointer state) { cairo_t *cr; CairoSurface *c_surface = (CairoSurface *) surface; - if (!surface) - { - cairo_surface_t *cs; - /* This is annoying ... we have to create a temporary surface just to - * get the extents of the text. - */ - /* image surface here is not good as it may have font options different - * from the target surface */ - cs = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1); - cr = cairo_create (cs); - cairo_surface_destroy (cs); - } - else - cr = cairo_create (c_surface->cairo); + g_assert (surface); + + cr = cairo_create (c_surface->cairo); transform_callback (context, NULL, cr, state); @@ -337,7 +326,7 @@ pangocairo_view_render (gpointer instance G_GNUC_UNUSED, cairo_paint (cr); cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); - do_output (context, render_callback, transform_callback, cr, state, NULL, NULL); + do_output (context, render_callback, transform_callback, cr, state, width, height); cairo_destroy (cr); } |