mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-07 05:30:19 +01:00
[ATSUI] [1/2] Implement CAIRO_SCALED_GLYPH_INFO_SURFACE support.(#9467)
All non-quartz surfaces need to fall back to using glyph surfaces, in order to clip correctly. The bug being fixed is visible in the clip-operator test. This first patch takes out direct rendering support for non-quartz surfaces, causing all image tests to fail.
This commit is contained in:
parent
116ae23fc6
commit
77171cb8e2
1 changed files with 44 additions and 33 deletions
|
|
@ -674,6 +674,13 @@ _cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_cairo_atsui_scaled_font_init_glyph_surface (cairo_atsui_font_t *scaled_font,
|
||||
cairo_scaled_glyph_t *scaled_glyph)
|
||||
{
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_atsui_font_scaled_glyph_init (void *abstract_font,
|
||||
cairo_scaled_glyph_t *scaled_glyph,
|
||||
|
|
@ -694,6 +701,12 @@ _cairo_atsui_font_scaled_glyph_init (void *abstract_font,
|
|||
return status;
|
||||
}
|
||||
|
||||
if ((info & CAIRO_SCALED_GLYPH_INFO_SURFACE) != 0) {
|
||||
status = _cairo_atsui_scaled_font_init_glyph_surface (scaled_font, scaled_glyph);
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -777,14 +790,17 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
|
|||
void *extra = NULL;
|
||||
cairo_bool_t can_draw_directly;
|
||||
cairo_rectangle_int16_t rect;
|
||||
cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *)generic_surface;
|
||||
|
||||
ATSFontRef atsFont;
|
||||
CGFontRef cgFont;
|
||||
CGAffineTransform textTransform;
|
||||
|
||||
if (!_cairo_surface_is_quartz (generic_surface))
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
/* Check if we can draw directly to the destination surface */
|
||||
can_draw_directly = _cairo_surface_is_quartz (generic_surface) &&
|
||||
_cairo_pattern_is_opaque_solid (pattern) &&
|
||||
can_draw_directly = _cairo_pattern_is_opaque_solid (pattern) &&
|
||||
op == CAIRO_OPERATOR_OVER;
|
||||
|
||||
if (!can_draw_directly) {
|
||||
|
|
@ -837,38 +853,33 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
|
|||
CGContextSetRGBFillColor(drawingContext, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (_cairo_surface_is_quartz (generic_surface)) {
|
||||
cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *)generic_surface;
|
||||
if (surface->clip_region) {
|
||||
pixman_box16_t *boxes = pixman_region_rects (surface->clip_region);
|
||||
int num_boxes = pixman_region_num_rects (surface->clip_region);
|
||||
CGRect stack_rects[10];
|
||||
CGRect *rects;
|
||||
int i;
|
||||
|
||||
/* XXX: Return-value of malloc needs to be checked for
|
||||
* NULL. Can someone fix this who is more familiar with
|
||||
* the cleanup needed in this function?
|
||||
*/
|
||||
if (num_boxes > 10)
|
||||
rects = malloc (sizeof (CGRect) * num_boxes);
|
||||
else
|
||||
rects = stack_rects;
|
||||
|
||||
for (i = 0; i < num_boxes; i++) {
|
||||
rects[i].origin.x = boxes[i].x1;
|
||||
rects[i].origin.y = boxes[i].y1;
|
||||
rects[i].size.width = boxes[i].x2 - boxes[i].x1;
|
||||
rects[i].size.height = boxes[i].y2 - boxes[i].y1;
|
||||
}
|
||||
|
||||
CGContextClipToRects (drawingContext, rects, num_boxes);
|
||||
|
||||
if (rects != stack_rects)
|
||||
free(rects);
|
||||
if (surface->clip_region) {
|
||||
pixman_box16_t *boxes = pixman_region_rects (surface->clip_region);
|
||||
int num_boxes = pixman_region_num_rects (surface->clip_region);
|
||||
CGRect stack_rects[10];
|
||||
CGRect *rects;
|
||||
int i;
|
||||
|
||||
/* XXX: Return-value of malloc needs to be checked for
|
||||
* NULL. Can someone fix this who is more familiar with
|
||||
* the cleanup needed in this function?
|
||||
*/
|
||||
if (num_boxes > 10)
|
||||
rects = malloc (sizeof (CGRect) * num_boxes);
|
||||
else
|
||||
rects = stack_rects;
|
||||
|
||||
for (i = 0; i < num_boxes; i++) {
|
||||
rects[i].origin.x = boxes[i].x1;
|
||||
rects[i].origin.y = boxes[i].y1;
|
||||
rects[i].size.width = boxes[i].x2 - boxes[i].x1;
|
||||
rects[i].size.height = boxes[i].y2 - boxes[i].y1;
|
||||
}
|
||||
} else {
|
||||
/* XXX: Need to get the text clipped */
|
||||
|
||||
CGContextClipToRects (drawingContext, rects, num_boxes);
|
||||
|
||||
if (rects != stack_rects)
|
||||
free(rects);
|
||||
}
|
||||
|
||||
/* TODO - bold and italic text
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue