[draw-state] Pass state down to callbacks
diff --git a/src/hb-draw.cc b/src/hb-draw.cc
index 058d5cb..d64b328 100644
--- a/src/hb-draw.cc
+++ b/src/hb-draw.cc
@@ -30,22 +30,26 @@
 
 static void
 hb_draw_move_to_nil (hb_draw_funcs_t *dfuncs HB_UNUSED, void *draw_data HB_UNUSED,
+		     hb_draw_state_t *st HB_UNUSED,
 		     float to_x HB_UNUSED, float to_y HB_UNUSED,
 		     void *user_data HB_UNUSED) {}
 
 static void
 hb_draw_line_to_nil (hb_draw_funcs_t *dfuncs HB_UNUSED, void *draw_data HB_UNUSED,
+		     hb_draw_state_t *st HB_UNUSED,
 		     float to_x HB_UNUSED, float to_y HB_UNUSED,
 		     void *user_data HB_UNUSED) {}
 
 static void
 hb_draw_quadratic_to_nil (hb_draw_funcs_t *dfuncs HB_UNUSED, void *draw_data HB_UNUSED,
+			  hb_draw_state_t *st HB_UNUSED,
 			  float control_x HB_UNUSED, float control_y HB_UNUSED,
 			  float to_x HB_UNUSED, float to_y HB_UNUSED,
 			  void *user_data HB_UNUSED) {}
 
 static void
 hb_draw_cubic_to_nil (hb_draw_funcs_t *dfuncs HB_UNUSED, void *draw_data HB_UNUSED,
+		      hb_draw_state_t *st HB_UNUSED,
 		      float control1_x HB_UNUSED, float control1_y HB_UNUSED,
 		      float control2_x HB_UNUSED, float control2_y HB_UNUSED,
 		      float to_x HB_UNUSED, float to_y HB_UNUSED,
@@ -53,6 +57,7 @@
 
 static void
 hb_draw_close_path_nil (hb_draw_funcs_t *dfuncs HB_UNUSED, void *draw_data HB_UNUSED,
+			hb_draw_state_t *st HB_UNUSED,
 			void *user_data HB_UNUSED) {}
 
 
diff --git a/src/hb-draw.h b/src/hb-draw.h
index f8332fc..0dea7f7 100644
--- a/src/hb-draw.h
+++ b/src/hb-draw.h
@@ -67,21 +67,26 @@
 
 
 typedef void (*hb_draw_move_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data,
+					hb_draw_state_t *st,
 					float to_x, float to_y,
 					void *user_data);
 typedef void (*hb_draw_line_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data,
+					hb_draw_state_t *st,
 					float to_x, float to_y,
 					void *user_data);
 typedef void (*hb_draw_quadratic_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data,
+					     hb_draw_state_t *st,
 					     float control_x, float control_y,
 					     float to_x, float to_y,
 					     void *user_data);
 typedef void (*hb_draw_cubic_to_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data,
+					 hb_draw_state_t *st,
 					 float control1_x, float control1_y,
 					 float control2_x, float control2_y,
 					 float to_x, float to_y,
 					 void *user_data);
 typedef void (*hb_draw_close_path_func_t) (hb_draw_funcs_t *dfuncs, void *draw_data,
+					   hb_draw_state_t *st,
 					   void *user_data);
 
 HB_EXTERN void
diff --git a/src/hb-draw.hh b/src/hb-draw.hh
index 1357915..c4919d4 100644
--- a/src/hb-draw.hh
+++ b/src/hb-draw.hh
@@ -62,34 +62,34 @@
 #undef HB_DRAW_FUNC_IMPLEMENT
   } destroy;
 
-  void emit_move_to (void *draw_data,
+  void emit_move_to (void *draw_data, hb_draw_state_t &st,
 		     float to_x, float to_y)
-  { func.move_to (this, draw_data,
+  { func.move_to (this, draw_data, &st,
 		  to_x, to_y,
 		  user_data.move_to); }
-  void emit_line_to (void *draw_data,
+  void emit_line_to (void *draw_data, hb_draw_state_t &st,
 		     float to_x, float to_y)
-  { func.line_to (this, draw_data,
+  { func.line_to (this, draw_data, &st,
 		  to_x, to_y,
 		  user_data.line_to); }
-  void emit_quadratic_to (void *draw_data,
+  void emit_quadratic_to (void *draw_data, hb_draw_state_t &st,
 			  float control_x, float control_y,
 			  float to_x, float to_y)
-  { func.quadratic_to (this, draw_data,
+  { func.quadratic_to (this, draw_data, &st,
 		       control_x, control_y,
 		       to_x, to_y,
 		       user_data.quadratic_to); }
-  void emit_cubic_to (void *draw_data,
+  void emit_cubic_to (void *draw_data, hb_draw_state_t &st,
 		      float control1_x, float control1_y,
 		      float control2_x, float control2_y,
 		      float to_x, float to_y)
-  { func.cubic_to (this, draw_data,
+  { func.cubic_to (this, draw_data, &st,
 		   control1_x, control1_y,
 		   control2_x, control2_y,
 		   to_x, to_y,
 		   user_data.cubic_to); }
-  void emit_close_path (void *draw_data)
-  { func.close_path (this, draw_data,
+  void emit_close_path (void *draw_data, hb_draw_state_t &st)
+  { func.close_path (this, draw_data, &st,
 		     user_data.close_path); }
 
   /* XXX Remove */
@@ -107,7 +107,7 @@
 		float to_x, float to_y)
   {
     if (!st.path_open) start_path (draw_data, st);
-    emit_line_to (draw_data, to_x, to_y);
+    emit_line_to (draw_data, st, to_x, to_y);
     st.current_x = to_x;
     st.current_y = to_y;
   }
@@ -119,9 +119,9 @@
   {
     if (!st.path_open) start_path (draw_data, st);
     if (quadratic_to_is_set ())
-      emit_quadratic_to (draw_data, control_x, control_y, to_x, to_y);
+      emit_quadratic_to (draw_data, st, control_x, control_y, to_x, to_y);
     else
-      emit_cubic_to (draw_data,
+      emit_cubic_to (draw_data, st,
 		     (st.current_x + 2.f * control_x) / 3.f,
 		     (st.current_y + 2.f * control_y) / 3.f,
 		     (to_x + 2.f * control_x) / 3.f,
@@ -138,7 +138,7 @@
 	    float to_x, float to_y)
   {
     if (!st.path_open) start_path (draw_data, st);
-    emit_cubic_to (draw_data, control1_x, control1_y, control2_x, control2_y, to_x, to_y);
+    emit_cubic_to (draw_data, st, control1_x, control1_y, control2_x, control2_y, to_x, to_y);
     st.current_x = to_x;
     st.current_y = to_y;
   }
@@ -149,8 +149,8 @@
     if (st.path_open)
     {
       if ((st.path_start_x != st.current_x) || (st.path_start_y != st.current_y))
-	emit_line_to (draw_data, st.path_start_x, st.path_start_y);
-      emit_close_path (draw_data);
+	emit_line_to (draw_data, st, st.path_start_x, st.path_start_y);
+      emit_close_path (draw_data, st);
     }
     st.path_open = false;
     st.path_start_x = st.current_x = st.path_start_y = st.current_y = 0;
@@ -162,7 +162,7 @@
   {
     assert (!st.path_open);
     st.path_open = true;
-    emit_move_to (draw_data, st.path_start_x, st.path_start_y);
+    emit_move_to (draw_data, st, st.path_start_x, st.path_start_y);
   }
 };
 DECLARE_NULL_INSTANCE (hb_draw_funcs_t);
diff --git a/src/main.cc b/src/main.cc
index 7fe9464..fa35ae1 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -137,6 +137,7 @@
 
 static void
 move_to (hb_draw_funcs_t *dfuncs, draw_data_t *draw_data,
+	 hb_draw_state_t *st,
 	 float to_x, float to_y,
 	 void *)
 {
@@ -145,6 +146,7 @@
 
 static void
 line_to (hb_draw_funcs_t *dfuncs, draw_data_t *draw_data,
+	 hb_draw_state_t *st,
 	 float to_x, float to_y,
 	 void *)
 {
@@ -153,6 +155,7 @@
 
 static void
 quadratic_to (hb_draw_funcs_t *dfuncs, draw_data_t *draw_data,
+	      hb_draw_state_t *st,
 	      float control_x, float control_y,
 	      float to_x, float to_y,
 	      void *)
@@ -163,6 +166,7 @@
 
 static void
 cubic_to (hb_draw_funcs_t *dfuncs, draw_data_t *draw_data,
+	  hb_draw_state_t *st,
 	  float control1_x, float control1_y,
 	  float control2_x, float control2_y,
 	  float to_x, float to_y,
@@ -175,6 +179,7 @@
 
 static void
 close_path (hb_draw_funcs_t *dfuncs, draw_data_t *draw_data,
+	    hb_draw_state_t *st,
 	    void *)
 {
   fprintf (draw_data->f, "Z");