Bug 1852420 Comment 5 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

This is happening because the first canvas is a D2D canvas, and the OffscreenCanvas is a Skia canvas. When we crop the underlying source surface with the D2D canvas, we end up getting a SourceSurfaceRecording out of it, without a link to the original surface:
https://searchfox.org/mozilla-central/rev/09f7e00da9eaef55c80620c17e8575ddd4532451/dom/canvas/ImageBitmap.cpp#810
https://searchfox.org/mozilla-central/rev/09f7e00da9eaef55c80620c17e8575ddd4532451/dom/canvas/ImageBitmap.cpp#817

Which the Skia canvas cannot draw:
https://searchfox.org/mozilla-central/rev/09f7e00da9eaef55c80620c17e8575ddd4532451/dom/canvas/ImageBitmap.cpp#870
This is happening because the first canvas is a D2D canvas, and the OffscreenCanvas is a Skia canvas. When we crop the underlying source surface with the D2D canvas, we end up getting a SourceSurfaceRecording out of it, without a link to the original surface:
https://searchfox.org/mozilla-central/rev/09f7e00da9eaef55c80620c17e8575ddd4532451/dom/canvas/ImageBitmap.cpp#810
https://searchfox.org/mozilla-central/rev/09f7e00da9eaef55c80620c17e8575ddd4532451/dom/canvas/ImageBitmap.cpp#817

Which the Skia canvas cannot draw.

If we don't crop, we hit the OptimizeSourceSurface path, which for a DrawTargetRecording means it creates a SourceSurfaceRecording with a link to the original surface which we can use to draw with Skia:
https://searchfox.org/mozilla-central/rev/09f7e00da9eaef55c80620c17e8575ddd4532451/dom/canvas/ImageBitmap.cpp#870
https://searchfox.org/mozilla-central/rev/09f7e00da9eaef55c80620c17e8575ddd4532451/gfx/2d/DrawTargetRecording.cpp#601

Back to Bug 1852420 Comment 5