mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 01:57:00 +00:00
bug 717178. Part 2.5: Make cairo_win32_font_face_create_for_logfontw_hfont take ownership of the HFONT. r=jrmuizel
This commit is contained in:
parent
f29ed4b405
commit
1abce7564f
@ -200,6 +200,8 @@ handle-multi-path-clip.patch: bug 813124, handle multiple clip paths correctly
|
||||
|
||||
win32-gdi-font-cache.patch: Bug 717178, cache GDI font faces to reduce usage of GDI resources
|
||||
|
||||
win32-hfont-ownership.patch: Bug 717178, make cairo_win32_font_face_create_for_logfontw_hfont take ownership of the passed HFONT
|
||||
|
||||
==== pixman patches ====
|
||||
|
||||
pixman-android-cpu-detect.patch: Add CPU detection support for Android, where we can't reliably access /proc/self/auxv.
|
||||
|
@ -2042,11 +2042,14 @@ _cairo_win32_font_face_destroy (void *abstract_face)
|
||||
cairo_win32_font_face_t *font_face = abstract_face;
|
||||
|
||||
hash_table = _cairo_win32_font_face_hash_table_lock ();
|
||||
if (unlikely (hash_table == NULL)) {
|
||||
return;
|
||||
if (hash_table) {
|
||||
_cairo_hash_table_remove (hash_table, &font_face->base.hash_entry);
|
||||
_cairo_win32_font_face_hash_table_unlock ();
|
||||
}
|
||||
|
||||
if (font_face->hfont) {
|
||||
DeleteObject (font_face->hfont);
|
||||
}
|
||||
_cairo_hash_table_remove (hash_table, &font_face->base.hash_entry);
|
||||
_cairo_win32_font_face_hash_table_unlock ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2056,7 +2059,8 @@ _cairo_win32_font_face_destroy (void *abstract_face)
|
||||
* fields of this structure are ignored. Otherwise lfWidth, lfOrientation and
|
||||
* lfEscapement must be zero.
|
||||
* @font: An #HFONT that can be used when the font matrix is a scale by
|
||||
* -lfHeight and the CTM is identity.
|
||||
* -lfHeight and the CTM is identity. The cairo_font_face_t takes ownership
|
||||
* of 'font' and is responsible for destroying it.
|
||||
*
|
||||
* Creates a new font for the Win32 font backend based on a
|
||||
* #LOGFONT. This font can then be used with
|
||||
@ -2078,6 +2082,12 @@ cairo_win32_font_face_create_for_logfontw_hfont (LOGFONTW *logfont, HFONT font)
|
||||
hash_table = _cairo_win32_font_face_hash_table_lock ();
|
||||
if (unlikely (hash_table == NULL)) {
|
||||
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
|
||||
if (font) {
|
||||
/* We are supposed to take ownership of this font. Since we don't
|
||||
* need to use it, delete it now.
|
||||
*/
|
||||
DeleteObject (font);
|
||||
}
|
||||
return (cairo_font_face_t *)&_cairo_font_face_nil;
|
||||
}
|
||||
|
||||
@ -2087,6 +2097,12 @@ cairo_win32_font_face_create_for_logfontw_hfont (LOGFONTW *logfont, HFONT font)
|
||||
font_face = _cairo_hash_table_lookup (hash_table,
|
||||
&key.base.hash_entry);
|
||||
if (font_face != NULL) {
|
||||
if (font) {
|
||||
/* We are supposed to take ownership of this font. Since we don't
|
||||
* need to use it, delete it now.
|
||||
*/
|
||||
DeleteObject (font);
|
||||
}
|
||||
cairo_font_face_reference (&font_face->base);
|
||||
goto DONE;
|
||||
}
|
||||
@ -2115,6 +2131,13 @@ DONE:
|
||||
FAIL:
|
||||
_cairo_win32_font_face_hash_table_unlock ();
|
||||
|
||||
if (font) {
|
||||
/* We are supposed to take ownership of this font. Since we don't
|
||||
* need to use it, delete it now.
|
||||
*/
|
||||
DeleteObject (font);
|
||||
}
|
||||
|
||||
return (cairo_font_face_t *)&_cairo_font_face_nil;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user