From 79b35587bfa1250d74280eb886322d7f290a8c18 Mon Sep 17 00:00:00 2001 From: malc Date: Tue, 9 Oct 2012 14:56:27 +0400 Subject: [PATCH] Make obscured optimization optional and disabled by default At least CBZ[1] can contain images with alpha which which leads to "funny" results, those adventurous enough can still compile with OBSCURED_OPT defined to get whatever speed increase that gives... [1] For instance CBZ containing just this image http://xkcd.com/1110/ --- link.c | 7 ++++++- tbs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/link.c b/link.c index a47d6fc..39d9015 100644 --- a/link.c +++ b/link.c @@ -735,6 +735,7 @@ static struct tile *alloctile (int h) return tile; } +#ifdef OBSCURED_OPT struct obs { int cured; fz_bbox b; @@ -771,6 +772,10 @@ static int obscured (struct page *page, fz_bbox bbox) fz_run_display_list (page->dlist, &dev, pagectm (page), bbox, NULL); return obs.cured; } +#define OBSCURED obscured +#else +#define OBSCURED(a, b) 0 +#endif static struct tile *rendertile (struct page *page, int x, int y, int w, int h) { @@ -808,7 +813,7 @@ static struct tile *rendertile (struct page *page, int x, int y, int w, int h) tile->w = w; tile->h = h; - if (!page->u.ptr || ((w < 128 && h < 128) || !obscured (page, bbox))) { + if (!page->u.ptr || ((w < 128 && h < 128) || !OBSCURED (page, bbox))) { clearpixmap (tile->pixmap); } dev = fz_new_draw_device (state.ctx, tile->pixmap); diff --git a/tbs b/tbs index 29236a6..f468576 100644 --- a/tbs +++ b/tbs @@ -31,7 +31,7 @@ libs="$libs -lopenjpeg -ljbig2dec -ljpeg -lz -lfreetype -lX11" if test $(hostname) = "linmac"; then cc=gcc-4.6.0 #ccopt="$ccopt -maltivec -O -D_GNU_SOURCE" -ccopt="$ccopt -maltivec -D_GNU_SOURCE" +ccopt="$ccopt -maltivec -D_GNU_SOURCE -DOBSCURED_OPT" else cc=cc ccopt="$ccopt -O -D_GNU_SOURCE -fPIC" -- 2.11.4.GIT