]> granicus.if.org Git - graphviz/commitdiff
some cleanup
authorellson <devnull@localhost>
Thu, 4 Oct 2007 02:00:50 +0000 (02:00 +0000)
committerellson <devnull@localhost>
Thu, 4 Oct 2007 02:00:50 +0000 (02:00 +0000)
plugin/gd/gvdevice_gd.c
plugin/gd/gvrender_gd.c
plugin/gd/gvrender_gd_vrml.c

index 5aefc51b88db8234e9ab9a62545a1d5a647b784a..02b7f83ebcd219161e7f97f65fdb50d0b808fc99 100644 (file)
@@ -36,29 +36,18 @@ typedef enum {
 
 extern size_t gvdevice_write(GVJ_t * job, char * s, unsigned int len);
 
-#if 0
-static int gd_sink (void *context, const char *buffer, int len)
-{
-    if (len == gvdevice_write((GVJ_t *)context, (char *)buffer, (unsigned int)len))
-       return 0;
-    return -1;
-}
-#endif
-
-#if 1
-static int gd_putBuf (gdIOCtx *context, const void *buffer, int len)
+int gvdevice_gd_putBuf (gdIOCtx *context, const void *buffer, int len)
 {
     return gvdevice_write((GVJ_t *)(context->tell), (char *)buffer, (unsigned int)len);
 }
 
 /* used by gif output */
-static void gd_putC (gdIOCtx *context, int C)
+void gvdevice_gd_putC (gdIOCtx *context, int C)
 {
     char c = C;
 
     gvdevice_write((GVJ_t *)(context->tell), &c, 1);
 }
-#endif
 
 static void gd_format(GVJ_t * job)
 {
@@ -67,21 +56,11 @@ static void gd_format(GVJ_t * job)
     unsigned int *data = (unsigned int*)(job->imagedata);
     unsigned int width = job->width;
     unsigned int height = job->height;
-
-#if 0
-    gdSink sink;
-
-    sink.sink = gd_sink;
-    sink.context = job;
-#endif
-
-#if 1
     gdIOCtx ctx;
 
-    ctx.putBuf = gd_putBuf;
-    ctx.putC = gd_putC;
+    ctx.putBuf = gvdevice_gd_putBuf;
+    ctx.putC = gvdevice_gd_putC;
     ctx.tell = (void*)job;    /* hide *job here */
-#endif
 
     im = gdImageCreateTrueColor(width, height);
     for (y = 0; y < height; y++) {
@@ -101,9 +80,6 @@ static void gd_format(GVJ_t * job)
 #ifdef HAVE_GD_GIF
     case FORMAT_GIF:
        gdImageTrueColorToPalette(im, 0, 256);
-#if 0
-       gdImageGif(im, job->output_file);
-#endif
        gdImageGifCtx(im, &ctx);
         break;
 #endif
@@ -120,19 +96,12 @@ static void gd_format(GVJ_t * job)
         * library documentation for more details.
         */ 
 #define JPEG_QUALITY -1
-#if 0
-       gdImageJpeg(im, job->output_file, JPEG_QUALITY);
-#endif
        gdImageJpegCtx(im, &ctx, JPEG_QUALITY);
        break;
 #endif
 
 #ifdef HAVE_GD_PNG
     case FORMAT_PNG:
-#if 0
-       gdImagePng(im, job->output_file);
-       gdImagePngToSink(im, &sink);
-#endif
        gdImagePngCtx(im, &ctx);
         break;
 #endif
@@ -153,9 +122,6 @@ static void gd_format(GVJ_t * job)
        {
            /* Use black for the foreground color for the B&W wbmp image. */
             int black = gdImageColorResolveAlpha(im, 0, 0, 0, gdAlphaOpaque);
-#if 0
-           gdImageWBMP(im, black, job->output_file);
-#endif
            gdImageWBMPCtx(im, black, &ctx);
        }
        break;
index c2747e6d759585859221b47b13a301b9bcb427fc..03b74789042f18e42547803dd333431fc6056a3d 100644 (file)
@@ -145,50 +145,18 @@ static void gdgen_begin_page(GVJ_t * job)
     gdImageAlphaBlending(im, TRUE);
 }
 
-extern size_t gvdevice_write(GVJ_t * job, char * s, unsigned int len);
-
-#if 0
-static int gd_sink (void *context, const char *buffer, int len)
-{
-    if (len == gvdevice_write((GVJ_t *)context, (char *)buffer, (unsigned int)len))
-       return 0;
-    return -1;
-}
-#endif
-
-#if 1
-static int gd_putBuf (gdIOCtx *context, const void *buffer, int len)
-{
-    return gvdevice_write((GVJ_t *)(context->tell), (char *)buffer, (unsigned int)len);
-}
-
-/* used by gif output */
-static void gd_putC (gdIOCtx *context, int C)
-{
-    char c = C;
-
-    gvdevice_write((GVJ_t *)(context->tell), &c, 1);
-}
-#endif
+extern int gvdevice_gd_putBuf (gdIOCtx *context, const void *buffer, int len);
+extern void gvdevice_gd_putC (gdIOCtx *context, int C);
 
 static void gdgen_end_page(GVJ_t * job)
 {
     gdImagePtr im = (gdImagePtr) job->context;
 
-#if 0
-    gdSink sink;
-
-    sink.sink = gd_sink;
-    sink.context = job;
-#endif
-
-#if 1
     gdIOCtx ctx;
 
-    ctx.putBuf = gd_putBuf;
-    ctx.putC = gd_putC;
+    ctx.putBuf = gvdevice_gd_putBuf;
+    ctx.putC = gvdevice_gd_putC;
     ctx.tell = (void*)job;    /* hide *job here */
-#endif
 
     if (!im)
        return;
@@ -206,9 +174,6 @@ static void gdgen_end_page(GVJ_t * job)
        case FORMAT_GIF:
 #ifdef HAVE_GD_GIF
            gdImageTrueColorToPalette(im, 0, 256);
-#if 0
-           gdImageGif(im, job->output_file);
-#endif
            gdImageGifCtx(im, &ctx);
 #endif
            break;
@@ -223,19 +188,12 @@ static void gdgen_end_page(GVJ_t * job)
             * be near optimal for many applications).  See the IJG JPEG
             * library documentation for more details.  */
 #define JPEG_QUALITY -1
-#if 0
-           gdImageJpeg(im, job->output_file, JPEG_QUALITY);
-#endif
            gdImageJpegCtx(im, &ctx, JPEG_QUALITY);
 #endif
 
            break;
        case FORMAT_PNG:
 #ifdef HAVE_GD_PNG
-#if 0
-           gdImagePng(im, job->output_file);
-           gdImagePngToSink(im, &sink);
-#endif
            gdImagePngCtx(im, &ctx);
 #endif
            break;
@@ -245,9 +203,6 @@ static void gdgen_end_page(GVJ_t * job)
            {
                /* Use black for the foreground color for the B&W wbmp image. */
                int black = gdImageColorResolveAlpha(im, 0, 0, 0, gdAlphaOpaque);
-#if 0
-               gdImageWBMP(im, black, job->output_file);
-#endif
                gdImageWBMPCtx(im, black, &ctx);
            }
            break;
index bab3e6d33674257b2fbe1d81e2370ca3256dd236..efb0b50be150607145cb2661bb6a8360125fa2ab 100644 (file)
@@ -844,7 +844,8 @@ static gvrender_features_t render_features_vrml = {
 };
 
 static gvdevice_features_t device_features_vrml = {
-    GVDEVICE_BINARY_FORMAT,    /* flags */
+    GVDEVICE_BINARY_FORMAT
+      | GVDEVICE_NO_WRITER,    /* flags */
     {0.,0.},                   /* default margin - points */
     {0.,0.},                    /* default page width, height - points */
     {72.,72.},                  /* default dpi */