summaryrefslogtreecommitdiff
path: root/src/cairo-type3-glyph-surface.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-10-18 00:34:17 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-10-19 09:36:51 +0100
commit6b17c6da47c42dd04ed2acad723c25b6da41b51c (patch)
treeb2aea83ce2c02da17749761e8bb6249b857a8ed2 /src/cairo-type3-glyph-surface.c
parentf56cf93181e73b4ba74f25ce14f7ed6c7cf36e83 (diff)
downloadcairo-6b17c6da47c42dd04ed2acad723c25b6da41b51c.tar.gz
[type3] Acquire scaled_font mutex whilst looking up glyphs.
When looking up the glyph in the shared scaled_font glyph cache, the caller is required to have taken the scaled_font->mutex.
Diffstat (limited to 'src/cairo-type3-glyph-surface.c')
-rw-r--r--src/cairo-type3-glyph-surface.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c
index 138274325..3508ce729 100644
--- a/src/cairo-type3-glyph-surface.c
+++ b/src/cairo-type3-glyph-surface.c
@@ -286,12 +286,14 @@ _cairo_type3_glyph_surface_show_glyphs (void *abstract_surface,
&new_ctm,
&scaled_font->options);
+ CAIRO_MUTEX_LOCK (font->mutex);
status = _cairo_pdf_operators_show_text_glyphs (&surface->pdf_operators,
NULL, 0,
glyphs, num_glyphs,
NULL, 0,
FALSE,
font);
+ CAIRO_MUTEX_UNLOCK (font->mutex);
cairo_scaled_font_destroy (font);
@@ -347,11 +349,13 @@ _cairo_type3_glyph_surface_emit_fallback_image (cairo_type3_glyph_surface_t *sur
cairo_matrix_t mat;
double x, y;
+ CAIRO_MUTEX_LOCK (surface->scaled_font->mutex);
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS |
CAIRO_SCALED_GLYPH_INFO_SURFACE,
&scaled_glyph);
+ CAIRO_MUTEX_UNLOCK (surface->scaled_font->mutex);
if (status)
return status;
@@ -396,12 +400,16 @@ _cairo_type3_glyph_surface_analyze_glyph (void *abstract_surface,
null_stream = _cairo_null_stream_create ();
_cairo_type3_glyph_surface_set_stream (surface, null_stream);
+
+ CAIRO_MUTEX_LOCK (surface->scaled_font->mutex);
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS |
CAIRO_SCALED_GLYPH_INFO_META_SURFACE,
&scaled_glyph);
- if (status && status != CAIRO_INT_STATUS_UNSUPPORTED)
+ CAIRO_MUTEX_UNLOCK (surface->scaled_font->mutex);
+
+ if (_cairo_status_is_error (status))
goto cleanup;
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
@@ -411,20 +419,22 @@ _cairo_type3_glyph_surface_analyze_glyph (void *abstract_surface,
status = _cairo_meta_surface_replay (scaled_glyph->meta_surface,
&surface->base);
-
- status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (status)
- return status;
+ goto cleanup;
+
+ status2 = _cairo_pdf_operators_flush (&surface->pdf_operators);
+ if (status == CAIRO_STATUS_SUCCESS)
+ status = status2;
if (status == CAIRO_INT_STATUS_IMAGE_FALLBACK)
status = CAIRO_STATUS_SUCCESS;
cleanup:
status2 = _cairo_output_stream_destroy (null_stream);
- if (status)
- return status;
+ if (status == CAIRO_STATUS_SUCCESS)
+ status = status2;
- return status2;
+ return status;
}
cairo_status_t
@@ -458,24 +468,24 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface,
cairo_matrix_t font_matrix_inverse;
_cairo_type3_glyph_surface_set_stream (surface, stream);
+
+ CAIRO_MUTEX_LOCK (surface->scaled_font->mutex);
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS |
CAIRO_SCALED_GLYPH_INFO_META_SURFACE,
&scaled_glyph);
- if (status && status != CAIRO_INT_STATUS_UNSUPPORTED)
- return status;
-
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS,
&scaled_glyph);
- if (status)
- return status;
-
- status = CAIRO_INT_STATUS_IMAGE_FALLBACK;
+ if (status == CAIRO_STATUS_SUCCESS)
+ status = CAIRO_INT_STATUS_IMAGE_FALLBACK;
}
+ CAIRO_MUTEX_UNLOCK (surface->scaled_font->mutex);
+ if (_cairo_status_is_error (status))
+ return status;
x_advance = scaled_glyph->metrics.x_advance;
y_advance = scaled_glyph->metrics.y_advance;
@@ -508,11 +518,11 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface,
_cairo_output_stream_printf (surface->stream, "q\n");
status = _cairo_meta_surface_replay (scaled_glyph->meta_surface,
- &surface->base);
+ &surface->base);
- status = _cairo_pdf_operators_flush (&surface->pdf_operators);
- if (status)
- return status;
+ status2 = _cairo_pdf_operators_flush (&surface->pdf_operators);
+ if (status == CAIRO_STATUS_SUCCESS)
+ status = status2;
_cairo_output_stream_printf (surface->stream, "Q\n");
@@ -521,8 +531,8 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface,
_cairo_memory_stream_copy (mem_stream, stream);
status2 = _cairo_output_stream_destroy (mem_stream);
- if (status2)
- return status2;
+ if (status == CAIRO_STATUS_SUCCESS)
+ status = status2;
}
if (status == CAIRO_INT_STATUS_IMAGE_FALLBACK)