Remove getSinglePixelWidth workaround
				
					
				
			It's no longer necessary since https://bugzilla.mozilla.org/show_bug.cgi?id=1305963 is fixed quite some time ago. While we're here, mark the `cachedGetSinglePixelWidth` member as being private and use ES6 syntax in the `getSinglePixelWidth` method.
This commit is contained in:
		
							parent
							
								
									d409c42068
								
							
						
					
					
						commit
						1a3e842dc4
					
				@ -435,7 +435,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
				
			|||||||
      // the transformation must already be set in canvasCtx._transformMatrix.
 | 
					      // the transformation must already be set in canvasCtx._transformMatrix.
 | 
				
			||||||
      addContextCurrentTransform(canvasCtx);
 | 
					      addContextCurrentTransform(canvasCtx);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this.cachedGetSinglePixelWidth = null;
 | 
					    this._cachedGetSinglePixelWidth = null;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function putBinaryImageData(ctx, imgData) {
 | 
					  function putBinaryImageData(ctx, imgData) {
 | 
				
			||||||
@ -1068,13 +1068,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
				
			|||||||
        // Ensure that the clipping path is reset (fixes issue6413.pdf).
 | 
					        // Ensure that the clipping path is reset (fixes issue6413.pdf).
 | 
				
			||||||
        this.pendingClip = null;
 | 
					        this.pendingClip = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.cachedGetSinglePixelWidth = null;
 | 
					        this._cachedGetSinglePixelWidth = null;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    transform: function CanvasGraphics_transform(a, b, c, d, e, f) {
 | 
					    transform: function CanvasGraphics_transform(a, b, c, d, e, f) {
 | 
				
			||||||
      this.ctx.transform(a, b, c, d, e, f);
 | 
					      this.ctx.transform(a, b, c, d, e, f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.cachedGetSinglePixelWidth = null;
 | 
					      this._cachedGetSinglePixelWidth = null;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Path
 | 
					    // Path
 | 
				
			||||||
@ -1484,7 +1484,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
				
			|||||||
          TextRenderingMode.FILL_STROKE_MASK;
 | 
					          TextRenderingMode.FILL_STROKE_MASK;
 | 
				
			||||||
        if (fillStrokeMode === TextRenderingMode.STROKE ||
 | 
					        if (fillStrokeMode === TextRenderingMode.STROKE ||
 | 
				
			||||||
            fillStrokeMode === TextRenderingMode.FILL_STROKE) {
 | 
					            fillStrokeMode === TextRenderingMode.FILL_STROKE) {
 | 
				
			||||||
          this.cachedGetSinglePixelWidth = null;
 | 
					          this._cachedGetSinglePixelWidth = null;
 | 
				
			||||||
          lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR;
 | 
					          lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
@ -1597,7 +1597,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
				
			|||||||
      if (isTextInvisible || fontSize === 0) {
 | 
					      if (isTextInvisible || fontSize === 0) {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      this.cachedGetSinglePixelWidth = null;
 | 
					      this._cachedGetSinglePixelWidth = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ctx.save();
 | 
					      ctx.save();
 | 
				
			||||||
      ctx.transform.apply(ctx, current.textMatrix);
 | 
					      ctx.transform.apply(ctx, current.textMatrix);
 | 
				
			||||||
@ -2249,21 +2249,15 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
      ctx.beginPath();
 | 
					      ctx.beginPath();
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) {
 | 
					    getSinglePixelWidth(scale) {
 | 
				
			||||||
      if (this.cachedGetSinglePixelWidth === null) {
 | 
					      if (this._cachedGetSinglePixelWidth === null) {
 | 
				
			||||||
        // NOTE: The `save` and `restore` commands used below is a workaround
 | 
					        const inverse = this.ctx.mozCurrentTransformInverse;
 | 
				
			||||||
        // that is necessary in order to prevent `mozCurrentTransformInverse`
 | 
					 | 
				
			||||||
        // from intermittently returning incorrect values in Firefox, see:
 | 
					 | 
				
			||||||
        // https://github.com/mozilla/pdf.js/issues/7188.
 | 
					 | 
				
			||||||
        this.ctx.save();
 | 
					 | 
				
			||||||
        var inverse = this.ctx.mozCurrentTransformInverse;
 | 
					 | 
				
			||||||
        this.ctx.restore();
 | 
					 | 
				
			||||||
        // max of the current horizontal and vertical scale
 | 
					        // max of the current horizontal and vertical scale
 | 
				
			||||||
        this.cachedGetSinglePixelWidth = Math.sqrt(Math.max(
 | 
					        this._cachedGetSinglePixelWidth = Math.sqrt(Math.max(
 | 
				
			||||||
          (inverse[0] * inverse[0] + inverse[1] * inverse[1]),
 | 
					          (inverse[0] * inverse[0] + inverse[1] * inverse[1]),
 | 
				
			||||||
          (inverse[2] * inverse[2] + inverse[3] * inverse[3])));
 | 
					          (inverse[2] * inverse[2] + inverse[3] * inverse[3])));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return this.cachedGetSinglePixelWidth;
 | 
					      return this._cachedGetSinglePixelWidth;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) {
 | 
					    getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) {
 | 
				
			||||||
      var transform = this.ctx.mozCurrentTransform;
 | 
					      var transform = this.ctx.mozCurrentTransform;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user