Simplify the implementation by taking advantage of the fact that destroy and reference are safe for NULL, and that reference returns its argument.

This commit is contained in:
Carl Worth 2005-08-05 21:33:41 +00:00
parent 80b944418c
commit 417a66da5e
2 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2005-08-05 Carl Worth <cworth@cworth.org>
* src/cairo-gstate.c: (_cairo_gstate_set_font_face): Simplify the
implementation by taking advantage of the fact that destroy and
reference are safe for NULL, and that reference returns its
argument.
2005-08-05 Carl Worth <cworth@cworth.org>
* src/cairo-gstate.c: (_cairo_gstate_translate),

View file

@ -1653,11 +1653,8 @@ _cairo_gstate_set_font_face (cairo_gstate_t *gstate,
return font_face->status;
if (font_face != gstate->font_face) {
if (gstate->font_face)
cairo_font_face_destroy (gstate->font_face);
gstate->font_face = font_face;
if (gstate->font_face)
cairo_font_face_reference (gstate->font_face);
cairo_font_face_destroy (gstate->font_face);
gstate->font_face = cairo_font_face_reference (font_face);
}
_cairo_gstate_unset_scaled_font (gstate);