Skip to content

Commit

Permalink
Make fill_window a no-op on mobile platforms for now
Browse files Browse the repository at this point in the history
  • Loading branch information
notgull committed Jun 4, 2023
1 parent 4aface5 commit b7c9d8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ smol_str = "0.2.0"
[dev-dependencies]
image = { version = "0.24.0", default-features = false, features = ["png"] }
simple_logger = { version = "2.1.0", default_features = false }

[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dev-dependencies]
softbuffer = "0.2.0"

[target.'cfg(target_os = "android")'.dependencies]
Expand Down
16 changes: 12 additions & 4 deletions examples/util/fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
//! The `softbuffer` crate is used, largely because of its ease of use. `glutin` or `wgpu` could
//! also be used to fill the window buffer, but they are more complicated to use.
use softbuffer::GraphicsContext;
use std::cell::RefCell;
use std::collections::HashMap;
use winit::window::{Window, WindowId};
use winit::window::Window;

#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub(super) fn fill_window(window: &Window) {
use softbuffer::GraphicsContext;
use std::cell::RefCell;
use std::collections::HashMap;
use winit::window::WindowId;

thread_local! {
/// A static, thread-local map of graphics contexts to open windows.
static GC: RefCell<HashMap<WindowId, GraphicsContext>> = RefCell::new(HashMap::new());
Expand All @@ -35,3 +38,8 @@ pub(super) fn fill_window(window: &Window) {
context.set_buffer(&buffer, size.width as u16, size.height as u16);
})
}

#[cfg(any(target_os = "android", target_os = "ios"))]
pub(super) fn fill_window(_window: &Window) {
// No-op on mobile platforms.
}

0 comments on commit b7c9d8f

Please sign in to comment.