dwrite: use custom palette when rendering COLRv0

This commit is contained in:
Adrian Johnson 2023-01-26 13:14:59 +10:30
parent 0151a67e33
commit 75d876ee29
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

@ -1971,6 +1971,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

@ -1036,7 +1036,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,