diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-11-28 21:18:10 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-11-28 21:18:10 +0000 |
commit | c23d8ef078be5c8279bc3a6addf46f8107c6e038 (patch) | |
tree | aa298c246399005f2fe260add6b5a000b0b0922e | |
parent | 93d18a9135830d74bec50f04ca1723cb68c4ff1d (diff) | |
download | pango-c23d8ef078be5c8279bc3a6addf46f8107c6e038.tar.gz |
Use simple, fast, casts instead of PANGO_CAIRO_*() macros where the object
2006-11-28 Behdad Esfahbod <behdad@gnome.org>
* pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_font_face),
(pango_cairo_fc_font_install), (pango_cairo_fc_font_finalize),
(pango_cairo_fc_font_get_metrics), (pango_cairo_fc_font_shutdown),
(_pango_cairo_fc_font_new):
* pango/pangocairo-fcfontmap.c
(pango_cairo_fc_font_map_set_resolution),
(pango_cairo_fc_font_map_get_resolution_cairo),
(pango_cairo_fc_font_map_get_renderer),
(pango_cairo_fc_font_map_finalize),
(pango_cairo_fc_font_map_get_resolution_fc),
(pango_cairo_fc_font_map_create_font):
* pango/pangocairo-font.c (_pango_cairo_font_install),
(_pango_cairo_font_get_font_face),
(_pango_cairo_font_get_scaled_font),
(_pango_cairo_font_get_hex_box_info):
* pango/pangocairo-fontmap.c (pango_cairo_create_layout):
* pango/pangocairo-render.c (set_color),
(_pango_cairo_renderer_draw_unknown_glyph),
(pango_cairo_renderer_draw_glyphs),
(pango_cairo_renderer_draw_rectangle),
(pango_cairo_renderer_draw_error_underline):
Use simple, fast, casts instead of PANGO_CAIRO_*() macros where the
object cannot have reached us if it wasn't of the right type.
-rw-r--r-- | ChangeLog | 26 | ||||
-rw-r--r-- | pango/pangocairo-fcfont.c | 18 | ||||
-rw-r--r-- | pango/pangocairo-fcfontmap.c | 14 | ||||
-rw-r--r-- | pango/pangocairo-font.c | 10 | ||||
-rw-r--r-- | pango/pangocairo-fontmap.c | 2 | ||||
-rw-r--r-- | pango/pangocairo-render.c | 10 |
6 files changed, 53 insertions, 27 deletions
@@ -1,3 +1,29 @@ +2006-11-28 Behdad Esfahbod <behdad@gnome.org> + + * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_font_face), + (pango_cairo_fc_font_install), (pango_cairo_fc_font_finalize), + (pango_cairo_fc_font_get_metrics), (pango_cairo_fc_font_shutdown), + (_pango_cairo_fc_font_new): + * pango/pangocairo-fcfontmap.c + (pango_cairo_fc_font_map_set_resolution), + (pango_cairo_fc_font_map_get_resolution_cairo), + (pango_cairo_fc_font_map_get_renderer), + (pango_cairo_fc_font_map_finalize), + (pango_cairo_fc_font_map_get_resolution_fc), + (pango_cairo_fc_font_map_create_font): + * pango/pangocairo-font.c (_pango_cairo_font_install), + (_pango_cairo_font_get_font_face), + (_pango_cairo_font_get_scaled_font), + (_pango_cairo_font_get_hex_box_info): + * pango/pangocairo-fontmap.c (pango_cairo_create_layout): + * pango/pangocairo-render.c (set_color), + (_pango_cairo_renderer_draw_unknown_glyph), + (pango_cairo_renderer_draw_glyphs), + (pango_cairo_renderer_draw_rectangle), + (pango_cairo_renderer_draw_error_underline): + Use simple, fast, casts instead of PANGO_CAIRO_*() macros where the + object cannot have reached us if it wasn't of the right type. + 2006-11-27 Behdad Esfahbod <behdad@gnome.org> Bug 371388 – Add Thai langauage engine diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c index 0312d4be..976ef2b9 100644 --- a/pango/pangocairo-fcfont.c +++ b/pango/pangocairo-fcfont.c @@ -90,8 +90,8 @@ static cairo_font_face_t *pango_cairo_fc_font_get_font_face (PangoCairoFont *fon static cairo_font_face_t * pango_cairo_fc_font_get_font_face (PangoCairoFont *font) { - PangoCairoFcFont *cffont = PANGO_CAIRO_FC_FONT (font); - PangoFcFont *fcfont = PANGO_FC_FONT (cffont); + PangoCairoFcFont *cffont = (PangoCairoFcFont *) (font); + PangoFcFont *fcfont = (PangoFcFont *) (cffont); if (!cffont->font_face) { @@ -145,7 +145,7 @@ static gboolean pango_cairo_fc_font_install (PangoCairoFont *font, cairo_t *cr) { - PangoCairoFcFont *cffont = PANGO_CAIRO_FC_FONT (font); + PangoCairoFcFont *cffont = (PangoCairoFcFont *) (font); cairo_set_font_face (cr, pango_cairo_fc_font_get_font_face (font)); @@ -169,7 +169,7 @@ G_DEFINE_TYPE_WITH_CODE (PangoCairoFcFont, pango_cairo_fc_font, PANGO_TYPE_FC_FO static void pango_cairo_fc_font_finalize (GObject *object) { - PangoCairoFcFont *cffont = PANGO_CAIRO_FC_FONT (object); + PangoCairoFcFont *cffont = (PangoCairoFcFont *) (object); if (cffont->font_face) cairo_font_face_destroy (cffont->font_face); @@ -194,8 +194,8 @@ static PangoFontMetrics * pango_cairo_fc_font_get_metrics (PangoFont *font, PangoLanguage *language) { - PangoFcFont *fcfont = PANGO_FC_FONT (font); - PangoCairoFcFont *cffont = PANGO_CAIRO_FC_FONT (font); + PangoFcFont *fcfont = (PangoFcFont *) (font); + PangoCairoFcFont *cffont = (PangoCairoFcFont *) (font); PangoFcMetricsInfo *info = NULL; /* Quiet gcc */ GSList *tmp_list; @@ -370,7 +370,7 @@ pango_cairo_fc_font_get_glyph_extents (PangoFont *font, static void pango_cairo_fc_font_shutdown (PangoFcFont *fcfont) { - PangoCairoFcFont *cffont = PANGO_CAIRO_FC_FONT (fcfont); + PangoCairoFcFont *cffont = (PangoCairoFcFont *) (fcfont); if (cffont->scaled_font) { cairo_scaled_font_destroy (cffont->scaled_font); @@ -503,8 +503,8 @@ _pango_cairo_fc_font_new (PangoCairoFcFontMap *cffontmap, /* fcfont's is_hinted controls metric hinting */ - PANGO_FC_FONT(cffont)->is_hinted = + ((PangoFcFont *)(cffont))->is_hinted = (cairo_font_options_get_hint_metrics(cffont->options) != CAIRO_HINT_METRICS_OFF); - return PANGO_FC_FONT (cffont); + return (PangoFcFont *) (cffont); } diff --git a/pango/pangocairo-fcfontmap.c b/pango/pangocairo-fcfontmap.c index f6e96aa5..83a39616 100644 --- a/pango/pangocairo-fcfontmap.c +++ b/pango/pangocairo-fcfontmap.c @@ -37,17 +37,17 @@ static void pango_cairo_fc_font_map_set_resolution (PangoCairoFontMap *cfontmap, double dpi) { - PangoCairoFcFontMap *cffontmap = PANGO_CAIRO_FC_FONT_MAP (cfontmap); + PangoCairoFcFontMap *cffontmap = (PangoCairoFcFontMap *) (cfontmap); cffontmap->dpi = dpi; - pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (cfontmap)); + pango_fc_font_map_cache_clear ((PangoFcFontMap *) (cfontmap)); } static double pango_cairo_fc_font_map_get_resolution_cairo (PangoCairoFontMap *cfontmap) { - PangoCairoFcFontMap *cffontmap = PANGO_CAIRO_FC_FONT_MAP (cfontmap); + PangoCairoFcFontMap *cffontmap = (PangoCairoFcFontMap *) (cfontmap); return cffontmap->dpi; } @@ -55,7 +55,7 @@ pango_cairo_fc_font_map_get_resolution_cairo (PangoCairoFontMap *cfontmap) static PangoRenderer * pango_cairo_fc_font_map_get_renderer (PangoCairoFontMap *cfontmap) { - PangoCairoFcFontMap *cffontmap = PANGO_CAIRO_FC_FONT_MAP (cfontmap); + PangoCairoFcFontMap *cffontmap = (PangoCairoFcFontMap *) (cfontmap); if (!cffontmap->renderer) cffontmap->renderer = g_object_new (PANGO_TYPE_CAIRO_RENDERER, NULL); @@ -77,7 +77,7 @@ G_DEFINE_TYPE_WITH_CODE (PangoCairoFcFontMap, pango_cairo_fc_font_map, PANGO_TYP static void pango_cairo_fc_font_map_finalize (GObject *object) { - PangoCairoFcFontMap *cffontmap = PANGO_CAIRO_FC_FONT_MAP (object); + PangoCairoFcFontMap *cffontmap = (PangoCairoFcFontMap *) (object); if (cffontmap->renderer) g_object_unref (cffontmap->renderer); @@ -104,7 +104,7 @@ static double pango_cairo_fc_font_map_get_resolution_fc (PangoFcFontMap *fcfontmap, PangoContext *context) { - PangoCairoFcFontMap *cffontmap = PANGO_CAIRO_FC_FONT_MAP (fcfontmap); + PangoCairoFcFontMap *cffontmap = (PangoCairoFcFontMap *) (fcfontmap); double dpi; if (context) @@ -163,7 +163,7 @@ pango_cairo_fc_font_map_create_font (PangoFcFontMap *fcfontmap, const PangoFontDescription *desc, FcPattern *pattern) { - return _pango_cairo_fc_font_new (PANGO_CAIRO_FC_FONT_MAP (fcfontmap), + return _pango_cairo_fc_font_new ((PangoCairoFcFontMap *) (fcfontmap), context, desc, pattern); } diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c index 412d3302..eacfc34d 100644 --- a/pango/pangocairo-font.c +++ b/pango/pangocairo-font.c @@ -72,7 +72,7 @@ gboolean _pango_cairo_font_install (PangoCairoFont *font, cairo_t *cr) { - if (G_UNLIKELY (!PANGO_IS_CAIRO_FONT (font))) + if (G_UNLIKELY (!font)) { if (!_pango_cairo_warning_history.font_install) { @@ -89,7 +89,7 @@ _pango_cairo_font_install (PangoCairoFont *font, cairo_font_face_t * _pango_cairo_font_get_font_face (PangoCairoFont *font) { - g_return_val_if_fail (PANGO_IS_CAIRO_FONT (font), NULL); + g_return_val_if_fail (font, NULL); return (* PANGO_CAIRO_FONT_GET_IFACE (font)->get_font_face) (font); } @@ -97,7 +97,7 @@ _pango_cairo_font_get_font_face (PangoCairoFont *font) cairo_scaled_font_t * _pango_cairo_font_get_scaled_font (PangoCairoFont *font) { - g_return_val_if_fail (PANGO_IS_CAIRO_FONT (font), NULL); + g_return_val_if_fail (font, NULL); return (* PANGO_CAIRO_FONT_GET_IFACE (font)->get_scaled_font) (font); } @@ -122,7 +122,7 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont) PangoCairoHexBoxInfo *hbi; /* for metrics hinting */ - double scale_x, scale_x_inv, scale_y, scale_y_inv; + double scale_x = 1., scale_x_inv = 1., scale_y = 1., scale_y_inv = 1.; gboolean is_hinted; int i; @@ -217,7 +217,7 @@ _pango_cairo_font_get_hex_box_info (PangoCairoFont *cfont) /* load mini_font */ - context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + context = pango_cairo_font_map_create_context ((PangoCairoFontMap *) (fontmap)); pango_context_set_matrix (context, &pango_ctm); pango_context_set_language (context, pango_language_from_string ("en")); diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c index 28a5a961..a41cb9b4 100644 --- a/pango/pangocairo-fontmap.c +++ b/pango/pangocairo-fontmap.c @@ -465,7 +465,7 @@ pango_cairo_create_layout (cairo_t *cr) g_return_val_if_fail (cr != NULL, NULL); fontmap = pango_cairo_font_map_get_default (); - context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + context = pango_cairo_font_map_create_context ((PangoCairoFontMap *) (fontmap)); layout = pango_layout_new (context); pango_cairo_update_context (cr, context); diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c index f39df3f5..26be779c 100644 --- a/pango/pangocairo-render.c +++ b/pango/pangocairo-render.c @@ -49,7 +49,7 @@ static void set_color (PangoCairoRenderer *crenderer, PangoRenderPart part) { - PangoColor *color = pango_renderer_get_color (PANGO_RENDERER (crenderer), part); + PangoColor *color = pango_renderer_get_color ((PangoRenderer *) (crenderer), part); if (color) cairo_set_source_rgb (crenderer->cr, @@ -106,7 +106,7 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer, hbi = _pango_cairo_font_get_hex_box_info ((PangoCairoFont *)font); - if (!hbi || !_pango_cairo_font_install (PANGO_CAIRO_FONT (hbi->font), crenderer->cr)) + if (!hbi || !_pango_cairo_font_install ((PangoCairoFont *) (hbi->font), crenderer->cr)) { _pango_cairo_renderer_draw_box_glyph (crenderer, gi, cx, cy); goto done; @@ -163,7 +163,7 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer, int x, int y) { - PangoCairoRenderer *crenderer = PANGO_CAIRO_RENDERER (renderer); + PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer); /* cairo_glyph_t is 24 bytes */ #define MAX_STACK 40 @@ -250,7 +250,7 @@ pango_cairo_renderer_draw_rectangle (PangoRenderer *renderer, int width, int height) { - PangoCairoRenderer *crenderer = PANGO_CAIRO_RENDERER (renderer); + PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer); if (!crenderer->do_path) { @@ -354,7 +354,7 @@ pango_cairo_renderer_draw_error_underline (PangoRenderer *renderer, int width, int height) { - PangoCairoRenderer *crenderer = PANGO_CAIRO_RENDERER (renderer); + PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer); cairo_t *cr = crenderer->cr; if (!crenderer->do_path) |