From e9a184546b18cf3b796bd560561f312934004c54 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 9 Sep 2010 01:48:52 +0200 Subject: Upgrading to CD 5.4 - and cleaning up. --- cd/src/x11/cdx11.c | 21 +++++++++++++++------ cd/src/x11/cdxclp.c | 2 +- cd/src/x11/cdxdbuf.c | 3 +-- cd/src/x11/cdximg.c | 2 +- cd/src/x11/cdxnative.c | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) (limited to 'cd/src/x11') diff --git a/cd/src/x11/cdx11.c b/cd/src/x11/cdx11.c index 94aae39..8c59d48 100755 --- a/cd/src/x11/cdx11.c +++ b/cd/src/x11/cdx11.c @@ -1137,10 +1137,12 @@ static void cdarc(cdCtxCanvas *ctxcanvas, int xc, int yc, int w, int h, double a { if (ctxcanvas->canvas->use_matrix) { - cdarcSIM(ctxcanvas, xc, yc, w, h, a1, a2); + cdSimArc(ctxcanvas, xc, yc, w, h, a1, a2); return; } + /* angles in 1/64ths of degrees counterclockwise, similar to CD */ + cdxCheckSolidStyle(ctxcanvas, 1); XDrawArc(ctxcanvas->dpy, ctxcanvas->wnd, ctxcanvas->gc, xc-w/2, yc-h/2, w, h, cdRound(a1*64), cdRound((a2 - a1)*64)); cdxCheckSolidStyle(ctxcanvas, 0); @@ -1150,7 +1152,7 @@ static void cdsector(cdCtxCanvas *ctxcanvas, int xc, int yc, int w, int h, doubl { if (ctxcanvas->canvas->use_matrix) { - cdsectorSIM(ctxcanvas, xc, yc, w, h, a1, a2); + cdSimSector(ctxcanvas, xc, yc, w, h, a1, a2); return; } @@ -1172,7 +1174,7 @@ static void cdchord(cdCtxCanvas *ctxcanvas, int xc, int yc, int w, int h, double { if (ctxcanvas->canvas->use_matrix) { - cdchordSIM(ctxcanvas, xc, yc, w, h, a1, a2); + cdSimChord(ctxcanvas, xc, yc, w, h, a1, a2); return; } @@ -1194,7 +1196,7 @@ static void cdrect(cdCtxCanvas *ctxcanvas, int xmin, int xmax, int ymin, int yma { if (ctxcanvas->canvas->use_matrix) { - cdrectSIM(ctxcanvas, xmin, xmax, ymin, ymax); + cdSimRect(ctxcanvas, xmin, xmax, ymin, ymax); return; } @@ -1207,7 +1209,7 @@ static void cdbox(cdCtxCanvas *ctxcanvas, int xmin, int xmax, int ymin, int ymax { if (ctxcanvas->canvas->use_matrix) { - cdboxSIM(ctxcanvas, xmin, xmax, ymin, ymax); + cdSimBox(ctxcanvas, xmin, xmax, ymin, ymax); return; } @@ -1394,6 +1396,9 @@ void cdxPoly(cdCtxCanvas *ctxcanvas, int mode, cdPoint* poly, int n) case CD_BEZIER: cdSimPolyBezier(ctxcanvas->canvas, poly, n); break; + case CD_PATH: + cdSimPolyPath(ctxcanvas->canvas, poly, n); + break; } if (pnt) free(pnt); @@ -2192,8 +2197,11 @@ static cdCtxImage *cdcreateimage (cdCtxCanvas *ctxcanvas, int w, int h) static void cdgetimage (cdCtxCanvas *ctxcanvas, cdCtxImage *ctximage, int x, int y) { + /* y is the bottom-left of the image in CD, must be at upper-left */ + y -= ctximage->h-1; + XCopyArea(ctxcanvas->dpy, ctxcanvas->wnd, ctximage->img, ctxcanvas->gc, - x, y - ctximage->h+1, ctximage->w, ctximage->h, 0, 0); + x, y, ctximage->w, ctximage->h, 0, 0); } static void cdputimagerect (cdCtxCanvas *ctxcanvas, cdCtxImage *ctximage, int x, int y, int xmin, int xmax, int ymin, int ymax) @@ -2243,6 +2251,7 @@ static void set_rotate_attrib(cdCtxCanvas* ctxcanvas, char* data) { if (data) { + /* use this configuration when there is NO native tranformation support */ sscanf(data, "%g %d %d", &ctxcanvas->rotate_angle, &ctxcanvas->rotate_center_x, &ctxcanvas->rotate_center_y); diff --git a/cd/src/x11/cdxclp.c b/cd/src/x11/cdxclp.c index d775fde..a2d1b6b 100755 --- a/cd/src/x11/cdxclp.c +++ b/cd/src/x11/cdxclp.c @@ -120,7 +120,7 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdClipboardContext = { - CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE), + CD_CAP_ALL & ~(CD_CAP_GETIMAGERGB | CD_CAP_IMAGESRV | CD_CAP_FONTDIM | CD_CAP_TEXTSIZE ), /* same as CD_MF */ 0, cdcreatecanvas, cdinittable, diff --git a/cd/src/x11/cdxdbuf.c b/cd/src/x11/cdxdbuf.c index 835687c..0f4955e 100755 --- a/cd/src/x11/cdxdbuf.c +++ b/cd/src/x11/cdxdbuf.c @@ -146,8 +146,7 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdDBufferContext = { - CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | - CD_CAP_FPRIMTIVES ), + CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ), 0, cdcreatecanvas, cdinittable, diff --git a/cd/src/x11/cdximg.c b/cd/src/x11/cdximg.c index 8131f78..c823705 100755 --- a/cd/src/x11/cdximg.c +++ b/cd/src/x11/cdximg.c @@ -30,7 +30,7 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdImageContext = { - CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES ), + CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER ), 0, cdcreatecanvas, cdinittable, diff --git a/cd/src/x11/cdxnative.c b/cd/src/x11/cdxnative.c index c708d20..a69314c 100755 --- a/cd/src/x11/cdxnative.c +++ b/cd/src/x11/cdxnative.c @@ -143,7 +143,7 @@ static void cdinittable(cdCanvas* canvas) static cdContext cdNativeWindowContext = { - CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES ), + CD_CAP_ALL & ~(CD_CAP_PLAY | CD_CAP_YAXIS | CD_CAP_FPRIMTIVES | CD_CAP_PATH | CD_CAP_BEZIER), 1, cdcreatecanvas, cdinittable, -- cgit v1.2.3