Commit graph

24 commits

Author SHA1 Message Date
Mads Marquart
f198b222bd macOS: Fix double-free of NSWindow 2023-11-15 02:16:04 +01:00
John Nunley
0bcd2e22a2
breaking: Use raw-window-handle version 0.6
Signed-off-by: John Nunley <dev@notgull.net>
Co-Authored-By: dAxpeDDa <daxpedda@gmail.com>
2023-10-26 19:15:51 -07:00
Ian Douglas Scott
e10c360929 cg: Require non-zero width/height; panic instead of segfault
Fixes https://github.com/rust-windowing/softbuffer/issues/124.
2023-07-24 18:24:23 -07:00
Ian Douglas Scott
1e7b9213d2 Merge remote-tracking branch 'origin/master' into damage 2023-06-02 15:03:10 -07:00
John Nunley
44248477be
feat: Add a function for retrieving the window contents
This function is useful for testing the window contents in certain cases. In addition,
this means that we can now have reliable tests for softbuffer's actual functionality.

Signed-off-by: John Nunley <jtnunley01@gmail.com>
Co-authored-by: dAxpeDDa <daxpedda@gmail.com>
2023-06-01 20:09:30 -07:00
Ian Douglas Scott
29b3f4a978 Add a Buffer::age() method
Fixes https://github.com/rust-windowing/softbuffer/issues/90.
2023-04-26 15:04:20 -07:00
Ian Douglas Scott
c1d6716eec Add a Buffer::present_with_damage() method
Supported on Wayland, X11, and Win32.

Fixes https://github.com/rust-windowing/softbuffer/issues/39.

try_for_each
2023-04-26 11:58:11 -07:00
Ian Douglas Scott
a09e4cf679
Owned pixel buffer for no-copy presentation
This is based on the API that will be used for no-copy presentation. But
wraps it in `set_buffer`.

This also fixes the Wayland buffer code to set `self.width` and
`self.height` on resize, and set the length of the shared memory file
when the buffer is created.

Co-authored-by: jtnunley <jtnunley01@gmail.com>
2023-04-06 10:30:59 +03:00
Simon Hausmann
4c6631c764 mac: retain the NSWindow to ensure that the call to retrieving the backing scale factor in set_buffer works 2023-01-15 17:04:57 +01:00
Simon Hausmann
2832a6e42b mac: Fix layer scale not being updated when contents is updated and window is on a new screen
cc #67
2023-01-15 09:12:28 +01:00
Emil Loer
b72055d122
Disable CALayer fade action when setting buffers
This commit fixes a bug in the Core Graphics backend that causes a new
buffer not be shown immediately but instead use a quarter second fade
transition. This happens because the CALayer has a default action
associated with a change in the layer contents.

The problem was mitigated by wrapping the contents change in a
transaction and disabling all actions for the duration of this
transaction.
2023-01-05 22:17:10 +01:00
Ian Douglas Scott
fc1bba64ab Rename SwBufError back to SoftBufferError
This seems to be the last thing left over from the `swbuf` rename.
2022-12-27 12:57:26 -08:00
Mads Marquart
89bd260fd8 Use #![deny(unsafe_op_in_unsafe_fn)] 2022-12-23 04:19:41 +01:00
John Nunley
5674886dfa
Add reformat to the CI (#21) 2022-12-22 12:35:18 -08:00
jtnunley
319ff565a5 Use static dispatch 2022-12-22 10:09:47 -08:00
Simon Hausmann
b74047ae86 Fix scaling of the buffer on macOS
Currently the size of the buffer on macOS is interpreted in logical pixels, which
is inconsistent with the other platforms. Instead,
we should apply the same scale factor that applies to regular rendering.
2022-12-21 07:40:47 +01:00
Jeremy Soller
99d63063b6 Take a reference to a window in GraphicsContext::new, like glutin and wgpu 2022-12-20 13:40:54 -07:00
Jeremy Soller
95e8d05902
Rename SoftBufferError to SwBufError 2022-12-20 07:11:11 -07:00
David Johnson
d30d3255c2 Updated winit to 0.27.2 for examples and raw-window-handle to 0.5.0 2022-08-24 00:16:20 -05:00
Ryan Hileman
112e777179 macOS: use a subview, improve image handling 2022-05-16 10:16:50 -07:00
Ryan Hileman
44d1ababf0 CALayer: place buffer in top left instead of scaling to window 2022-05-16 09:15:21 -07:00
Ryan Hileman
ba3b823e1c use CALayer for macOS backend 2022-04-24 07:31:19 -07:00
Seo Sanghyeon
f5b18e8196 Adapt to Core Graphics coordinate system 2022-01-19 14:04:17 +09:00
Seo Sanghyeon
7ff0d65793 Add macOS support using Core Graphics 2022-01-19 13:18:09 +09:00