Commit graph

28 commits

Author SHA1 Message Date
i509VCB
4aac1d2860
detail platform specific behavior of set_buffer on Wayland 2023-01-01 13:52:47 -06: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
John Nunley
3eeafad834
x11: Add XCB support to the X11 backend (#52) 2022-12-27 09:14:54 -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
Ian Douglas Scott
c73bd4b836 Add feature flags for x11 and wayland
Winit has features for these, so it makes sense to offer the same.
2022-12-21 16:20:15 -08:00
Simon Hausmann
254d33caf6 Fix rustdoc warning about unresolved links
The referenced functions and the described ownership concept don't exist
anymore.
2022-12-21 06:40:07 -07:00
Jeremy Soller
9b8641fc07 Make new function take both a HasRawWindowHandle and a HasRawDisplayHandle object 2022-12-20 13:40:54 -07:00
Jeremy Soller
e781cd8cab Add from_raw function for direct use of raw handles 2022-12-20 13:40:54 -07: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
Ian Douglas Scott
33fe3ae3c7
Enable Wayland and x11 code on FreeBSD 2022-12-20 07:11:10 -07:00
Jeremy Soller
7351d68814
Add Redox/Orbital support 2022-12-20 07:11:09 -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
David Johnson
745c2d44dc
Merge pull request #6 from kpreid/asref
Add `impl AsRef<W> for GraphicsContext<W>`.
2022-08-23 21:03:59 -05:00
Kevin Reid
3529b2054b #[inline] for the AsRef implementation.
This may be redundant since the function is generic and generic
functions are, in the current Rust compiler, always inlinable, but it
follows the general recommended practice of making trivial accessor
functions inlinable.
2022-08-23 19:00:00 -07:00
Kevin Reid
1c0683c88d Make GraphicsContext::window_mut() an unsafe fn.
As documented in the new safety comment, providing `&mut` access to an
inner component about which there are consistency invariants is unsafe,
because `&mut` is sufficient for a caller to completely replace the
value (using assignment or `std::mem::swap()`).

Luckily, when `softbuffer` is used with `winit`, no `&mut` access is
needed. However, other windowing libraries such as `glfw` and `sdl2` do
have `&mut` methods, so this method can't simply be removed.

This is a breaking change since it makes a previously safe function
unsafe, and should not be published without a major version bump
(i.e. to `0.2.0` or higher).
2022-05-26 08:37:37 -07:00
Kevin Reid
cfbde6073c Add impl AsRef<W> for GraphicsContext<W>.
This will allow code which works with windows generically (such as an
event loop which can work with `softbuffer` or another graphics library)
to be able to access the underlying window without knowing about
`softbuffer` in particular.
2022-05-26 08:37:11 -07:00
Liam Murphy
d735510f72 Add web support
A limitation of this implementation is that it can't coexist with anything which creates a canvas context other than `CanvasRenderingContext2D`, since only one context can exist per canvas.
2022-02-12 20:24:18 +11:00
David Johnson
d8087a68a0 Added Wayland support 2022-01-19 21:26:20 -06:00
Seo Sanghyeon
7ff0d65793 Add macOS support using Core Graphics 2022-01-19 13:18:09 +09:00
David Johnson
dc6fc474be Added better error handling 2022-01-16 09:01:02 -06:00
David Johnson
e7b6541de9 Added README.md 2022-01-16 08:43:00 -06:00
David Johnson
5cdaae1412 Added rustdoc to all public items 2022-01-16 08:17:53 -06:00
David Johnson
8286c2bd6c Added safety checks for incorrectly sized buffers being passed 2022-01-16 08:07:39 -06:00
David Johnson
d89a0c92aa Added windows support and made example render something fancier 2022-01-16 08:03:20 -06:00
David Johnson
384f2dc9a3 Added X11 support 2022-01-15 08:17:17 -06:00