CarbonDesigns/carbon-ui

RenderPipeline.mergeContexts is slow

Opened this issue · 0 comments

When working on high zooms, this method seems to render huge source canvases on small destination canvas.

  • Add a big image to the project - 1000x1000
  • Make an image 50% transparent
  • Zoom in to 800% so that the image is in the viewport
  • Try to do anything, the animation frames are 500ms

In my case, source.canvas was 20000x20000

    private mergeContexts(dest, source) {
        var sx = -(source._relativeOffsetX || 0);
        var sy = -(source._relativeOffsetY || 0);

        dest.save();
        // resetTransform set relativeOffset on destinantion context
        dest.resetTransform();
        dest.drawImage(source.canvas, sx, sy);
        dest.restore();
    }