Merge branch 'dwrite-custom-palette' into 'master'

dwrite: use custom palette when rendering COLRv0

See merge request cairo/cairo!424
This commit is contained in:
Adrian Johnson 2023-01-27 10:44:31 +00:00
commit 407bb0a478
3 changed files with 12 additions and 1 deletions

View file

@ -830,3 +830,4 @@ cairo_font_options_get_custom_palette_color (cairo_font_options_t *options,
return CAIRO_STATUS_INVALID_INDEX;
}
slim_hidden_def (cairo_font_options_get_custom_palette_color);

View file

@ -1972,6 +1972,7 @@ slim_hidden_proto (cairo_font_face_get_user_data);
slim_hidden_proto_no_warn (cairo_font_face_reference);
slim_hidden_proto (cairo_font_face_set_user_data);
slim_hidden_proto (cairo_font_options_equal);
slim_hidden_proto (cairo_font_options_get_custom_palette_color);
slim_hidden_proto (cairo_font_options_hash);
slim_hidden_proto (cairo_font_options_merge);
slim_hidden_proto (cairo_font_options_set_antialias);

View file

@ -1055,7 +1055,16 @@ _cairo_dwrite_scaled_font_init_glyph_color_surface(cairo_dwrite_scaled_font_t *s
color_brush->SetColor(&color);
uses_foreground_color = TRUE;
} else {
color_brush->SetColor(color_run->runColor);
double red, green, blue, alpha;
cairo_status_t status;
status = cairo_font_options_get_custom_palette_color (&scaled_font->base.options,
color_run->paletteIndex,
&red, &blue, &green, &alpha);
if (status == CAIRO_STATUS_SUCCESS) {
color_brush->SetColor(D2D1::ColorF(red, blue, green, alpha));
} else {
color_brush->SetColor(color_run->runColor);
}
}
dc4->DrawGlyphRun(origin,