[LIBART] Full-width filling patch



This patch addresses a problem we have encountered from the Mozilla SVG implementation; when using the art_render calls, rows which completely span the update area are not drawn at all. A comparisom with the relevant paths in art_rgb_svp.c (notably the alpha tests at line 270 for example) should make it apparent what's missing from the _render case.

Feedback appreciated, especially that my alpha values are correct. Note this code has been tested on four machines every day for several weeks, without any apparent problems. (But only by the Mozilla SVG code)

Assuming it looks good, checkin to the Gnome tree would be appreciated too :-)

James Turner
Index: art_render_svp.c
===================================================================
RCS file: /cvs/gnome/libart_lgpl/art_render_svp.c,v
retrieving revision 1.2
diff -u -r1.2 art_render_svp.c
--- art_render_svp.c	2000/05/29 21:58:00	1.2
+++ art_render_svp.c	2001/09/12 15:51:20
@@ -105,7 +105,17 @@
 	  run[n_run].alpha = 0x8000;
 	  n_run++;
 	}
-    }
+  }  else {
+  
+  	if (running_sum > 0x80ff) {
+  		run[0].x = x0;
+  		run[0].alpha = running_sum;
+  		
+  		run[1].x = x1;
+	  	run[1].alpha = 0x8000;
+	 	n_run = 2;
+  	}
+  }
 
   render->n_run = n_run;
 
@@ -172,7 +182,22 @@
 	  n_run++;
 	  span_x[n_span++] = x1;
 	}
-    }
+  }  else {
+  
+  	if (running_sum > 0x80ff) {
+  		run[0].x = x0;
+  		run[0].alpha = running_sum;
+  		
+  		run[1].x = x1;
+	  	run[1].alpha = 0x8000;
+	 	n_run = 2;
+	 	
+	 	/* fix the spans too */
+	 	span_x[0] = x0;
+	 	span_x[1] = x1;
+	 	n_span = 2;
+  	}
+  }
 
   render->n_run = n_run;
   render->n_span = n_span;
@@ -238,7 +263,18 @@
 	  run[n_run].alpha = 0x8000;
 	  n_run++;
 	}
-    }
+   }  else {
+  	alpha = (running_sum >> 16) & 0xff;
+  	if (alpha) {
+  		run[0].x = x0;
+  		alpha = ((running_sum >> 8) * opacity + 0x80080) >> 8;
+  		run[0].alpha = alpha;
+  		
+  		run[1].x = x1;
+	  	run[1].alpha = 0x8000;
+	 	n_run = 2;
+  	}
+  }
 
   render->n_run = n_run;
 
@@ -312,7 +348,23 @@
 	  n_run++;
 	  span_x[n_span++] = x1;
 	}
-    }
+   }  else {
+  	alpha = (running_sum >> 16) & 0xff;
+  	if (alpha) {
+  		run[0].x = x0;
+  		alpha = ((running_sum >> 8) * opacity + 0x80080) >> 8;
+  		run[0].alpha = alpha;
+  		
+  		run[1].x = x1;
+	  	run[1].alpha = 0x8000;
+	 	n_run = 2;
+	 	
+	 	/* fix the spans too */
+	 	span_x[0] = x0;
+	 	span_x[1] = x1;
+	 	n_span = 2;
+  	}
+  }
 
   render->n_run = n_run;
   render->n_span = n_span;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]