mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 375750. don't recreate CGFontRefs every time we draw -- cache them. fixes multiple embeddings of fonts when drawing to a quartz print surface. r=vlad a=schrep
This commit is contained in:
parent
462640415e
commit
81a003c93d
@ -90,6 +90,7 @@ struct _cairo_atsui_font {
|
|||||||
|
|
||||||
Fixed size;
|
Fixed size;
|
||||||
CGAffineTransform font_matrix;
|
CGAffineTransform font_matrix;
|
||||||
|
CGFontRef cgfref;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _cairo_atsui_font_face {
|
struct _cairo_atsui_font_face {
|
||||||
@ -281,6 +282,8 @@ _cairo_atsui_font_create_scaled (cairo_font_face_t *font_face,
|
|||||||
|
|
||||||
status = _cairo_atsui_font_set_metrics (font);
|
status = _cairo_atsui_font_set_metrics (font);
|
||||||
|
|
||||||
|
font->cgfref = NULL;
|
||||||
|
|
||||||
FAIL:
|
FAIL:
|
||||||
if (status) {
|
if (status) {
|
||||||
cairo_scaled_font_destroy (&font->base);
|
cairo_scaled_font_destroy (&font->base);
|
||||||
@ -408,6 +411,9 @@ _cairo_atsui_font_fini(void *abstract_font)
|
|||||||
ATSUDisposeStyle(font->style);
|
ATSUDisposeStyle(font->style);
|
||||||
if (font->unscaled_style)
|
if (font->unscaled_style)
|
||||||
ATSUDisposeStyle(font->unscaled_style);
|
ATSUDisposeStyle(font->unscaled_style);
|
||||||
|
if (font->cgfref)
|
||||||
|
CGFontRelease(font->cgfref);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GlyphID
|
static GlyphID
|
||||||
@ -861,6 +867,19 @@ _cairo_atsui_scaled_font_get_atsu_font_id (cairo_scaled_font_t *sfont)
|
|||||||
return afont->fontID;
|
return afont->fontID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGFontRef
|
||||||
|
_cairo_atsui_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont)
|
||||||
|
{
|
||||||
|
cairo_atsui_font_t *afont = (cairo_atsui_font_t *) sfont;
|
||||||
|
|
||||||
|
if (!afont->cgfref) {
|
||||||
|
ATSFontRef atsfref = FMGetATSFontRefFromFont (afont->fontID);
|
||||||
|
afont->cgfref = CGFontCreateWithPlatformFont (&atsfref);
|
||||||
|
}
|
||||||
|
return afont->cgfref;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static cairo_int_status_t
|
static cairo_int_status_t
|
||||||
_cairo_atsui_load_truetype_table (void *abstract_font,
|
_cairo_atsui_load_truetype_table (void *abstract_font,
|
||||||
unsigned long tag,
|
unsigned long tag,
|
||||||
|
@ -72,6 +72,9 @@ _cairo_atsui_scaled_font_get_atsu_style (cairo_scaled_font_t *sfont);
|
|||||||
|
|
||||||
ATSUFontID
|
ATSUFontID
|
||||||
_cairo_atsui_scaled_font_get_atsu_font_id (cairo_scaled_font_t *sfont);
|
_cairo_atsui_scaled_font_get_atsu_font_id (cairo_scaled_font_t *sfont);
|
||||||
|
|
||||||
|
CGFontRef
|
||||||
|
_cairo_atsui_scaled_font_get_cg_font_ref (cairo_scaled_font_t *sfont);
|
||||||
#endif /* CAIRO_HAS_ATSUI_FONT */
|
#endif /* CAIRO_HAS_ATSUI_FONT */
|
||||||
|
|
||||||
#endif /* CAIRO_QUARTZ_PRIVATE_H */
|
#endif /* CAIRO_QUARTZ_PRIVATE_H */
|
||||||
|
@ -1369,9 +1369,6 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
|
|||||||
int num_glyphs,
|
int num_glyphs,
|
||||||
cairo_scaled_font_t *scaled_font)
|
cairo_scaled_font_t *scaled_font)
|
||||||
{
|
{
|
||||||
ATSUFontID fid;
|
|
||||||
ATSFontRef atsfref;
|
|
||||||
CGFontRef cgfref;
|
|
||||||
CGAffineTransform cairoTextTransform, textTransform, ctm;
|
CGAffineTransform cairoTextTransform, textTransform, ctm;
|
||||||
// XXXtodo/perf: stack storage for glyphs/sizes
|
// XXXtodo/perf: stack storage for glyphs/sizes
|
||||||
#define STATIC_BUF_SIZE 64
|
#define STATIC_BUF_SIZE 64
|
||||||
@ -1410,12 +1407,9 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
|
|||||||
|
|
||||||
CGContextSetCompositeOperation (surface->cgContext, _cairo_quartz_cairo_operator_to_quartz (op));
|
CGContextSetCompositeOperation (surface->cgContext, _cairo_quartz_cairo_operator_to_quartz (op));
|
||||||
|
|
||||||
fid = _cairo_atsui_scaled_font_get_atsu_font_id (scaled_font);
|
/* this doesn't addref */
|
||||||
atsfref = FMGetATSFontRefFromFont (fid);
|
CGFontRef cgfref = _cairo_atsui_scaled_font_get_cg_font_ref (scaled_font);
|
||||||
cgfref = CGFontCreateWithPlatformFont (&atsfref);
|
|
||||||
|
|
||||||
CGContextSetFont (surface->cgContext, cgfref);
|
CGContextSetFont (surface->cgContext, cgfref);
|
||||||
CGFontRelease (cgfref);
|
|
||||||
|
|
||||||
/* So this should include the size; I don't know if I need to extract the
|
/* So this should include the size; I don't know if I need to extract the
|
||||||
* size from this and call CGContextSetFontSize.. will I get crappy hinting
|
* size from this and call CGContextSetFontSize.. will I get crappy hinting
|
||||||
|
Loading…
Reference in New Issue
Block a user