summaryrefslogtreecommitdiff
path: root/backend/dvi
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-09 14:55:58 +0100
committerinfirit <[email protected]>2014-12-09 23:02:28 +0100
commitc79c111d958341c4b0d59085af9feb1da72c912d (patch)
treeabeb09919de9c8856f7a6a7fabffb7c83eb94d30 /backend/dvi
parent7242bf0151af4efb698f6551fcd27b1896d0bbfe (diff)
downloadatril-c79c111d958341c4b0d59085af9feb1da72c912d.tar.bz2
atril-c79c111d958341c4b0d59085af9feb1da72c912d.tar.xz
dvi: Don't use cairo_image_surface_create_for_data()
We can use cairo_image_surface_create() and let cairo/pixman handle the memory. Taken from evince commit: cb697193fec59edfcefe503c390592851a79dd6b From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'backend/dvi')
-rw-r--r--backend/dvi/cairo-device.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/backend/dvi/cairo-device.c b/backend/dvi/cairo-device.c
index 8d6553d6..9f4badb2 100644
--- a/backend/dvi/cairo-device.c
+++ b/backend/dvi/cairo-device.c
@@ -326,9 +326,6 @@ mdvi_cairo_device_render (DviContext* dvi)
gint page_width;
gint page_height;
cairo_surface_t *surface;
- guchar *pixels;
- gint rowstride;
- static const cairo_user_data_key_t key;
cairo_device = (DviCairoDevice *) dvi->device.device_data;
@@ -338,19 +335,14 @@ mdvi_cairo_device_render (DviContext* dvi)
page_width = dvi->dvi_page_w * dvi->params.conv + 2 * cairo_device->xmargin;
page_height = dvi->dvi_page_h * dvi->params.vconv + 2 * cairo_device->ymargin;
- rowstride = page_width * 4;
- pixels = (guchar *) g_malloc (page_height * rowstride);
- memset (pixels, 0xff, page_height * rowstride);
-
- surface = cairo_image_surface_create_for_data (pixels,
- CAIRO_FORMAT_ARGB32,
- page_width, page_height,
- rowstride);
- cairo_surface_set_user_data (surface, &key,
- pixels, (cairo_destroy_func_t)g_free);
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ page_width, page_height);
cairo_device->cr = cairo_create (surface);
- cairo_surface_destroy (surface);
+ cairo_surface_destroy (surface);
+
+ cairo_set_source_rgb (cairo_device->cr, 1., 1., 1.);
+ cairo_paint (cairo_device->cr);
mdvi_dopage (dvi, dvi->currpage);
}