diff options
Diffstat (limited to 'tiny_skia/src/raster.rs')
-rw-r--r-- | tiny_skia/src/raster.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tiny_skia/src/raster.rs b/tiny_skia/src/raster.rs index 5f17ae60..c40f55b2 100644 --- a/tiny_skia/src/raster.rs +++ b/tiny_skia/src/raster.rs @@ -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>, } @@ -30,6 +31,7 @@ impl Pipeline { handle: &raster::Handle, filter_method: raster::FilterMethod, bounds: Rectangle, + opacity: f32, pixels: &mut tiny_skia::PixmapMut<'_>, transform: tiny_skia::Transform, clip_mask: Option<&tiny_skia::Mask>, @@ -55,6 +57,7 @@ impl Pipeline { image, &tiny_skia::PixmapPaint { quality, + opacity, ..Default::default() }, transform, @@ -68,10 +71,10 @@ impl Pipeline { } } -#[derive(Default)] +#[derive(Debug, Default)] struct Cache { - entries: FxHashMap<u64, Option<Entry>>, - hits: FxHashSet<u64>, + entries: FxHashMap<raster::Id, Option<Entry>>, + hits: FxHashSet<raster::Id>, } impl Cache { @@ -82,7 +85,7 @@ impl Cache { let id = handle.id(); if let hash_map::Entry::Vacant(entry) = self.entries.entry(id) { - let image = graphics::image::load(handle).ok()?.into_rgba8(); + let image = graphics::image::load(handle).ok()?; let mut buffer = vec![0u32; image.width() as usize * image.height() as usize]; @@ -119,6 +122,7 @@ impl Cache { } } +#[derive(Debug)] struct Entry { width: u32, height: u32, |