]> git.parisson.com Git - pdf.js.git/commitdiff
combined pathX/Y with x/y and wrote setCurrentPoint function
authorsbarman <sbarman@L3CWZ5T.(none)>
Wed, 17 Aug 2011 16:22:54 +0000 (09:22 -0700)
committersbarman <sbarman@L3CWZ5T.(none)>
Wed, 17 Aug 2011 16:22:54 +0000 (09:22 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index 45f5484f602d59663c9ddc4bbd88cfe204b8b686..2afed5f6b687cabaf2c39b239f54fa4376c1b850 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -4137,9 +4137,6 @@ var CanvasExtraState = (function() {
     this.charSpacing = 0;
     this.wordSpacing = 0;
     this.textHScale = 1;
-    // Path variables
-    this.pathX = 0;
-    this.pathY = 0;
     // Color spaces
     this.fillColorSpaceObj = null;
     this.strokeColorSpaceObj = null;
@@ -4152,7 +4149,11 @@ var CanvasExtraState = (function() {
   constructor.prototype = {
     clone: function canvasextra_clone() {
       return Object.create(this);
-    }
+    }, 
+    setCurrentPoint: function canvasextra_setCurrentPoint(x, y) {
+      this.x = x;
+      this.y = y;
+    },
   };
   return constructor;
 })();
@@ -4279,38 +4280,24 @@ var CanvasGraphics = (function() {
     // Path
     moveTo: function(x, y) {
       this.ctx.moveTo(x, y);
-      
-      var current = this.current;
-      current.pathX = x;
-      current.pathY = y;
+      this.current.setCurrentPoint(x, y);
     },
     lineTo: function(x, y) {
       this.ctx.lineTo(x, y);
-      
-      var current = this.current;
-      current.pathX = x;
-      current.pathY = y;
+      this.current.setCurrentPoint(x, y);
     },
     curveTo: function(x1, y1, x2, y2, x3, y3) {
       this.ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);
-      
-      var current = this.current;
-      current.pathX = x3;
-      current.pathY = y3;
+      this.current.setCurrentPoint(x3, y3);
     },
     curveTo2: function(x2, y2, x3, y3) {
       var current = this.current;
-      this.ctx.bezierCurveTo(current.pathX, current.pathY, x2, y2, x3, y3);
-      
-      current.pathX = x3;
-      current.pathY = y3;
+      this.ctx.bezierCurveTo(current.x, current.y, x2, y2, x3, y3);
+      current.setCurrentPoint(x3, y3);
     },
     curveTo3: function(x1, y1, x3, y3) {
       this.curveTo(x1, y1, x3, y3, x3, y3);
-      
-      var current = this.current;
-      current.pathX = x3;
-      current.pathY = y3;
+      this.current.setCurrentPoint(x3, y3);
     },
     closePath: function() {
       this.ctx.closePath();