summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-09-30 13:58:40 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-09-30 13:58:40 +0100
commita1c3b6e061c298861bcd9ae52d5756aa9258c5b7 (patch)
tree33533384b4fdb76e55ec1b953cd2f797ef7f0827
parent04427ded0cd6ad8759f04cf268c66d45953bf287 (diff)
fish-demo: don't prescale the background
-rw-r--r--fish-demo.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fish-demo.c b/fish-demo.c
index f85e0e2..bfe1c0d 100644
--- a/fish-demo.c
+++ b/fish-demo.c
@@ -17,15 +17,16 @@ static cairo_pattern_t *create_background(struct device *device)
{
cairo_surface_t *surface, *image;
cairo_pattern_t *pattern;
+ cairo_matrix_t m;
int width, height;
double sf;
cairo_t *cr;
image = cairo_image_surface_create_from_png("fishbg.png");
- sf = device->height / (double) cairo_image_surface_get_height(image);
- height = device->height;
- width = sf * cairo_image_surface_get_width(image);
+ height = cairo_image_surface_get_height(image);
+ width = cairo_image_surface_get_width(image);
+ sf = height/ (double)device->height;
surface = cairo_surface_create_similar(device->scanout,
CAIRO_CONTENT_COLOR,
@@ -33,7 +34,6 @@ static cairo_pattern_t *create_background(struct device *device)
cr = cairo_create(surface);
cairo_surface_destroy(surface);
- cairo_scale(cr, sf, sf);
cairo_set_source_surface(cr, image, 0, 0);
cairo_surface_destroy(image);
cairo_paint(cr);
@@ -41,6 +41,8 @@ static cairo_pattern_t *create_background(struct device *device)
cairo_destroy (cr);
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REFLECT);
+ cairo_matrix_init_scale(&m, sf,sf);
+ cairo_pattern_set_matrix(pattern, &m);
return pattern;
}