]> granicus.if.org Git - graphviz/commitdiff
reduce deps, fix cache
authorellson <devnull@localhost>
Fri, 26 Sep 2008 03:31:20 +0000 (03:31 +0000)
committerellson <devnull@localhost>
Fri, 26 Sep 2008 03:31:20 +0000 (03:31 +0000)
lib/inkpot/inkpot_scheme.c
lib/inkpot/inkpot_structs.h
lib/inkpot/inkpot_xlate.c
lib/inkpot/inkpot_xlate.h

index bd935666f1238695d301372830fdef82c89136e9..b6cb4c816d00414cd8cee41d0d7fc72356fb0456 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "inkpot.h"
 #include "inkpot_tables.h"
-#include "inkpot_xlate.h"
 
 static size_t inkpot_writer (void *closure, const char *data, size_t length)
 {
@@ -281,16 +280,24 @@ static inkpot_status_t inkpot_set_index ( inkpot_t *inkpot, int index )
        last = SZT_IXVALUES;
     else
        last = TAB_SCHEMES_INDEX[j].first_value_idx;
+    last = last-1-first;
 
     /* clip user-provided index to fit available range */
-    index = MAX(index, 0);
-    index = MIN(index, (last-1-first));
+    index = (index < 0)    ? 0    : index;
+    index = (index > last) ? last : index;
     index += first;
 
     assert(index < SZT_IXVALUES);
-    v = inkpot->value_idx = TAB_IXVALUES[index];
+    v = TAB_IXVALUES[index];
     if (v >= SZT_VALUES)
         assert(v < SZT_VALUES + SZT_NONAME_VALUES);
+
+    if (inkpot->value_idx != v) {
+       inkpot->value_idx = v;
+       inkpot->name = NULL;
+       inkpot->out_name = NULL;
+    }
+
     return ((inkpot->status = INKPOT_SUCCESS));
 }
 
@@ -325,7 +332,7 @@ inkpot_status_t inkpot_set_default( inkpot_t *inkpot )
 {
     if (inkpot->value_idx != inkpot->default_value_idx) {
        inkpot->value_idx = inkpot->default_value_idx;
-       inkpot->name = NULL;   /* FIXME - should set this */
+       inkpot->name = NULL;
        inkpot->out_name = NULL;
     }
     return ((inkpot->status = INKPOT_SUCCESS));
index a3db276dd4b8dbb71603be9f2bd15490b89777b3..ce46d0db2f8c5645fb00effa90bcbf7f44009482 100644 (file)
@@ -120,6 +120,10 @@ struct inkpot_s {          /* The Ink Pot */
            default_value_idx,  /* The default color */
            value_idx;          /* The current color value. */
 
+       IDX_IXVALUES
+           index,              /* The index for the current value, if indexed scheme not NULL */
+           out_index;          /* The index for the current value, if indexed output scheme not NULL */
+
        inkpot_scheme_index_t
            *scheme_index,      /* Indexed input scheme, or NULL. */
            *out_scheme_index;  /* Indexed output scheme, or NULL */
index a2494a36ed3adbce92eb8ba518d110c8e8d10232..4a3d5b8236306c6c853b36e3d6efacdea71a8ad2 100644 (file)
 #include "inkpot.h"
 #include "inkpot_xlate.h"
 
+#ifndef MIN
+#define MIN(a,b)    ((a)<(b)?(a):(b))
+#endif
+
+#ifndef MAX
+#define MAX(a,b)    ((a)>(b)?(a):(b))
+#endif
+
 static void hsv2rgb(double h, double s, double v, double *r, double *g, double *b)
 {
     int i;
index 80ac8b856e7fa475f469584edfc6bf66d63e870c..a09ad1789948c4713824573d54ceef4bb33349a0 100644 (file)
 extern "C" {
 #endif
 
-#ifndef MIN
-#define MIN(a,b)    ((a)<(b)?(a):(b))
-#endif
-
-#ifndef MAX
-#define MAX(a,b)    ((a)>(b)?(a):(b))
-#endif
-
 /* possible representations of color in gvcolor_t */
 typedef enum { HSVA_DOUBLE, RGBA_BYTE, RGBA_WORD, CMYK_BYTE,
                 RGBA_DOUBLE, COLOR_STRING, COLOR_INDEX } color_type_t;