mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 11:28:02 +02:00
[script] Also mmap backing storage for the pattern descriptions
These can be reasonably large and persist for long times due to the font holdover caches, so manually swap them out to save space on tiny swapless machines.
This commit is contained in:
parent
80ba06803b
commit
1498c9c333
1 changed files with 13 additions and 1 deletions
|
|
@ -1709,10 +1709,22 @@ _ft_create_for_pattern (csi_t *ctx,
|
|||
ctx->_faces = _csi_list_prepend (ctx->_faces, &data->blob.list);
|
||||
data->ctx = cairo_script_interpreter_reference (ctx);
|
||||
data->blob.hash = tmpl.hash;
|
||||
data->blob.bytes = tmpl.bytes;
|
||||
data->blob.len = tmpl.len;
|
||||
data->face = NULL;
|
||||
#ifdef HAVE_MMAP
|
||||
data->blob.bytes = _mmap_bytes (tmpl.bytes, tmpl.len);
|
||||
if (data->blob.bytes != MAP_FAILED) {
|
||||
data->source = NULL;
|
||||
if (--string->base.ref == 0)
|
||||
csi_string_free (ctx, string);
|
||||
} else {
|
||||
data->blob.bytes = tmpl.bytes;
|
||||
data->source = string;
|
||||
}
|
||||
#else
|
||||
data->blob.bytes = tmpl.bytes;
|
||||
data->source = string;
|
||||
#endif
|
||||
|
||||
status = cairo_font_face_set_user_data (font_face,
|
||||
&_csi_blob_key,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue