summaryrefslogtreecommitdiff
path: root/src/cairo-scaled-font.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-10-16 16:48:54 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-10-21 11:37:16 +0100
commitdf357f26ff72571acb840715efa4930054d4fdbe (patch)
tree66e9174c24c52564a5d691a21653c8b31a3b7156 /src/cairo-scaled-font.c
parentf0cd20e6cec445eb627c2708c2230c8bad1b64ce (diff)
Support component-alpha.
Within our code base we carried a few hacks to utilize the component alpha capabilities of pixman, whilst not supporting the concept for our own masks. Thus we were setting it upon the pixman_image_t that we passed around through code that was blissfully unaware and indeed the component-alpha property was forgotten (e.g. upgrading glyph masks). The real issue is that without explicit support that a pattern carries subpixel masking information, that information is lost when using that pattern with composite. Again we can look at the example of compositing a sub-pixel glyph mask onto a remote xlib surface for further failure.
Diffstat (limited to 'src/cairo-scaled-font.c')
-rw-r--r--src/cairo-scaled-font.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 199ad39e..179844fc 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -2169,8 +2169,10 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
}
_cairo_pattern_init_for_surface (&mask_pattern, mask);
-
- status = _cairo_surface_composite (CAIRO_OPERATOR_ADD,
+ /* Note that we only upgrade masks, i.e. A1 -> A8 -> ARGB32, so there is
+ * never any component alpha here.
+ */
+ status = _cairo_surface_composite (CAIRO_OPERATOR_SOURCE,
&white_pattern.base,
&mask_pattern.base,
new_mask,
@@ -2203,6 +2205,8 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
_cairo_pattern_init_for_surface (&glyph_pattern,
&glyph_surface->base);
+ if (mask_format == CAIRO_FORMAT_ARGB32)
+ glyph_pattern.base.has_component_alpha = TRUE;
status = _cairo_surface_composite (CAIRO_OPERATOR_ADD,
&white_pattern.base,
@@ -2222,11 +2226,9 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
}
}
- if (mask_format == CAIRO_FORMAT_ARGB32) {
- pixman_image_set_component_alpha (((cairo_image_surface_t*) mask)->
- pixman_image, TRUE);
- }
_cairo_pattern_init_for_surface (&mask_pattern, mask);
+ if (mask_format == CAIRO_FORMAT_ARGB32)
+ mask_pattern.base.has_component_alpha = TRUE;
status = _cairo_surface_composite (op, pattern, &mask_pattern.base,
surface,