From 07cc456ae9969f1b507f3a9423562480e9d3d61e Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Tue, 19 Apr 2011 16:24:19 +0200 Subject: [PATCH] Fixed rendering for mupdf/poppler backend --- ft/pdf-mupdf/pdf.c | 2 +- ft/pdf-poppler/pdf.c | 4 ++-- render.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ft/pdf-mupdf/pdf.c b/ft/pdf-mupdf/pdf.c index f602ffa..31d7cb2 100644 --- a/ft/pdf-mupdf/pdf.c +++ b/ft/pdf-mupdf/pdf.c @@ -230,7 +230,7 @@ pdf_page_render(zathura_page_t* page) for (unsigned int y = 0; y < pixmap->h; y++) { for (unsigned int x = 0; x < pixmap->w; x++) { unsigned char *s = pixmap->samples + y * pixmap->w * 4 + x * 4; - guchar* p = image_buffer->data + y * image_buffer->width + x; + guchar* p = image_buffer->data + y * image_buffer->rowstride + x * 3; p[0] = s[0]; p[1] = s[1]; p[2] = s[2]; diff --git a/ft/pdf-poppler/pdf.c b/ft/pdf-poppler/pdf.c index ac5eb07..3850ceb 100644 --- a/ft/pdf-poppler/pdf.c +++ b/ft/pdf-poppler/pdf.c @@ -269,7 +269,7 @@ pdf_page_render(zathura_page_t* page) return NULL; } - poppler_page_render_to_pixbuf(page->data, 0, 0, page_width, page_height, + poppler_page_render_to_pixbuf(page->data, 0, 0, page->width, page->height, page->document->scale, 0, pixbuf); /* create image buffer */ @@ -288,7 +288,7 @@ pdf_page_render(zathura_page_t* page) for (unsigned int y = 0; y < page_height; y++) { for (unsigned int x = 0; x < page_width; x++) { unsigned char *s = pixels + y * rowstride + x * n_channels; - guchar* p = image_buffer->data + y * image_buffer->width + x; + guchar* p = image_buffer->data + y * image_buffer->rowstride + x * 3; p[0] = s[0]; p[1] = s[1]; p[2] = s[2]; diff --git a/render.c b/render.c index 66b3a40..ef3a7af 100644 --- a/render.c +++ b/render.c @@ -162,9 +162,9 @@ render(zathura_t* zathura, zathura_page_t* page) unsigned char* src = image_buffer->data + y * image_buffer->rowstride; for (unsigned int x = 0; x < page_width; x++) { - dst[0] = src[0]; + dst[0] = src[2]; dst[1] = src[1]; - dst[2] = src[2]; + dst[2] = src[0]; src += 3; dst += 4; }