[cairo] API Shakeup: cairo_current_path -> cairo_copy_path_data

Bill Spitzak spitzak at d2.com
Mon Mar 14 21:15:56 PST 2005


I'm wondering if instead the structure should be:

typedef union {
   struct {
     enum {
       ...
     } type;
     int length;
   } header;
   double value;
} cairo_path_data_t;

In this case a moveto would use 3 entries, the header followed by the x 
and y value.

One reason is that sizeof(header)==sizeof(value) on most systems, so 
there is no wasted space.

The far more important reason is this will allow commands with an odd 
number of arguments, which may be common if 3D is going to be supported.

Carl Worth wrote:
> On Tue, 22 Feb 2005 16:32:55 -0500, Carl Worth wrote:
> 
>>	typedef union {
>>	    struct {
>>	        enum {
>>	            CAIRO_PATH_MOVE_TO,
>>	            CAIRO_PATH_LINE_TO,
>>	            CAIRO_PATH_CURVE_TO,
>>	            CAIRO_PATH_CLOSE_PATH,
>>	            CAIRO_PATH_END
>>	        } type;
>>	        int length;
>>	    } header;
>>	    struct {
>>	        double x, y;
>>	    } point;
>>	} cairo_path_data_t;



More information about the cairo mailing list