Ensure that the temporary canvas created in CanvasGraphics.isFontSubpixelAAEnabled will be cleared
				
					
				
			While this particular canvas may be small, there can still be an arbitrarily large number of them (one per page rendered), which can/will eventually add up memory wise. This can be easily avoided by using the `cachedCanvases` abstraction instead, which will ensure that the `isFontSubpixelAAEnabled` canvas is removed together with other temporary canvases in `CanvasGraphics.endDrawing`.
This commit is contained in:
		
							parent
							
								
									21d70b19c2
								
							
						
					
					
						commit
						b61b4d3229
					
				@ -1414,7 +1414,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
 | 
				
			|||||||
    get isFontSubpixelAAEnabled() {
 | 
					    get isFontSubpixelAAEnabled() {
 | 
				
			||||||
      // Checks if anti-aliasing is enabled when scaled text is painted.
 | 
					      // Checks if anti-aliasing is enabled when scaled text is painted.
 | 
				
			||||||
      // On Windows GDI scaled fonts looks bad.
 | 
					      // On Windows GDI scaled fonts looks bad.
 | 
				
			||||||
      var ctx = this.canvasFactory.create(10, 10).context;
 | 
					      const { context: ctx, } =
 | 
				
			||||||
 | 
					        this.cachedCanvases.getCanvas('isFontSubpixelAAEnabled', 10, 10);
 | 
				
			||||||
      ctx.scale(1.5, 1);
 | 
					      ctx.scale(1.5, 1);
 | 
				
			||||||
      ctx.fillText('I', 0, 10);
 | 
					      ctx.fillText('I', 0, 10);
 | 
				
			||||||
      var data = ctx.getImageData(0, 0, 10, 10).data;
 | 
					      var data = ctx.getImageData(0, 0, 10, 10).data;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user