Adapt to cairo changes
Adapt to the api in the cairo MR that will be used, and make the code build with older cairo.
This commit is contained in:
parent
034d4d26f2
commit
30d0d9c56c
|
@ -211,6 +211,7 @@ if cairo_dep.found()
|
||||||
else
|
else
|
||||||
check_funcs += [['cairo_user_font_face_set_render_color_glyph_func', {'deps': cairo_dep}]]
|
check_funcs += [['cairo_user_font_face_set_render_color_glyph_func', {'deps': cairo_dep}]]
|
||||||
check_funcs += [['cairo_font_options_get_custom_palette_color', {'deps': cairo_dep}]]
|
check_funcs += [['cairo_font_options_get_custom_palette_color', {'deps': cairo_dep}]]
|
||||||
|
check_funcs += [['cairo_user_scaled_font_get_foreground_source', {'deps': cairo_dep}]]
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -287,12 +287,14 @@ _hb_cairo_get_color_stops (hb_cairo_context_t *c,
|
||||||
for (unsigned i = 0; i < len; i++)
|
for (unsigned i = 0; i < len; i++)
|
||||||
if ((*stops)[i].is_foreground)
|
if ((*stops)[i].is_foreground)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_CAIRO_USER_SCALED_FONT_GET_FOREGROUND_SOURCE
|
||||||
double r, g, b, a;
|
double r, g, b, a;
|
||||||
cairo_pattern_t *foreground = cairo_user_scaled_font_get_foreground_source (c->scaled_font);
|
cairo_pattern_t *foreground = cairo_user_scaled_font_get_foreground_source (c->scaled_font, true);
|
||||||
if (cairo_pattern_get_rgba (foreground, &r, &g, &b, &a) == CAIRO_STATUS_SUCCESS)
|
if (cairo_pattern_get_rgba (foreground, &r, &g, &b, &a) == CAIRO_STATUS_SUCCESS)
|
||||||
(*stops)[i].color = HB_COLOR (round (b * 255.), round (g * 255.), round (r * 255.),
|
(*stops)[i].color = HB_COLOR (round (b * 255.), round (g * 255.), round (r * 255.),
|
||||||
round (a * hb_color_get_alpha ((*stops)[i].color)));
|
round (a * hb_color_get_alpha ((*stops)[i].color)));
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
(*stops)[i].color = HB_COLOR (0, 0, 0, hb_color_get_alpha ((*stops)[i].color));
|
(*stops)[i].color = HB_COLOR (0, 0, 0, hb_color_get_alpha ((*stops)[i].color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -253,11 +253,13 @@ hb_cairo_paint_color (hb_paint_funcs_t *pfuncs HB_UNUSED,
|
||||||
|
|
||||||
if (use_foreground)
|
if (use_foreground)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_CAIRO_USER_SCALED_FONT_GET_FOREGROUND_SOURCE
|
||||||
double r, g, b, a;
|
double r, g, b, a;
|
||||||
cairo_pattern_t *foreground = cairo_user_scaled_font_get_foreground_source (c->scaled_font);
|
cairo_pattern_t *foreground = cairo_user_scaled_font_get_foreground_source (c->scaled_font, true);
|
||||||
if (cairo_pattern_get_rgba (foreground, &r, &g, &b, &a) == CAIRO_STATUS_SUCCESS)
|
if (cairo_pattern_get_rgba (foreground, &r, &g, &b, &a) == CAIRO_STATUS_SUCCESS)
|
||||||
cairo_set_source_rgba (cr, r, g, b, a * hb_color_get_alpha (color) / 255.);
|
cairo_set_source_rgba (cr, r, g, b, a * hb_color_get_alpha (color) / 255.);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
cairo_set_source_rgba (cr, 0, 0, 0, hb_color_get_alpha (color) / 255.);
|
cairo_set_source_rgba (cr, 0, 0, 0, hb_color_get_alpha (color) / 255.);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue