Compositor: fast-path opaque 1:1 when source fills canvas
Handle the case where an opaque source exactly covers the destination canvas with 1:1 dimensions (even if offsets differ in calculation). This avoids per-pixel alpha branching and mirrors the existing memcpy fast path. Byte-identical for opaque sources.
This commit is contained in:
@@ -624,6 +624,18 @@ public sealed class SceneCompositor
|
||||
Buffer.BlockCopy(src.BgraPixels, 0, dst, 0, dstW * dstH * 4);
|
||||
return;
|
||||
}
|
||||
// Fully opaque source, covering entire destination canvas
|
||||
if (op == 256 && src.IsOpaque && x0 == 0 && y0 == 0 && x1 == dstW && y1 == dstH)
|
||||
{
|
||||
Buffer.BlockCopy(src.BgraPixels, 0, dst, 0, dstW * dstH * 4);
|
||||
return;
|
||||
}
|
||||
// Opaque source with 1:1 aligned region covering full canvas? treat same
|
||||
if (op == 256 && src.IsOpaque && ex == 0 && ey == 0 && src.Width == dstW && src.Height == dstH)
|
||||
{
|
||||
Buffer.BlockCopy(src.BgraPixels, 0, dst, 0, dstW * dstH * 4);
|
||||
return;
|
||||
}
|
||||
|
||||
var d = dst.AsSpan();
|
||||
var s = src.BgraPixels.AsSpan();
|
||||
|
||||
Reference in New Issue
Block a user