desktop-shell: Fix black edges on scaled desktop pattern
authorBill Spitzak <spitzak@gmail.com>
Fri, 9 May 2014 03:00:35 +0000 (20:00 -0700)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 9 May 2014 21:03:05 +0000 (14:03 -0700)
Filter sampling outside the source image can leak black into the edges
of the
desktop image. This is most easily seen by scaling the default tiled image
with this weston.ini:

# no background-image and no background-color
background-type=scale-crop

clients/desktop-shell.c

index 4880888..e121cc7 100644 (file)
@@ -724,6 +724,7 @@ background_draw(struct widget *widget, void *data)
                case BACKGROUND_SCALE:
                        cairo_matrix_init_scale(&matrix, sx, sy);
                        cairo_pattern_set_matrix(pattern, &matrix);
+                       cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD);
                        break;
                case BACKGROUND_SCALE_CROP:
                        s = (sx < sy) ? sx : sy;
@@ -733,6 +734,7 @@ background_draw(struct widget *widget, void *data)
                        cairo_matrix_init_translate(&matrix, tx, ty);
                        cairo_matrix_scale(&matrix, s, s);
                        cairo_pattern_set_matrix(pattern, &matrix);
+                       cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD);
                        break;
                case BACKGROUND_TILE:
                        cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);