modules/layers/src/icon-layer/icon-manager.js
function resizeImage(ctx, imageData, width, height) {
  const {naturalWidth, naturalHeight} = imageData;
  if (width === naturalWidth && height === naturalHeight) {
    return imageData;
  }

  ctx.canvas.height = height;
  ctx.canvas.width = width;

  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);

  // image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight
  ctx.drawImage(imageData, 0, 0, naturalWidth, naturalHeight, 0, 0, width, height);

  return ctx.canvas;
}
function resizeImage(ctx, imageData, width, height) {
  const {naturalWidth, naturalHeight} = imageData;
  if (width === naturalWidth && height === naturalHeight) {
    return imageData;
  }

  ctx.canvas.height = height;
  ctx.canvas.width = width;

  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);

  // image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight
  ctx.drawImage(imageData, 0, 0, naturalWidth, naturalHeight, 0, 0, width, height);

  return ctx.canvas;
}
function resizeImage ( ctx , imageData , width , height ) { const { naturalWidth , naturalHeight } = imageData ; if ( width === naturalWidth && height === naturalHeight ) { return imageData ; } ctx . canvas . height = height ; ctx . canvas . width = width ; ctx . clearRect ( 0 , 0 , ctx . canvas . width , ctx . canvas . height ) ; // image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight ctx . drawImage ( imageData , 0 , 0 , naturalWidth , naturalHeight , 0 , 0 , width , height ) ; return ctx . canvas ; }
resize image to given width and height
resize image to given width and height