     maxSquare = 5000000  # ios max canvas square
     maxSize = 4096  # ie max canvas dimensions
 
-    do run = ->
+    run = ->
       if sW <= w
-        # console.log('draw: ' + (new Date() - start))
         df.resolve(img)
         return
 

        df.resolve(canvas, sSize)

    df.promise()

  #
  # Util functions

        df.notify((originalW - sW) / (originalW - w))
        run()

    runNative = ->
      canvas = document.createElement('canvas')
      canvas.width = w
      canvas.height = h
      cx = canvas.getContext('2d')
      cx.imageSmoothingQuality = 'high'
      cx.drawImage(img, 0, 0, w, h)
      img.src = '//:0'            # for image
      img.width = img.height = 1  # for canvas
      df.resolve(canvas)

    cx = document.createElement('canvas').getContext('2d')
    if 'imageSmoothingQuality' of cx
      runNative()
    else
      run()

    df.promise()


  ns.drawFileToCanvas = (file, mW, mH, bg, maxSource) ->
    # in -> file
