X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=dvi%2Fpixbuf-device.c;h=1ef436587812c3728d005dff8445f98235d78642;hb=6effa286615442dc4e1081227eeba4f9bf3f3380;hp=fbb059282602e1dc90e2d49d54827132d91eb381;hpb=e88d645e01f3bfbdbeb965f49a091887ead04ab1;p=evince.git diff --git a/dvi/pixbuf-device.c b/dvi/pixbuf-device.c index fbb05928..1ef43658 100644 --- a/dvi/pixbuf-device.c +++ b/dvi/pixbuf-device.c @@ -54,7 +54,7 @@ static void dvi_pixbuf_draw_rule(DviContext *dvi, int x, int y, Uint w, Uint h, { DviPixbufDevice *c_device = (DviPixbufDevice *) dvi->device.device_data; gint rowstride; - gchar *p; + guchar *p; gint i, j; gint red, green, blue; @@ -70,25 +70,22 @@ static void dvi_pixbuf_draw_rule(DviContext *dvi, int x, int y, Uint w, Uint h, return; rowstride = gdk_pixbuf_get_rowstride (c_device->pixbuf); - p = gdk_pixbuf_get_pixels (c_device->pixbuf) + rowstride * y + 4 * x; + p = gdk_pixbuf_get_pixels (c_device->pixbuf) + rowstride * y + 3 * x; for (i = 0; i < h; i++) { if (i == 0 || i == h - 1 || fill) { for (j = 0; j < w; j++) { - p[j * 4] = red; - p[j * 4 + 1] = green; - p[j * 4 + 2] = blue; - p[j * 4 + 3] = 0xff; + p[j * 3] = red; + p[j * 3 + 1] = green; + p[j * 3 + 2] = blue; } } else { p[0] = red; p[1] = green; p[2] = blue; - p[3] = 0xff; - p[(w - 1) * 4] = red; - p[(w - 1) * 4 + 1] = green; - p[(w - 1) * 4 + 2] = blue; - p[(w - 1) * 4 + 3] = 0xff; + p[(w - 1) * 3] = red; + p[(w - 1) * 3 + 1] = green; + p[(w - 1) * 3 + 2] = blue; } p += rowstride; } @@ -128,7 +125,7 @@ static int dvi_pixbuf_interpolate_colors(void *device_data, static void *dvi_pixbuf_create_image(void *device_data, Uint w, Uint h, Uint bpp) { - return gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h); + return gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, w, h); return NULL; } @@ -140,14 +137,13 @@ static void dvi_pixbuf_free_image(void *ptr) static void dvi_pixbuf_put_pixel(void *image, int x, int y, Ulong color) { - gchar *p; + guchar *p; - p = gdk_pixbuf_get_pixels (GDK_PIXBUF(image)) + y * gdk_pixbuf_get_rowstride(GDK_PIXBUF(image)) + x * 4; + p = gdk_pixbuf_get_pixels (GDK_PIXBUF(image)) + y * gdk_pixbuf_get_rowstride(GDK_PIXBUF(image)) + x * 3; p[0] = (color >> 16) & 0xff; p[1] = (color >> 8) & 0xff; p[2] = color & 0xff; - p[3] = (color >> 24) & 0xff; } static void dvi_pixbuf_set_color(void *device_data, Ulong fg, Ulong bg) @@ -207,7 +203,7 @@ mdvi_pixbuf_device_render (DviContext * dvi) page_width = dvi->dvi_page_w * dvi->params.conv + 2 * c_device->xmargin; page_height = dvi->dvi_page_h * dvi->params.vconv + 2 * c_device->ymargin; - c_device->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, page_width, page_height); + c_device->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, page_width, page_height); gdk_pixbuf_fill (c_device->pixbuf, 0xffffffff); mdvi_dopage (dvi, dvi->currpage);