diff options
author | 2022-07-09 02:28:52 +0200 | |
---|---|---|
committer | 2022-07-09 02:28:52 +0200 | |
commit | e053e25d2ccb17f7a162685a106a8bbd915a873f (patch) | |
tree | 5304f3ea2712e8889c7278ec5e57418f484d8f6c /wgpu/src/window | |
parent | 66eb6263003c1bbedd1fd14d6b12f172d20a6211 (diff) | |
parent | 7105db97a53d90adf429091298f31c90974d8f08 (diff) | |
download | iced-e053e25d2ccb17f7a162685a106a8bbd915a873f.tar.gz iced-e053e25d2ccb17f7a162685a106a8bbd915a873f.tar.bz2 iced-e053e25d2ccb17f7a162685a106a8bbd915a873f.zip |
Merge pull request #1362 from iced-rs/theming
Theming
Diffstat (limited to 'wgpu/src/window')
-rw-r--r-- | wgpu/src/window/compositor.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index 91884ec4..fa1f441a 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -6,9 +6,11 @@ use iced_graphics::compositor; use iced_native::futures; use raw_window_handle::HasRawWindowHandle; +use std::marker::PhantomData; + /// A window graphics backend for iced powered by `wgpu`. #[allow(missing_debug_implementations)] -pub struct Compositor { +pub struct Compositor<Theme> { settings: Settings, instance: wgpu::Instance, adapter: wgpu::Adapter, @@ -16,9 +18,10 @@ pub struct Compositor { queue: wgpu::Queue, staging_belt: wgpu::util::StagingBelt, format: wgpu::TextureFormat, + theme: PhantomData<Theme>, } -impl Compositor { +impl<Theme> Compositor<Theme> { const CHUNK_SIZE: u64 = 10 * 1024; /// Requests a new [`Compositor`] with the given [`Settings`]. @@ -105,6 +108,7 @@ impl Compositor { queue, staging_belt, format, + theme: PhantomData, }) } @@ -114,15 +118,15 @@ impl Compositor { } } -impl iced_graphics::window::Compositor for Compositor { +impl<Theme> iced_graphics::window::Compositor for Compositor<Theme> { type Settings = Settings; - type Renderer = Renderer; + type Renderer = Renderer<Theme>; type Surface = wgpu::Surface; fn new<W: HasRawWindowHandle>( settings: Self::Settings, compatible_window: Option<&W>, - ) -> Result<(Self, Renderer), Error> { + ) -> Result<(Self, Self::Renderer), Error> { let compositor = futures::executor::block_on(Self::request( settings, compatible_window, |