Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

Remove unnecessary SKImage wrappers in ImmutableBitmap

Open laolarou726 opened this issue 5 months ago • 13 comments

What does the pull request do?

Currently, in ImmutableBitmap's implementation, there is an unnecessary conversion from SKBitmap to SKImage. Most of the properties and data can be directly extracted from SKImage.

laolarou726 avatar Jan 23 '24 07:01 laolarou726

You can test this PR using the following package version. 11.1.999-cibuild0043875-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Jan 23 '24 07:01 avaloniaui-bot

By moving to SKBitmap all bitmaps are always CPU bound

Gillibald avatar Jan 23 '24 09:01 Gillibald

By moving to SKBitmap all bitmaps are always CPU bound

I see, so this is the reason we need to keep the instance of the SKImage?

laolarou726 avatar Jan 23 '24 16:01 laolarou726

Possibly we can have two different implementations, one SKBitmap backed and another SKimage backed. Updating all the usage. But does it have any benefit of avoiding SKImage? I don’t expect it copy all the memory, unless I am wrong.

maxkatz6 avatar Jan 23 '24 20:01 maxkatz6

You can test this PR using the following package version. 11.1.999-cibuild0043897-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Jan 23 '24 21:01 avaloniaui-bot

SKImage internally references the same bitmap data, IIRC.

kekekeks avatar Jan 24 '24 06:01 kekekeks

SKImage internally references the same bitmap data, IIRC.

So it is safe to remove those fields?

laolarou726 avatar Jan 25 '24 00:01 laolarou726

You can test this PR using the following package version. 11.1.999-cibuild0044677-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Feb 09 '24 01:02 avaloniaui-bot

You can test this PR using the following package version. 11.2.999-cibuild0046525-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Mar 25 '24 00:03 avaloniaui-bot

You can test this PR using the following package version. 11.2.999-cibuild0046817-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar Mar 29 '24 18:03 avaloniaui-bot