X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=dvi%2Fpixbuf-device.c;h=6175e471980f5b1d498a2604c67ac628d1cc74be;hb=65c06150e05948eb7b056b0ec5cb9c364b652cfe;hp=9ce93192a2ddfc334c9117875228a083c3fea365;hpb=c3e1500a4815225f08e1b20dd066559e8c92c280;p=evince.git diff --git a/dvi/pixbuf-device.c b/dvi/pixbuf-device.c index 9ce93192..6175e471 100644 --- a/dvi/pixbuf-device.c +++ b/dvi/pixbuf-device.c @@ -9,6 +9,10 @@ typedef struct _DviPixbufDevice gint xmargin; gint ymargin; + + Ulong fg; + Ulong bg; + } DviPixbufDevice; static void dvi_pixbuf_draw_rule(DviContext *dvi, int x, int y, Uint w, Uint h, int fill); @@ -50,8 +54,13 @@ 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; + + red = (c_device->fg >> 16) & 0xff; + green = (c_device->fg >> 8) & 0xff; + blue = c_device->fg & 0xff; x += c_device->xmargin; y += c_device->ymargin; @@ -66,19 +75,19 @@ static void dvi_pixbuf_draw_rule(DviContext *dvi, int x, int y, Uint w, Uint h, for (i = 0; i < h; i++) { if (i == 0 || i == h - 1 || fill) { for (j = 0; j < w; j++) { - p[j * 4] = 0x00; - p[j * 4 + 1] = 0x00; - p[j * 4 + 2] = 0x00; + p[j * 4] = red; + p[j * 4 + 1] = green; + p[j * 4 + 2] = blue; p[j * 4 + 3] = 0xff; } } else { - p[0] = 0x00; - p[1] = 0x00; - p[2] = 0x00; + p[0] = red; + p[1] = green; + p[2] = blue; p[3] = 0xff; - p[(w - 1) * 4] = 0x00; - p[(w - 1) * 4 + 1] = 0x00; - p[(w - 1) * 4 + 2] = 0x00; + p[(w - 1) * 4] = red; + p[(w - 1) * 4 + 1] = green; + p[(w - 1) * 4 + 2] = blue; p[(w - 1) * 4 + 3] = 0xff; } p += rowstride; @@ -131,7 +140,7 @@ 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; @@ -143,7 +152,10 @@ static void dvi_pixbuf_put_pixel(void *image, int x, int y, Ulong color) static void dvi_pixbuf_set_color(void *device_data, Ulong fg, Ulong bg) { + DviPixbufDevice *c_device = (DviPixbufDevice *) device_data; + c_device->fg = fg; + return; } @@ -194,7 +206,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); gdk_pixbuf_fill (c_device->pixbuf, 0xffffffff);