From a466be983469ec36151c480147e5bcddfb6914c7 Mon Sep 17 00:00:00 2001 From: HW Date: Thu, 8 Dec 2011 00:42:02 +0100 Subject: [PATCH] fixed blitting bug --- pdf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pdf.c b/pdf.c index d1942af79..637c28950 100644 --- a/pdf.c +++ b/pdf.c @@ -237,6 +237,7 @@ static int closePage(lua_State *L) { pdf_age_store(page->doc->xref->store, 2); page->page = NULL; } + return 0; } static int drawPage(lua_State *L) { @@ -291,11 +292,11 @@ static int drawPage(lua_State *L) { int x, y; for(y = 0; y < bb->h; y++) { - for(x = 0; x < bb->w; x+=2) { - bbptr[x / 2] = (((pmptr[x+1] & 0xF0) >> 4) | (pmptr[x] & 0xF0)) ^ 0xFF; + for(x = 0; x < (bb->w / 2); x++) { + bbptr[x] = (((pmptr[x*2 + 1] & 0xF0) >> 4) | (pmptr[x*2] & 0xF0)) ^ 0xFF; } if(bb->w & 1) { - bbptr[x / 2] = pmptr[x-1] & 0xF0; + bbptr[x] = pmptr[x*2] & 0xF0; } bbptr += bb->pitch; pmptr += bb->w;