[Commit] cairo/src cairo_gstate.c,1.8,1.9
Carl Worth
commit at keithp.com
Fri Sep 5 08:16:48 PDT 2003
Committed by: cworth
Update of /local/src/CVS/cairo/src
In directory home.keithp.com:/tmp/cvs-serv27147/src
Modified Files:
cairo_gstate.c
Log Message:
Fix crash in show_text due to missing call to ensure_source.
Index: cairo_gstate.c
===================================================================
RCS file: /local/src/CVS/cairo/src/cairo_gstate.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo_gstate.c 4 Sep 2003 23:27:35 -0000 1.8
+++ cairo_gstate.c 5 Sep 2003 14:16:46 -0000 1.9
@@ -1110,7 +1110,9 @@
cairo_status_t
_cairo_gstate_show_text (cairo_gstate_t *gstate, const unsigned char *utf8)
{
+ cairo_status_t status;
XftFont *xft_font;
+ cairo_matrix_t user_to_source, device_to_source;
if (gstate->has_current_pt == 0)
return CAIRO_STATUS_NO_CURRENT_POINT;
@@ -1120,6 +1122,19 @@
_cairo_font_resolve_xft_font (&gstate->font, gstate, &xft_font);
+ status = _cairo_gstate_ensure_source (gstate);
+ if (status)
+ return status;
+
+ /* XXX: This same source matrix manipulation code shows up in
+ about 3 or 4 places. We should move that into a shared function
+ or two. */
+ if (! gstate->source_is_solid) {
+ cairo_surface_get_matrix (gstate->source, &user_to_source);
+ cairo_matrix_multiply (&device_to_source, &gstate->ctm_inverse, &user_to_source);
+ cairo_surface_set_matrix (gstate->source, &device_to_source);
+ }
+
/* XXX: Need to make a generic (non-Xft) backend for text. */
XftTextRenderUtf8 (gstate->surface->dpy,
gstate->operator,
@@ -1132,6 +1147,10 @@
utf8,
strlen ((char *) utf8));
+ /* restore the matrix originally in the source surface */
+ if (! gstate->source_is_solid)
+ cairo_surface_set_matrix (gstate->source, &user_to_source);
+
return CAIRO_STATUS_SUCCESS;
}
More information about the Commit
mailing list