[LIBART] Patch for 'full-span' redraw issues



The attached patch fixes a bug in the art_render_ code when a SVP spans an entire row of the render area; the row callbacks in art_rgb_svp.c have additional logic in the (n_steps == 0) case to fill the row if required.
This code is absent in the art_render_svp.c callbacks; tha patch adds 
appropriate (I hope!) versions to all 4 variants. Ideally someone 
familiar with the code should verify that my tests (notably the scales 
of the alpha values) are correct. Having said that, the patch works for 
me and the other people who have tested it.
H&H
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]