summaryrefslogtreecommitdiff
path: root/src/drv
diff options
context:
space:
mode:
Diffstat (limited to 'src/drv')
-rw-r--r--src/drv/cdirgb.c18
-rw-r--r--src/drv/cdpdf.c47
2 files changed, 23 insertions, 42 deletions
diff --git a/src/drv/cdirgb.c b/src/drv/cdirgb.c
index 8135fa1..f0eb98e 100644
--- a/src/drv/cdirgb.c
+++ b/src/drv/cdirgb.c
@@ -1341,7 +1341,7 @@ static void cdputimagerectrgba(cdCtxCanvas* ctxcanvas, int iw, int ih, const uns
static void cdputimagerectmap(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsigned char *index, const long int *colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax)
{
- int l, c, xsize, ysize, xpos, ypos, src_offset, dst_offset, rw, rh, pal_size, idx, img_topdown = 0;
+ int l, c, xsize, ysize, xpos, ypos, src_offset, dst_offset, rw, rh, idx, img_topdown = 0;
const unsigned char *src_index;
if (ctxcanvas->canvas->use_matrix)
@@ -1371,22 +1371,6 @@ static void cdputimagerectmap(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsi
rw = xmax-xmin+1;
rh = ymax-ymin+1;
- /* Como nao sabemos o tamanho da palette a priori,
- teremos que ver qual o maior indice usado na imagem. */
- pal_size = 0;
-
- for (l=0; l<ih; l++)
- {
- for (c=0; c<iw; c++)
- {
- idx = index[l*iw + c];
- if (idx > pal_size)
- pal_size = idx;
- }
- }
-
- pal_size++;
-
/* testa se tem que fazer zoom */
if (rw != w || rh != h)
{
diff --git a/src/drv/cdpdf.c b/src/drv/cdpdf.c
index f2c608f..e6f3f73 100644
--- a/src/drv/cdpdf.c
+++ b/src/drv/cdpdf.c
@@ -360,7 +360,7 @@ static void cdfsector(cdCtxCanvas *ctxcanvas, double xc, double yc, double w, do
if (w==h)
{
PDF_moveto(ctxcanvas->pdf, xc, yc);
- PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*w, a1, a2);
+ PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*h, a1, a2);
PDF_fill(ctxcanvas->pdf);
}
else /* Elipse: mudar a escala p/ criar a partir do circulo */
@@ -373,15 +373,7 @@ static void cdfsector(cdCtxCanvas *ctxcanvas, double xc, double yc, double w, do
PDF_moveto(ctxcanvas->pdf, xc, yc);
PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*h, a1, a2);
-
- if (ctxcanvas->canvas->interior_style == CD_SOLID ||
- ctxcanvas->canvas->interior_style == CD_PATTERN)
- PDF_fill(ctxcanvas->pdf);
- else
- {
- PDF_lineto(ctxcanvas->pdf, xc, yc);
- PDF_stroke(ctxcanvas->pdf);
- }
+ PDF_fill(ctxcanvas->pdf);
PDF_restore(ctxcanvas->pdf); /* restore from local */
}
@@ -398,7 +390,7 @@ static void cdfchord(cdCtxCanvas *ctxcanvas, double xc, double yc, double w, dou
if (w==h)
{
- PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*w, a1, a2);
+ PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*h, a1, a2);
PDF_fill_stroke(ctxcanvas->pdf);
}
else /* Elipse: mudar a escala p/ criar a partir do circulo */
@@ -407,9 +399,10 @@ static void cdfchord(cdCtxCanvas *ctxcanvas, double xc, double yc, double w, dou
/* local transform */
PDF_translate(ctxcanvas->pdf, xc, yc);
- PDF_scale(ctxcanvas->pdf, 1, w/h);
+ PDF_scale(ctxcanvas->pdf, w/h, 1);
+ PDF_translate(ctxcanvas->pdf, -xc, -yc);
- PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*w, a1, a2);
+ PDF_arc(ctxcanvas->pdf, xc, yc, 0.5*h, a1, a2);
PDF_fill_stroke(ctxcanvas->pdf);
PDF_restore(ctxcanvas->pdf); /* restore from local */
@@ -964,7 +957,7 @@ static void cdtransform(cdCtxCanvas *ctxcanvas, const double* matrix)
static void cdputimagerectrgb(cdCtxCanvas *ctxcanvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax)
{
- int i, j, d, image, rw, rh, rgb_size;
+ int i, j, d, image, rw, rh, rgb_size, pos;
char options[80];
unsigned char* rgb_data;
@@ -981,9 +974,10 @@ static void cdputimagerectrgb(cdCtxCanvas *ctxcanvas, int iw, int ih, const unsi
for (i=ymax; i>=ymin; i--)
for (j=xmin; j<=xmax; j++)
{
- rgb_data[d] = r[i*iw+j]; d++;
- rgb_data[d] = g[i*iw+j]; d++;
- rgb_data[d] = b[i*iw+j]; d++;
+ pos = i*iw+j;
+ rgb_data[d] = r[pos]; d++;
+ rgb_data[d] = g[pos]; d++;
+ rgb_data[d] = b[pos]; d++;
}
PDF_create_pvf(ctxcanvas->pdf, "cd_raw_rgb", 0, rgb_data, rgb_size, "");
@@ -1000,7 +994,7 @@ static void cdputimagerectrgb(cdCtxCanvas *ctxcanvas, int iw, int ih, const unsi
static void cdputimagerectrgba(cdCtxCanvas *ctxcanvas, int iw, int ih, const unsigned char *r, const unsigned char *g, const unsigned char *b, const unsigned char *a, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax)
{
- int i, j, d, image, image_mask, rw, rh, alpha_size, rgb_size;
+ int i, j, d, image, image_mask, rw, rh, alpha_size, rgb_size, pos;
char options[80];
unsigned char *rgb_data, *alpha_data;
@@ -1017,9 +1011,10 @@ static void cdputimagerectrgba(cdCtxCanvas *ctxcanvas, int iw, int ih, const uns
for (i=ymax; i>=ymin; i--)
for (j=xmin; j<=xmax; j++)
{
- rgb_data[d] = r[i*iw+j]; d++;
- rgb_data[d] = g[i*iw+j]; d++;
- rgb_data[d] = b[i*iw+j]; d++;
+ pos = i*iw+j;
+ rgb_data[d] = r[pos]; d++;
+ rgb_data[d] = g[pos]; d++;
+ rgb_data[d] = b[pos]; d++;
}
alpha_size = rw*rh;
@@ -1030,7 +1025,8 @@ static void cdputimagerectrgba(cdCtxCanvas *ctxcanvas, int iw, int ih, const uns
for (i=ymax; i>=ymin; i--)
for (j=xmin; j<=xmax; j++)
{
- alpha_data[d] = a[i*iw+j]; d++;
+ pos = i*iw+j;
+ alpha_data[d] = a[pos]; d++;
}
PDF_create_pvf(ctxcanvas->pdf, "cd_raw_rgb", 0, rgb_data, rgb_size, "");
@@ -1053,9 +1049,10 @@ static void cdputimagerectrgba(cdCtxCanvas *ctxcanvas, int iw, int ih, const uns
static void cdputimagerectmap(cdCtxCanvas *ctxcanvas, int iw, int ih, const unsigned char *index, const long int *colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax)
{
- int i, j, d, rw, rh, image, rgb_size;
+ int i, j, d, rw, rh, image, rgb_size, pos;
char options[80];
unsigned char* rgb_data;
+ unsigned char r, g, b;
if (xmin<0 || ymin<0 || xmax-xmin+1>iw || ymax-ymin+1>ih) return;
@@ -1070,8 +1067,8 @@ static void cdputimagerectmap(cdCtxCanvas *ctxcanvas, int iw, int ih, const unsi
for (i=ymax; i>=ymin; i--)
for (j=xmin; j<=xmax; j++)
{
- unsigned char r, g, b;
- cdDecodeColor(colors[index[i*iw+j]], &r, &g, &b);
+ pos = i*iw+j;
+ cdDecodeColor(colors[index[pos]], &r, &g, &b);
rgb_data[d] = r; d++;
rgb_data[d] = g; d++;
rgb_data[d] = b; d++;