[ps] Only use fallback images if the gradient has non-constant alpha.
If the gradient has constant alpha, then we can express it as a flattened linear gradient. Otherwise, should the opacity vary across the gradient we need to fallback.
|
|
@ -1437,11 +1437,25 @@ static cairo_bool_t
|
|||
_gradient_pattern_supported (cairo_ps_surface_t *surface,
|
||||
cairo_pattern_t *pattern)
|
||||
{
|
||||
cairo_gradient_pattern_t *gradient = (cairo_gradient_pattern_t *) pattern;
|
||||
uint16_t alpha;
|
||||
cairo_extend_t extend;
|
||||
int i;
|
||||
|
||||
if (surface->ps_level == CAIRO_PS_LEVEL_2)
|
||||
return FALSE;
|
||||
|
||||
if (gradient->n_stops == 0)
|
||||
return TRUE;
|
||||
|
||||
/* Alpha gradients are only supported (by flattening the alpha)
|
||||
* if there is no variation in the alpha across the gradient. */
|
||||
alpha = gradient->stops[0].color.alpha_short;
|
||||
for (i = 0; i < gradient->n_stops; i++) {
|
||||
if (gradient->stops[i].color.alpha_short != alpha)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
surface->ps_level_used = CAIRO_PS_LEVEL_3;
|
||||
extend = cairo_pattern_get_extend (pattern);
|
||||
|
||||
|
|
|
|||
1
test/.gitignore
vendored
|
|
@ -91,6 +91,7 @@ get-xrender-format
|
|||
glitz-surface-source
|
||||
glyph-cache-pressure
|
||||
gradient-alpha
|
||||
gradient-constant-alpha
|
||||
gradient-zero-stops
|
||||
group-paint
|
||||
imagediff
|
||||
|
|
|
|||
|
|
@ -455,7 +455,6 @@ REFERENCE_IMAGES = \
|
|||
gradient-alpha-rgb24-ref.png \
|
||||
gradient-constant-alpha-pdf-argb32-ref.png \
|
||||
gradient-constant-alpha-pdf-rgb24-ref.png \
|
||||
gradient-constant-alpha-ps-argb32-ref.png \
|
||||
gradient-constant-alpha-ps-rgb24-ref.png \
|
||||
gradient-constant-alpha-ref.png \
|
||||
gradient-constant-alpha-rgb24-ref.png \
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 130 B |
BIN
test/gradient-constant-alpha-ps-ref.png
Normal file
|
After Width: | Height: | Size: 124 B |
BIN
test/gradient-constant-alpha-ps-rgb24-ref.png
Normal file
|
After Width: | Height: | Size: 124 B |
BIN
test/gradient-constant-alpha-ref.png
Normal file
|
After Width: | Height: | Size: 117 B |
BIN
test/gradient-constant-alpha-rgb24-ref.png
Normal file
|
After Width: | Height: | Size: 116 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |