use core::sync::atomic::{AtomicBool, Ordering};
use crate::host::WindowHandle;
pub struct AndroidWindow {
dirty: AtomicBool,
}
impl AndroidWindow {
pub fn new() -> Self {
Self {
dirty: AtomicBool::new(true),
}
}
pub fn take_dirty(&self) -> bool {
self.dirty.swap(false, Ordering::AcqRel)
}
pub fn mark_dirty(&self) {
self.dirty.store(true, Ordering::Release);
}
}
impl Default for AndroidWindow {
fn default() -> Self {
Self::new()
}
}
impl WindowHandle for AndroidWindow {
fn request_redraw(&self) {
self.dirty.store(true, Ordering::Release);
}
}