[cairo-pattern] In init_solid() convert COLOR_ALPHA to COLOR if color is opaque

Moving this further than, so it benefits all callers.
This commit is contained in:
Behdad Esfahbod 2008-06-19 19:22:02 -04:00
parent 333a49d01d
commit e93e990324

View file

@ -252,6 +252,9 @@ _cairo_pattern_init_solid (cairo_solid_pattern_t *pattern,
const cairo_color_t *color,
cairo_content_t content)
{
if (content == CAIRO_CONTENT_COLOR_ALPHA && CAIRO_COLOR_IS_OPAQUE (color))
content = CAIRO_CONTENT_COLOR;
_cairo_pattern_init (&pattern->base, CAIRO_PATTERN_TYPE_SOLID);
pattern->color = *color;
pattern->content = content;
@ -448,9 +451,6 @@ cairo_pattern_create_rgba (double red, double green, double blue,
{
cairo_color_t color;
if (alpha >= 1.0)
return cairo_pattern_create_rgb (red, green, blue);
_cairo_restrict_value (&red, 0.0, 1.0);
_cairo_restrict_value (&green, 0.0, 1.0);
_cairo_restrict_value (&blue, 0.0, 1.0);