Explorar el Código

SoftwareRenderer: Avoid clearing when there is nothing to clear.

Mr.doob hace 12 años
padre
commit
b6de3cf248
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      examples/js/renderers/SoftwareRenderer.js

+ 6 - 2
examples/js/renderers/SoftwareRenderer.js

@@ -158,7 +158,11 @@ THREE.SoftwareRenderer = function () {
 		var width = Math.max( rectx2, prevrectx2 ) - x;
 		var height = Math.max( recty2, prevrecty2 ) - y;
 
-		context.putImageData( imagedata, 0, 0, x, y, width, height );
+		if ( x !== Infinity ) {
+
+			context.putImageData( imagedata, 0, 0, x, y, width, height );
+
+		}
 
 		prevrectx1 = rectx1; prevrecty1 = recty1;
 		prevrectx2 = rectx2; prevrecty2 = recty2;
@@ -198,7 +202,7 @@ THREE.SoftwareRenderer = function () {
 	function drawTriangle( x1, y1, x2, y2, x3, y3, shader ) {
 
 		// https://gist.github.com/2486101
-		// explanation: ttp://pouet.net/topic.php?which=8760&page=1
+		// explanation: http://pouet.net/topic.php?which=8760&page=1
 
 		// 28.4 fixed-point coordinates