Merge branch 'master' into wgpu/better-architecture

This commit is contained in:
Héctor Ramón Jiménez 2024-04-07 14:01:05 +02:00
commit 13289dbd19
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
41 changed files with 318 additions and 267 deletions

View file

@ -10,6 +10,9 @@ homepage.workspace = true
categories.workspace = true
keywords.workspace = true
[lints]
workspace = true
[features]
image = ["iced_graphics/image"]
svg = ["resvg"]

View file

@ -9,6 +9,7 @@ use crate::window;
use std::borrow::Cow;
#[derive(Debug)]
pub struct Backend {
text_pipeline: crate::text::Pipeline,

View file

@ -8,6 +8,7 @@ use crate::graphics::geometry::{self, Path, Style, Text};
use crate::graphics::Gradient;
use crate::primitive::{self, Primitive};
#[derive(Debug)]
pub struct Frame {
size: Size,
transform: tiny_skia::Transform,

View file

@ -1,5 +1,4 @@
#![forbid(rust_2018_idioms)]
#![deny(unsafe_code, unused_results, rustdoc::broken_intra_doc_links)]
#![allow(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub mod window;

View file

@ -6,6 +6,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
use std::cell::RefCell;
use std::collections::hash_map;
#[derive(Debug)]
pub struct Pipeline {
cache: RefCell<Cache>,
}
@ -68,7 +69,7 @@ impl Pipeline {
}
}
#[derive(Default)]
#[derive(Debug, Default)]
struct Cache {
entries: FxHashMap<u64, Option<Entry>>,
hits: FxHashSet<u64>,
@ -119,6 +120,7 @@ impl Cache {
}
}
#[derive(Debug)]
struct Entry {
width: u32,
height: u32,

View file

@ -13,7 +13,7 @@ use std::borrow::Cow;
use std::cell::RefCell;
use std::collections::hash_map;
#[allow(missing_debug_implementations)]
#[derive(Debug)]
pub struct Pipeline {
glyph_cache: GlyphCache,
cache: RefCell<Cache>,

View file

@ -9,6 +9,7 @@ use std::cell::RefCell;
use std::collections::hash_map;
use std::fs;
#[derive(Debug)]
pub struct Pipeline {
cache: RefCell<Cache>,
}
@ -203,3 +204,13 @@ impl Cache {
self.raster_hits.clear();
}
}
impl std::fmt::Debug for Cache {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Cache")
.field("tree_hits", &self.tree_hits)
.field("rasters", &self.rasters)
.field("raster_hits", &self.raster_hits)
.finish_non_exhaustive()
}
}

View file

@ -8,11 +8,13 @@ use crate::{Backend, Primitive, Renderer, Settings};
use std::collections::VecDeque;
use std::num::NonZeroU32;
#[allow(missing_debug_implementations)]
pub struct Compositor {
context: softbuffer::Context<Box<dyn compositor::Window>>,
settings: Settings,
}
#[allow(missing_debug_implementations)]
pub struct Surface {
window: softbuffer::Surface<
Box<dyn compositor::Window>,