From 410f70c6b032137a61354bbbd638b023fa347725 Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 24 Feb 2005 23:53:29 +0000 Subject: [PATCH] partial fix for landscape --- lib/common/emit.c | 37 +++++++++++++++++++++++++++++++++---- lib/common/gdgen.c | 3 +-- lib/gvc/gvcint.h | 2 ++ lib/gvc/gvrender.c | 11 ++++++++++- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/lib/common/emit.c b/lib/common/emit.c index 5131ba008..bc33b983e 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -270,11 +270,40 @@ static void init_job_pagination(GVC_t * gvc, graph_t * g) job->pageBox.LL.y += extra.y / 2; } - /* FIXME, the treatment of margins doesn't look right. are margins - in device coords or graph coords ? what happens to margins under zooming */ +fprintf(stderr,"pageBox = %g,%g %g,%g\n", + job->pageBox.LL.x, + job->pageBox.LL.y, + job->pageBox.UR.x, + job->pageBox.UR.y); +fprintf(stderr,"DS = %g,%g\n", + DS.x, + DS.y); +fprintf(stderr,"zoom = %g\n", + job->zoom); + PF2P(job->pageBox.LL,job->boundingBox.LL); - job->boundingBox.UR.x = ROUND(job->pageBox.LL.x + job->pageSize.x * job->zoom); - job->boundingBox.UR.y = ROUND(job->pageBox.LL.y + job->pageSize.y * job->zoom); + if (GD_drawing(g)->landscape) { + job->boundingBox.UR.x = job->height; + job->boundingBox.UR.y = job->width; + job->offset.x = job->boundingBox.UR.y; + job->offset.y = job->boundingBox.LL.x; + job->size.x = job->boundingBox.UR.x; + job->size.y = job->boundingBox.UR.y; + } + else { + job->boundingBox.UR.x = job->width; + job->boundingBox.UR.y = job->height; + job->offset.x = job->boundingBox.LL.x; + job->offset.y = job->boundingBox.LL.y; + job->size.x = job->boundingBox.UR.x; + job->size.y = job->boundingBox.UR.y; + } + +fprintf(stderr,"boundingBox = %d,%d %d,%d\n", + job->boundingBox.LL.x, + job->boundingBox.LL.y, + job->boundingBox.UR.x, + job->boundingBox.UR.y); } static void firstpage(GVC_t *gvc) diff --git a/lib/common/gdgen.c b/lib/common/gdgen.c index 4ee11a49a..e1bcf81c9 100644 --- a/lib/common/gdgen.c +++ b/lib/common/gdgen.c @@ -142,8 +142,7 @@ static void init1_gd(GVC_t * gvc, graph_t * g, box bb, point pb) Dpi = DEFAULT_DPI; DevScale = Dpi / POINTS_PER_INCH; - Viewport.x = gvc->job->width; - Viewport.y = gvc->job->height; + Viewport = gvc->job->size; if (Viewport.x) { Zoom = gvc->job->zoom; GraphFocus = gvc->job->focus; diff --git a/lib/gvc/gvcint.h b/lib/gvc/gvcint.h index 95bebe562..b3bb9a3a6 100644 --- a/lib/gvc/gvcint.h +++ b/lib/gvc/gvcint.h @@ -89,6 +89,8 @@ extern "C" { pointf margin; /* job-specific margin */ int rotation; /* job-specific page rotation */ + point offset; /* offset into device in device coords */ + point size; /* size of device in device coords */ box boundingBox; /* drawable region in device coords */ boxf pageBox; /* drawable region in graph coords */ diff --git a/lib/gvc/gvrender.c b/lib/gvc/gvrender.c index 8d8a3b1f5..823ccfc5c 100644 --- a/lib/gvc/gvrender.c +++ b/lib/gvc/gvrender.c @@ -300,6 +300,15 @@ void gvrender_begin_graph(GVC_t * gvc, graph_t * g) else { codegen_t *cg = job->codegen; +fprintf(stderr,"boundingBox = %d,%d %d,%d\n", + job->boundingBox.LL.x, + job->boundingBox.LL.y, + job->boundingBox.UR.x, + job->boundingBox.UR.y); +fprintf(stderr,"pb = %d,%d %d,%d\n", + gvc->pb.x, + gvc->pb.y); + if (cg && cg->begin_graph) cg->begin_graph(gvc, g, job->boundingBox, gvc->pb); } @@ -336,7 +345,7 @@ void gvrender_begin_page(GVC_t * gvc) codegen_t *cg = job->codegen; if (cg && cg->begin_page) - cg->begin_page(job->g, job->pagesArrayElem, job->zoom, job->rotation, job->pageOffset); + cg->begin_page(job->g, job->pagesArrayElem, job->zoom, job->rotation, job->offset); } #endif } -- 2.40.0