apprt/embedded: ignore size callbacks that change nothing

This commit is contained in:
Mitchell Hashimoto
2023-02-26 17:44:45 -08:00
parent 7962bd061b
commit 1c3d775d90

View File

@ -206,6 +206,12 @@ pub const Surface = struct {
}
pub fn updateSize(self: *Surface, width: u32, height: u32) void {
// Runtimes sometimes generate superflous resize events even
// if the size did not actually change (SwiftUI). We check
// that the size actually changed from what we last recorded
// since resizes are expensive.
if (self.size.width == width and self.size.height == height) return;
self.size = .{
.width = width,
.height = height,