cleanup
This commit is contained in:
		
							parent
							
								
									faa6875b80
								
							
						
					
					
						commit
						dd1d90213b
					
				
							
								
								
									
										53
									
								
								pdf.js
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								pdf.js
									
									
									
									
									
								
							| @ -4004,7 +4004,17 @@ var CanvasGraphics = (function() { | |||||||
|       this.ctx.rect(x, y, width, height); |       this.ctx.rect(x, y, width, height); | ||||||
|     }, |     }, | ||||||
|     stroke: function() { |     stroke: function() { | ||||||
|       this.ctx.stroke(); |       var ctx = this.ctx; | ||||||
|  |       var strokeColor = this.current.strokeColor; | ||||||
|  |       if (strokeColor && strokeColor.type === "Pattern") { | ||||||
|  |         ctx.save(); | ||||||
|  |         ctx.strokeStyle = strokeColor.getPattern(ctx); | ||||||
|  |         ctx.stroke(); | ||||||
|  |         ctx.restore(); | ||||||
|  |       } else { | ||||||
|  |         ctx.stroke(); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|       this.consumePath(); |       this.consumePath(); | ||||||
|     }, |     }, | ||||||
|     closeStroke: function() { |     closeStroke: function() { | ||||||
| @ -4015,11 +4025,11 @@ var CanvasGraphics = (function() { | |||||||
|       var ctx = this.ctx; |       var ctx = this.ctx; | ||||||
|       var fillColor = this.current.fillColor; |       var fillColor = this.current.fillColor; | ||||||
| 
 | 
 | ||||||
|       if (fillColor.type === "Pattern") { |       if (fillColor && fillColor.type === "Pattern") { | ||||||
|         this.ctx.save(); |         ctx.save(); | ||||||
|         ctx.fillStyle = fillColor.getPattern(ctx); |         ctx.fillStyle = fillColor.getPattern(ctx); | ||||||
|         ctx.fill(); |         ctx.fill(); | ||||||
|         this.ctx.restore(); |         ctx.restore(); | ||||||
|       } else { |       } else { | ||||||
|         ctx.fill(); |         ctx.fill(); | ||||||
|       } |       } | ||||||
| @ -4033,13 +4043,27 @@ var CanvasGraphics = (function() { | |||||||
|     }, |     }, | ||||||
|     fillStroke: function() { |     fillStroke: function() { | ||||||
|       var ctx = this.ctx; |       var ctx = this.ctx; | ||||||
|       var fillCS = this.current.fillColorSpace; |  | ||||||
| 
 | 
 | ||||||
|       if (fillCS && fillCS.name === "Pattern") |       var fillColor = this.current.fillColor; | ||||||
|         this.current.fillPattern(ctx);  |       if (fillColor && fillColor.type === "Pattern") { | ||||||
|  |         ctx.save(); | ||||||
|  |         ctx.fillStyle = fillColor.getPattern(ctx); | ||||||
|  |         ctx.fill(); | ||||||
|  |         ctx.restore(); | ||||||
|  |       } else { | ||||||
|  |         ctx.fill(); | ||||||
|  |       } | ||||||
|  |        | ||||||
|  |       var strokeColor = this.current.strokeColor; | ||||||
|  |       if (stokeColor && strokeColor.type === "Pattern") { | ||||||
|  |         ctx.save(); | ||||||
|  |         ctx.strokeStyle = strokeColor.getPattern(ctx); | ||||||
|  |         ctx.stroke(); | ||||||
|  |         ctx.restore(); | ||||||
|  |       } else { | ||||||
|  |         ctx.stroke(); | ||||||
|  |       } | ||||||
|        |        | ||||||
|       ctx.fill(); |  | ||||||
|       ctx.stroke(); |  | ||||||
|       this.consumePath(); |       this.consumePath(); | ||||||
|     }, |     }, | ||||||
|     eoFillStroke: function() { |     eoFillStroke: function() { | ||||||
| @ -4246,9 +4270,7 @@ var CanvasGraphics = (function() { | |||||||
|         // wait until fill to actually get the pattern
 |         // wait until fill to actually get the pattern
 | ||||||
|         var pattern = Pattern.parse(arguments, cs, this.xref, this.res, |         var pattern = Pattern.parse(arguments, cs, this.xref, this.res, | ||||||
|                                     this.ctx); |                                     this.ctx); | ||||||
| //        this.current.fillColor = pattern;
 |         this.current.fillColor = pattern; | ||||||
|         this.ctx.fillStyle = pattern.getPattern(); |  | ||||||
|         this.current.fillColor = "blah"; |  | ||||||
|       } else { |       } else { | ||||||
|         this.setFillColor.apply(this, arguments); |         this.setFillColor.apply(this, arguments); | ||||||
|       } |       } | ||||||
| @ -4262,7 +4284,7 @@ var CanvasGraphics = (function() { | |||||||
|     setStrokeRGBColor: function(r, g, b) { |     setStrokeRGBColor: function(r, g, b) { | ||||||
|       var color = Util.makeCssRgb(r, g, b); |       var color = Util.makeCssRgb(r, g, b); | ||||||
|       this.ctx.strokeStyle = color; |       this.ctx.strokeStyle = color; | ||||||
|       this.current.fillColor = color; |       this.current.strokeColor = color; | ||||||
|     }, |     }, | ||||||
|     setFillRGBColor: function(r, g, b) { |     setFillRGBColor: function(r, g, b) { | ||||||
|       var color = Util.makeCssRgb(r, g, b); |       var color = Util.makeCssRgb(r, g, b); | ||||||
| @ -4272,7 +4294,7 @@ var CanvasGraphics = (function() { | |||||||
|     setStrokeCMYKColor: function(c, m, y, k) { |     setStrokeCMYKColor: function(c, m, y, k) { | ||||||
|       var color = Util.makeCssCmyk(c, m, y, k); |       var color = Util.makeCssCmyk(c, m, y, k); | ||||||
|       this.ctx.strokeStyle = color; |       this.ctx.strokeStyle = color; | ||||||
|       this.current.fillColor = color; |       this.current.strokeColor = color; | ||||||
|     }, |     }, | ||||||
|     setFillCMYKColor: function(c, m, y, k) { |     setFillCMYKColor: function(c, m, y, k) { | ||||||
|       var color = Util.makeCssCmyk(c, m, y, k); |       var color = Util.makeCssCmyk(c, m, y, k); | ||||||
| @ -5125,9 +5147,10 @@ var TilingPattern = (function() { | |||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   constructor.prototype = { |   constructor.prototype = { | ||||||
|     getPattern: function tiling_getPattern(ctx) { |     getPattern: function tiling_getPattern() { | ||||||
|       var matrix = this.matrix; |       var matrix = this.matrix; | ||||||
|       var curMatrix = this.curMatrix; |       var curMatrix = this.curMatrix; | ||||||
|  |       var ctx = this.ctx; | ||||||
| 
 | 
 | ||||||
|       if (curMatrix) |       if (curMatrix) | ||||||
|         ctx.setTransform.apply(ctx, curMatrix); |         ctx.setTransform.apply(ctx, curMatrix); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user