From 01a774064e13cebc9a75e44432226d845fa46f9a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 15 Nov 2004 07:50:43 +0100 Subject: render optimizations --- render/renderimage.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'render/renderimage.c') diff --git a/render/renderimage.c b/render/renderimage.c index e4daae57..3741ab73 100644 --- a/render/renderimage.c +++ b/render/renderimage.c @@ -12,8 +12,6 @@ static inline int getcomp(fz_pixmap *pix, int u, int v, int k) return 0; if (v < 0 || v >= pix->h) return 0; -// u = CLAMP(u, 0, pix->w - 1); -// v = CLAMP(v, 0, pix->h - 1); return pix->samples[ (v * pix->w + u) * pix->n + k ]; } @@ -204,7 +202,8 @@ printf(" draw image rgb over\n"); else { printf(" draw image rgb over after cs transform\n"); - error = fz_convertpixmap(&tile3, tile2, cs, gc->model); + error = fz_newpixmap(&tile3, tile2->x, tile2->y, tile2->w, tile2->h, gc->model->n + 1); + fz_convertpixmap(cs, tile2, gc->model, tile3); error = drawtile(gc, gc->acc, tile3, ctm, 1); fz_droppixmap(tile3); } @@ -214,8 +213,19 @@ printf(" draw image rgb over after cs transform\n"); else { printf(" draw image after cs transform\n"); - error = fz_convertpixmap(&tile3, tile2, cs, gc->model); - error = fz_newpixmap(&gc->tmp, gc->x, gc->y, gc->w, gc->h, gc->model->n + 1); + error = fz_newpixmap(&tile3, tile2->x, tile2->y, tile2->w, tile2->h, gc->model->n + 1); + fz_convertpixmap(cs, tile2, gc->model, tile3); + fz_rect bbox = fz_boundnode((fz_node*)node, ctm); + fz_irect aabb; + aabb.min.x = fz_floor(bbox.min.x) - 1; + aabb.min.y = fz_floor(bbox.min.y) - 1; + aabb.max.x = fz_ceil(bbox.max.x) + 1; + aabb.max.y = fz_ceil(bbox.max.y) + 1; + aabb = fz_intersectirects(aabb, (fz_irect){{gc->x,gc->y},{gc->x+gc->w,gc->y+gc->h}}); + error = fz_newpixmap(&gc->tmp, + aabb.min.x, aabb.min.y, + aabb.max.x - aabb.min.x, aabb.max.y - aabb.min.y, + gc->model->n + 1); fz_clearpixmap(gc->tmp); error = drawtile(gc, gc->tmp, tile3, ctm, 0); fz_droppixmap(tile3); -- cgit v1.2.3