summaryrefslogtreecommitdiff
path: root/src/drv/cdpdf.c
diff options
context:
space:
mode:
authorscuri <scuri>2010-06-16 21:09:54 +0000
committerscuri <scuri>2010-06-16 21:09:54 +0000
commit483f59d3a55720c8c140aef863f4d34a0d90cca8 (patch)
tree914494291b1870c2b50e7c252c156c91133e9a62 /src/drv/cdpdf.c
parent72857b1207600b10bd73e9b1fee479438aae3ac9 (diff)
*** empty log message ***
Diffstat (limited to 'src/drv/cdpdf.c')
-rw-r--r--src/drv/cdpdf.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/drv/cdpdf.c b/src/drv/cdpdf.c
index e2482b7..58cf474 100644
--- a/src/drv/cdpdf.c
+++ b/src/drv/cdpdf.c
@@ -111,18 +111,16 @@ static void begin_page(cdCtxCanvas *ctxcanvas)
static void init_pdf(cdCtxCanvas *ctxcanvas)
{
ctxcanvas->scale = 72.0/ctxcanvas->res;
+ ctxcanvas->canvas->xres = ctxcanvas->res/25.4;
+ ctxcanvas->canvas->yres = ctxcanvas->canvas->xres;
- /* Converte p/ unidades do usuario */
- ctxcanvas->canvas->w = (int)(ctxcanvas->width_pt/ctxcanvas->scale + 0.5);
- ctxcanvas->canvas->h = (int)(ctxcanvas->height_pt/ctxcanvas->scale + 0.5);
-
- /* Passa o valor em milimetros para o canvas CD */
ctxcanvas->canvas->w_mm = ctxcanvas->width_mm;
ctxcanvas->canvas->h_mm = ctxcanvas->height_mm;
+ ctxcanvas->canvas->w = cdRound(ctxcanvas->canvas->xres*ctxcanvas->canvas->w_mm);
+ ctxcanvas->canvas->h = cdRound(ctxcanvas->canvas->yres*ctxcanvas->canvas->h_mm);
+
ctxcanvas->canvas->bpp = 24;
- ctxcanvas->canvas->xres = ctxcanvas->canvas->w / ctxcanvas->canvas->w_mm;
- ctxcanvas->canvas->yres = ctxcanvas->canvas->h / ctxcanvas->canvas->h_mm;
begin_page(ctxcanvas);
}
@@ -1675,7 +1673,7 @@ static void cdcreatecanvas(cdCanvas* canvas, void *data)
/* update canvas context */
canvas->ctxcanvas = ctxcanvas;
- if (ctxcanvas->landscape == 1)
+ if (ctxcanvas->landscape)
{
_cdSwapDouble(ctxcanvas->width_pt, ctxcanvas->height_pt);
_cdSwapDouble(ctxcanvas->width_mm, ctxcanvas->height_mm);